|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLayeredPane
javax.swing.JDesktopPane
public class JDesktopPane
用于创建多文档界面或虚拟桌面的容器。用户可创建 JInternalFrame 对象并将其添加到 JDesktopPane。JDesktopPane 扩展了 JLayeredPane,以管理可能的重叠内部窗体。它还维护了对 DesktopManager 实例的引用,这是由 UI 类为当前的外观 (L&F) 所设置的。注意,JDesktopPane 不支持边界。
此类通常用作 JInternalFrames 的父类,为 JInternalFrames 提供一个可插入的 DesktopManager 对象。特定于 L&F 的实现 installUI 负责正确设置 desktopManager 变量。JInternalFrame 的父类是 JDesktopPane 时,它应该将其大部分行为(关闭、调整大小等)委托给 desktopManager。
有关此内容更多的文档和示例,请参阅 The Java Tutorial 的 How to Use Internal Frames 一节。
警告: Swing 不是线程安全的。有关更多信息,请参阅 Swing's Threading Policy。
警告:此类的序列化对象与以后的 Swing 版本不兼容。当前序列化支持适用于短期存储,或适用于在运行相同 Swing 版本的应用程序之间进行 RMI(Remote Method Invocation,远程方法调用)。从 1.4 版本开始,已在 java.beans 包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder。
JInternalFrame,
JInternalFrame.JDesktopIcon,
DesktopManager| 嵌套类摘要 | |
|---|---|
protected class |
JDesktopPane.AccessibleJDesktopPane
此类实现对 JDesktopPane 类的可访问性支持。 |
| 从类 javax.swing.JLayeredPane 继承的嵌套类/接口 |
|---|
JLayeredPane.AccessibleJLayeredPane |
| 从类 javax.swing.JComponent 继承的嵌套类/接口 |
|---|
JComponent.AccessibleJComponent |
| 从类 java.awt.Container 继承的嵌套类/接口 |
|---|
Container.AccessibleAWTContainer |
| 从类 java.awt.Component 继承的嵌套类/接口 |
|---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| 字段摘要 | |
|---|---|
static int |
LIVE_DRAG_MODE
指示正在被拖动项的所有内容是否应该出现在桌面窗格内部。 |
static int |
OUTLINE_DRAG_MODE
指示桌面窗格是否只应该出现正在被拖动项的轮廓。 |
| 从类 javax.swing.JLayeredPane 继承的字段 |
|---|
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER |
| 从类 javax.swing.JComponent 继承的字段 |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| 从类 java.awt.Component 继承的字段 |
|---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| 从接口 java.awt.image.ImageObserver 继承的字段 |
|---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| 构造方法摘要 | |
|---|---|
JDesktopPane()
创建一个新的 JDesktopPane。 |
|
| 方法摘要 | |
|---|---|
protected void |
addImpl(Component comp,
Object constraints,
int index)
将指定组件添加到此容器的指定索引所在的位置上。 |
AccessibleContext |
getAccessibleContext()
获取与此 JDesktopPane 关联的 AccessibleContext。 |
JInternalFrame[] |
getAllFrames()
返回桌面中当前显示的所有 JInternalFrames。 |
JInternalFrame[] |
getAllFramesInLayer(int layer)
返回桌面指定层中当前所显示的所有 JInternalFrames。 |
DesktopManager |
getDesktopManager()
返回处理特定于桌面 UI 操作的 DesktopManger。 |
int |
getDragMode()
获取桌面窗格当前使用的“拖动样式”。 |
JInternalFrame |
getSelectedFrame()
返回此 JDesktopPane 中当前活动的 JInternalFrame,如果当前没有活动的 JInternalFrame,则返回 null。 |
DesktopPaneUI |
getUI()
返回呈现此组件的 L&F 对象。 |
String |
getUIClassID()
返回呈现此组件的 L&F 类名。 |
protected String |
paramString()
返回此 JDesktopPane 的字符串表示形式。 |
void |
remove(int index)
从此窗格中移除已索引的组件。 |
void |
removeAll()
从此容器中移除所有组件。 |
JInternalFrame |
selectFrame(boolean forward)
选择此桌面窗格中的下一个 JInternalFrame。 |
void |
setComponentZOrder(Component comp,
int index)
将指定组件移动到容器中指定的 z 顺序索引。 |
void |
setDesktopManager(DesktopManager d)
设置处理特定于桌面 UI 操作的 DesktopManger。 |
void |
setDragMode(int dragMode)
设置桌面窗格使用的“拖动样式”。 |
void |
setSelectedFrame(JInternalFrame f)
设置此 JDesktopPane 中当前活动的 JInternalFrame。 |
void |
setUI(DesktopPaneUI ui)
设置呈现此组件的 L&F 对象。 |
void |
updateUI()
UIManager 发出的关于 L&F 已更改的通知。 |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| 字段详细信息 |
|---|
public static final int LIVE_DRAG_MODE
OUTLINE_DRAG_MODE,
setDragMode(int),
常量字段值public static final int OUTLINE_DRAG_MODE
LIVE_DRAG_MODE,
setDragMode(int),
常量字段值| 构造方法详细信息 |
|---|
public JDesktopPane()
JDesktopPane。
| 方法详细信息 |
|---|
public DesktopPaneUI getUI()
DesktopPaneUI 对象public void setUI(DesktopPaneUI ui)
ui - DesktopPaneUI L&F 对象UIDefaults.getUI(javax.swing.JComponent)public void setDragMode(int dragMode)
dragMode - 为 Desktop 中各项所用的拖动样式LIVE_DRAG_MODE,
OUTLINE_DRAG_MODEpublic int getDragMode()
Live_DRAG_MODE 或 OUTLINE_DRAG_MODEsetDragMode(int)public DesktopManager getDesktopManager()
DesktopManger。
public void setDesktopManager(DesktopManager d)
DesktopManger。
d - 所使用的 DesktopManagerpublic void updateUI()
UIManager 发出的关于 L&F 已更改的通知。用来自 UIManager 的最新版本 UI 对象替换当前的 UI 对象。
JComponent 中的 updateUIJComponent.updateUI()public String getUIClassID()
JComponent 中的 getUIClassIDJComponent.getUIClassID(),
UIDefaults.getUI(javax.swing.JComponent)public JInternalFrame[] getAllFrames()
JInternalFrames。返回图标化的窗体和扩展的窗体。
JInternalFrame 对象的数组public JInternalFrame getSelectedFrame()
JDesktopPane 中当前活动的 JInternalFrame,如果当前没有活动的 JInternalFrame,则返回 null。
JInternalFrame 或 nullpublic void setSelectedFrame(JInternalFrame f)
JDesktopPane 中当前活动的 JInternalFrame。此方法用于连接JDesktopPane 和平台实现代码,不应该直接调用。要可视化地选择窗体,客户端必须调用 JInternalFrame.setSelected(true) 激活窗体。
f - 当前选中的内部窗体JInternalFrame.setSelected(boolean)public JInternalFrame[] getAllFramesInLayer(int layer)
JInternalFrames。返回图标化的窗体和扩展的窗体。
layer - 指定桌面层的 int 值
JInternalFrame 对象的数组JLayeredPanepublic JInternalFrame selectFrame(boolean forward)
JInternalFrame。
forward - 一个 boolean 值,指示选择的方向;true 表示向前,false 表示向后
null
protected void addImpl(Component comp,
Object constraints,
int index)
addLayoutComponent 方法,使用指定的约束对象将组件添加到此容器的布局中。
这些约束是由正使用的特定布局管理器定义的。例如,BorderLayout 类定义了五个约束:BorderLayout.NORTH、BorderLayout.SOUTH、BorderLayout.EAST、BorderLayout.WEST 和 BorderLayout.CENTER。
GridBagLayout 类需要一个 GridBagConstraints 对象。如果传递正确的约束对象类型时失败,则会导致 IllegalArgumentException。
如果当前布局管理器实现了 LayoutManager2,则在其上调用 LayoutManager2.addLayoutComponent(Component,Object)。如果当前布局管理器没有实现 LayoutManager2,并且约束是一个 String,则在其上调用 LayoutManager.addLayoutComponent(String,Component)。
如果该组件不是此容器的祖先容器,并且有一个非 null 父组件,则在将该组件添加到此容器之前,从其当前父组件中移除它。
在其他所有添加方法引用此方法时,如果某个程序需要追踪每个添加到容器的请求,那么这就是要重写的方法。被重写的方法通常应该包括一个对该方法的超类版本的调用:
super.addImpl(comp, constraints, index)
JLayeredPane 中的 addImplcomp - 要添加的组件constraints - 表示此组件的布局约束的对象Container.add(Component),
Container.add(Component, int),
Container.add(Component, java.lang.Object),
LayoutManager,
LayoutManager2public void remove(int index)
JLayeredPane 中的 removeindex - 指定要移除组件的 int 值JLayeredPane.getIndexOf(java.awt.Component)public void removeAll()
JLayeredPane 中的 removeAllContainer.add(java.awt.Component),
Container.remove(int)
public void setComponentZOrder(Component comp,
int index)
如果组件是其他某个 container 的子组件,则在将它添加到此容器之前,从该容器中移除它。此方法与 java.awt.Container.add(Component, int) 之间的重要不同是,在将组件从其以前的容器中移除时,此方法不对该组件调用 removeNotify,除非有此必要,并且基础本机窗口系统允许这样做。因此,如果组件拥有键盘焦点,那么在移动到新的位置上时,它会维持该焦点。
要保证此属性只应用于轻量级的非 Container 组件。
注:并不是所有的平台都支持在不调用 removeNotify 的情况下,将重量级组件的 z 顺序从一个容器更改到另一个容器中。无法检测某个平台是否支持这一点,因此开发人员不应该作出任何假设。
Container 中的 setComponentZOrdercomp - 要移动的组件index - 在容器的列表中插入组件的位置,其中 getComponentCount() 指追加到尾部Container.getComponentZOrder(java.awt.Component)protected String paramString()
JDesktopPane 的字符串表示形式。此方法仅在进行调试时使用,对于各个实现,所返回字符串的内容和格式可能有所不同。返回的字符串可能为空,但不可能为 null。
JLayeredPane 中的 paramStringJDesktopPane 的字符串表示形式public AccessibleContext getAccessibleContext()
JDesktopPane 关联的 AccessibleContext。对于桌面窗格,AccessibleContext 采用 AccessibleJDesktopPane 的形式。如有必要,可以创建一个新的 AccessibleJDesktopPane 实例。
Accessible 中的 getAccessibleContextJLayeredPane 中的 getAccessibleContextJDesktopPane 的 AccessibleContext 的 AccessibleJDesktopPane
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。