- java.lang.Object
-
- javax.swing.DefaultDesktopManager
-
- All Implemented Interfaces:
-
Serializable,DesktopManager
public class DefaultDesktopManager extends Object implements DesktopManager, Serializable
这是一个DesktopManager的实现。 它目前实现了在任意父级中管理JInternalFrame的基本行为。JInternalFrame的孩子的JDesktop将使用此组件来处理其类似桌面的操作。这个类为各种JInternalFrame方法提供了一个策略,它不是直接调用,而是将各种JInternalFrame方法调用到DesktopManager中。
- 从以下版本开始:
- 1.2
- 另请参见:
-
JDesktopPane,JInternalFrame, Serialized Form
-
-
构造方法摘要
构造方法 Constructor 描述 DefaultDesktopManager()
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 voidactivateFrame(JInternalFrame f)这将激活 f将其移动到前面。voidbeginDraggingFrame(JComponent f)通常当用户指示它们将开始拖动组件时调用此方法。voidbeginResizingFrame(JComponent f, int direction)当用户指示它们将开始调整框架大小时,通常会调用此方法。voidcloseFrame(JInternalFrame f)从其父母移除框架,如果需要的desktopIcon,移除desktopIcon。voiddeactivateFrame(JInternalFrame f)一般来说,表明这个框架已经失焦了。voiddeiconifyFrame(JInternalFrame f)从其父项中删除desktopIcon,并将其框架添加到父级。voiddragFrame(JComponent f, int newX, int newY)将被拖动的框架的可视位置移动到指定的位置。voidendDraggingFrame(JComponent f)此方法表示拖动会话的结束。voidendResizingFrame(JComponent f)此方法指示调整大小会话的结束。protected RectanglegetBoundsForIconOf(JInternalFrame f)iconifyFrame()代码调用这个来确定desktopIcon的正确边界。protected RectanglegetPreviousBounds(JInternalFrame f)在组件最大化之前获取组件的正常范围。voidiconifyFrame(JInternalFrame f)从其父项中移除框架,并将其desktopIcon添加到父项。voidmaximizeFrame(JInternalFrame f)调整框架大小以填补父母的边界。voidminimizeFrame(JInternalFrame f)在maximizeFrame呼叫之前将帧恢复到其大小和位置。voidopenFrame(JInternalFrame f)通常这种方法不会被调用。protected voidremoveIconFor(JInternalFrame f)方便的方法来去除 f的desktopIcon的是必要的。voidresizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)用新值调用setBoundsForFrame。voidsetBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)这会使JComponent移动并重绘受损区域。protected voidsetPreviousBounds(JInternalFrame f, Rectangle r)在最大化调用之前存储组件的边界。protected voidsetWasIcon(JInternalFrame f, Boolean value)设置组件已被图标化,并且desktopIcon的边界是有效的。protected booleanwasIcon(JInternalFrame f)返回true如果组件已被图标化和的边界desktopIcon是有效的,否则返回false。
-
-
-
方法详细信息
-
openFrame
public void openFrame(JInternalFrame f)
通常这种方法不会被调用。 如果是,它会尝试从该框架的desktopIcon中确定适当的父项。 如果desktopIcon成功添加框架,将从它的父项删除desktopIcon。- Specified by:
-
openFrame在接口DesktopManager - 参数
-
f- 要显示的JInternalFrame
-
closeFrame
public void closeFrame(JInternalFrame f)
从其父母中移除框架,如有必要,可以删除desktopIcon。- Specified by:
-
closeFrame在接口DesktopManager - 参数
-
f- 要删除的JInternalFrame
-
maximizeFrame
public void maximizeFrame(JInternalFrame f)
调整框架大小以填补父母的边界。- Specified by:
-
maximizeFrame在接口DesktopManager - 参数
-
f- 要调整大小的框架
-
minimizeFrame
public void minimizeFrame(JInternalFrame f)
在maximizeFrame呼叫之前将帧恢复到其大小和位置。- Specified by:
-
minimizeFrame在接口DesktopManager - 参数
-
f- 要恢复的JInternalFrame
-
iconifyFrame
public void iconifyFrame(JInternalFrame f)
从其父项中移除框架,并将其desktopIcon添加到父级。- Specified by:
-
iconifyFrame在接口DesktopManager - 参数
-
f- 要JInternalFrame
-
deiconifyFrame
public void deiconifyFrame(JInternalFrame f)
从其父项中删除desktopIcon,并将其框架添加到父级。- Specified by:
-
deiconifyFrame在接口DesktopManager - 参数
-
f- 要取消图标化的JInternalFrame
-
activateFrame
public void activateFrame(JInternalFrame f)
这将激活f将其移动到前面。 它将当前活动框架(如果有)IS_SELECTED_PROPERTY为false。 跨所有图层只能有一个活动框架。- Specified by:
-
activateFrame在接口DesktopManager - 参数
-
f- 要激活的JInternalFrame
-
deactivateFrame
public void deactivateFrame(JInternalFrame f)
说明从界面DesktopManager复制一般来说,表明这个框架已经失焦了。 这通常在JInternalFrame的IS_SELECTED_PROPERTY设置为false之后调用。- Specified by:
-
deactivateFrame在接口DesktopManager - 参数
-
f- 要停用的JInternalFrame
-
beginDraggingFrame
public void beginDraggingFrame(JComponent f)
描述从接口DesktopManager复制通常当用户指示它们将开始拖动组件时调用此方法。 应该在任何dragFrame()调用之前调用此方法,以允许DesktopManager准备任何必要的状态。 通常f将是JInternalFrame。- Specified by:
-
beginDraggingFrame在接口DesktopManager - 参数
-
f-JComponent被拖动
-
dragFrame
public void dragFrame(JComponent f, int newX, int newY)
将被拖动的框架的可视位置移动到指定的位置。 发生这种情况的手段可以根据所使用的拖动算法而变化。 在调用endDraggingFrame之前,帧的实际逻辑位置可能不会改变。- Specified by:
-
dragFrame在接口DesktopManager - 参数
-
f-JComponent被拖动 -
newX- 新的x坐标 -
newY- 新的y坐标
-
endDraggingFrame
public void endDraggingFrame(JComponent f)
说明从接口DesktopManager复制此方法表示拖动会话的结束。 DesktopManager维护的任何状态都可以在这里删除。 通常f将是JInternalFrame。- Specified by:
-
endDraggingFrame在接口DesktopManager - 参数
-
f- 被拖动的JComponent
-
beginResizingFrame
public void beginResizingFrame(JComponent f, int direction)
说明从界面DesktopManager复制当用户指示它们将开始调整框架大小时,通常会调用此方法。 应该在调用任何resizeFrame()之前调用此方法,以允许DesktopManager准备任何必要的状态。 通常f将是JInternalFrame。- Specified by:
-
beginResizingFrame在接口DesktopManager - 参数
-
f-JComponent被调整大小 -
direction- 方向
-
resizeFrame
public void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)
通过新值呼叫setBoundsForFrame。- Specified by:
-
resizeFrame在接口DesktopManager - 参数
-
f- 要调整大小的组件 -
newX- 新的x坐标 -
newY- 新的y坐标 -
newWidth- 新的宽度 -
newHeight- 新的高度
-
endResizingFrame
public void endResizingFrame(JComponent f)
说明从接口DesktopManager复制此方法指示调整大小会话的结束。 DesktopManager维护的任何状态都可以在这里删除。 通常f将是JInternalFrame。- Specified by:
-
endResizingFrame在接口DesktopManager - 参数
-
f-JComponent被调整大小
-
setBoundsForFrame
public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)
这使JComponent和损坏的地区重绘。- Specified by:
-
setBoundsForFrame在接口DesktopManager - 参数
-
f-JComponent被移动或调整大小 -
newX- 新的x坐标 -
newY- 新的y坐标 -
newWidth- 新的宽度 -
newHeight- 新的高度
-
removeIconFor
protected void removeIconFor(JInternalFrame f)
方便的方法来去除 f的desktopIcon的是必要的。- 参数
-
f-JInternalFrame为其删除desktopIcon
-
getBoundsForIconOf
protected Rectangle getBoundsForIconOf(JInternalFrame f)
iconifyFrame()代码调用这个来确定desktopIcon的正确边界。- 参数
-
f- 感兴趣的JInternalFrame - 结果
-
一个
Rectangle包含的界限为desktopIcon
-
setPreviousBounds
protected void setPreviousBounds(JInternalFrame f, Rectangle r)
在最大化调用之前存储组件的边界。- 参数
-
f- 要调整大小的组件 -
r- 要保存的正常范围
-
getPreviousBounds
protected Rectangle getPreviousBounds(JInternalFrame f)
在组件最大化之前获取组件的正常范围。- 参数
-
f- 感兴趣的JInternalFrame - 结果
- 组件的正常界限
-
setWasIcon
protected void setWasIcon(JInternalFrame f, Boolean value)
设置组件已经被图标化,并且desktopIcon的范围是有效的。- 参数
-
f- 感兴趣的JInternalFrame -
value- aBoolean表示组件是否已被图标化
-
wasIcon
protected boolean wasIcon(JInternalFrame f)
返回true如果组件已被图标化和的边界desktopIcon是有效的,否则返回false。- 参数
-
f- 感兴趣的JInternalFrame - 结果
-
trueif the component has been iconized; otherwise returnsfalse
-
-