javax.swing

接口
异常
java.lang.Object
  继承者 java.awt.Component
      继承者 java.awt.Container
          继承者 javax.swing.JComponent
              继承者 javax.swing.JLayeredPane
                  继承者 javax.swing.JDesktopPane
所有已实现的接口:
ImageObserver, MenuContainer, Serializable, Accessible

public class JDesktopPane
     
extends JLayeredPane
implements Accessible

用于创建多文档界面或虚拟桌面的容器。用户可创建 JInternalFrame 对象并将其添加到 JDesktopPaneJDesktopPane 扩展了 JLayeredPane,以管理可能的重叠内部窗体。它还维护了对 DesktopManager 实例的引用,这是由 UI 类为当前的外观 (L&F) 所设置的。注意,JDesktopPane 不支持边界。

此类通常用作 JInternalFrames 的父类,为 JInternalFrames 提供一个可插入的 DesktopManager 对象。特定于 L&F 的实现 installUI 负责正确设置 desktopManager 变量。JInternalFrame 的父类是 JDesktopPane 时,它应该将其大部分行为(关闭、调整大小等)委托给 desktopManager

有关此内容更多的文档和示例,请参阅 The Java TutorialHow 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 已更改的通知。
 
从类 javax.swing.JLayeredPane 继承的方法
getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, putLayer, setLayer, setLayer, setPosition
 
从类 javax.swing.JComponent 继承的方法
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
从类 java.awt.Container 继承的方法
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, removeContainerListener, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
从类 java.awt.Component 继承的方法
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

字段详细信息

LIVE_DRAG_MODE

public static final int LIVE_DRAG_MODE
指示正在被拖动项的所有内容是否应该出现在桌面窗格内部。

另请参见:
OUTLINE_DRAG_MODE, setDragMode(int), 常量字段值

OUTLINE_DRAG_MODE

public static final int OUTLINE_DRAG_MODE
指示桌面窗格是否只应该出现正在被拖动项的轮廓。

另请参见:
LIVE_DRAG_MODE, setDragMode(int), 常量字段值
构造方法详细信息

JDesktopPane

public JDesktopPane()
创建一个新的 JDesktopPane

方法详细信息

getUI

public DesktopPaneUI getUI()
返回呈现此组件的 L&F 对象。

返回:
呈现此组件的 DesktopPaneUI 对象

setUI

public void setUI(DesktopPaneUI ui)
设置呈现此组件的 L&F 对象。

参数:
ui - DesktopPaneUI L&F 对象
另请参见:
UIDefaults.getUI(javax.swing.JComponent)

setDragMode

public void setDragMode(int dragMode)
设置桌面窗格使用的“拖动样式”。出于性能或审美的原因,可能要更改模式。

参数:
dragMode - 为 Desktop 中各项所用的拖动样式
从以下版本开始:
1.3
另请参见:
LIVE_DRAG_MODE, OUTLINE_DRAG_MODE

getDragMode

public int getDragMode()
获取桌面窗格当前使用的“拖动样式”。

返回:
Live_DRAG_MODEOUTLINE_DRAG_MODE
从以下版本开始:
1.3
另请参见:
setDragMode(int)

getDesktopManager

public