- java.lang.Object
-
- javax.swing.DefaultDesktopManager
-
- 实现的所有接口
-
Serializable,DesktopManager
public class DefaultDesktopManager extends Object implements DesktopManager, Serializable
这是DesktopManager的实现。 它目前实现了在任意父级中管理JInternalFrame的基本行为。JInternalFrame不是JDesktop将使用此组件来处理类似桌面的操作。此类为各种JInternalFrame方法提供策略,它不是直接调用,而是各种JInternalFrame方法将调用到DesktopManager中。
- 从以下版本开始:
- 1.2
- 另请参见:
-
JDesktopPane,JInternalFrame, Serialized Form
-
-
构造方法摘要
构造方法 构造器 描述 DefaultDesktopManager()
-
方法摘要
所有方法 实例方法 具体的方法 变量和类型 方法 描述 voidactivateFrame(JInternalFrame f)这将激活 f移动到前面。voidcloseFrame(JInternalFrame f)desktopIcon删除框架,如有必要,还可以desktopIcon。voiddeiconifyFrame(JInternalFrame f)从其父项中删除desktopIcon,并将其框架添加到父项。voiddragFrame(JComponent f, int newX, int newY)将拖动框架的可见位置移动到指定的位置。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。-
声明方法的类 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
声明方法的接口 javax.swing.DesktopManager
beginDraggingFrame, beginResizingFrame, deactivateFrame, endDraggingFrame, endResizingFrame
-
-
-
-
方法详细信息
-
openFrame
public void openFrame(JInternalFrame f)
通常不会调用此方法。 如果是,则尝试从帧的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
-
dragFrame
public void dragFrame(JComponent f, int newX, int newY)
将拖动框架的可见位置移动到指定的位置。 发生这种情况的方法可以根据使用的拖动算法而变化。 在调用endDraggingFrame之前,帧的实际逻辑位置可能不会更改。- Specified by:
-
dragFrame在界面DesktopManager - 参数
-
f- 被拖动的JComponent -
newX- 新的x坐标 -
newY- 新的y坐标
-
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- 新的高度
-
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- 表示组件是否已图标化的Boolean
-
wasIcon
protected boolean wasIcon(JInternalFrame f)
返回true如果组件已被图标化和的边界desktopIcon是有效的,否则返回false。- 参数
-
f- 感兴趣的JInternalFrame - 结果
-
true如果组件已图标化; 否则返回false
-
-