| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
JDesktopPane desktop = new JDesktopPane();
Based on 70 examples
public class JDesktopPane extends JLayeredPane implements Accessible
A container used to create a multiple-document interface or a virtual desktop.
You create JInternalFrame
objects and add them to the
JDesktopPane
. JDesktopPane
extends
JLayeredPane
to manage the potentially overlapping internal
frames. It also maintains a reference to an instance of
DesktopManager
that is set by the UI
class for the current look and feel (L&F). Note that JDesktopPane
does not support borders.
This class is normally used as the parent of JInternalFrames
to provide a pluggable DesktopManager
object to the
JInternalFrames
. The installUI
of the
L&F specific implementation is responsible for setting the
desktopManager
variable appropriately.
When the parent of a JInternalFrame
is a JDesktopPane
,
it should delegate most of its behavior to the desktopManager
(closing, resizing, etc).
For further documentation and examples see How to Use Internal Frames, a section in The Java Tutorial.
Warning: Swing is not thread safe. For more information see Swing's Threading Policy.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans
package.
Please see {@link java.beans.XMLEncoder}.
Nested Class Summary | |
---|---|
protected class |
This class implements accessibility support for the JDesktopPane class. |
Nested classes/interfaces inherited from class javax.swing.JLayeredPane |
---|
JLayeredPane.AccessibleJLayeredPane |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static int |
LIVE_DRAG_MODE
Indicates that the entire contents of the item being dragged should appear inside the desktop pane. |
static int |
OUTLINE_DRAG_MODE
Indicates that an outline only of the item being dragged should appear inside the desktop pane. |
Fields inherited from class javax.swing.JLayeredPane |
---|
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Constructor Summary | |
---|---|
Creates a new JDesktopPane .
|
Method Summary | |
---|---|
protected void |
|
AccessibleContext |
Gets the AccessibleContext associated with this
JDesktopPane .
|
JInternalFrame[] |
Returns all JInternalFrames currently displayed in the
desktop.
|
JInternalFrame[] |
getAllFramesInLayer(int layer) Returns all JInternalFrames currently displayed in the
specified layer of the desktop.
|
DesktopManager |
Returns the DesktopManger that handles
desktop-specific UI actions.
|
int |
Gets the current "dragging style" used by the desktop pane. |
JInternalFrame |
Returns the currently active JInternalFrame
in this JDesktopPane , or null
if no JInternalFrame is currently active.
|
DesktopPaneUI |
getUI() Returns the L&F object that renders this component. |
String |
Returns the name of the L&F class that renders this component. |
protected String |
Returns a string representation of this JDesktopPane .
|
void |
remove(int index) Remove the indexed component from this pane. |
void |
Removes all the components from this container. |
JInternalFrame |
selectFrame(boolean forward) Selects the next JInternalFrame in this desktop pane.
|
void |
setComponentZOrder(Component comp, int index) Moves the specified component to the specified z-order index in the container. |
void |
Sets the DesktopManger that will handle
desktop-specific UI actions.
|
void |
setDragMode(int dragMode) Sets the "dragging style" used by the desktop pane. |
void |
Sets the currently active JInternalFrame
in this JDesktopPane .
|
void |
setUI(DesktopPaneUI ui) Sets the L&F object that renders this component. |
void |
updateUI() Notification from the UIManager that the L&F has changed.
|
Methods inherited from class javax.swing.JLayeredPane |
---|
addImpl, getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, paramString, putLayer, remove, removeAll, setLayer, setLayer, setPosition |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int LIVE_DRAG_MODE
public static final int OUTLINE_DRAG_MODE
Constructor Detail |
---|
public JDesktopPane()
JDesktopPane
.
Method Detail |
---|
protected void addImpl(Component comp, Object constraints, int index)
addImpl
in class JLayeredPane
comp
constraints
index
public AccessibleContext getAccessibleContext()
AccessibleContext
associated with this
JDesktopPane
. For desktop panes, the
AccessibleContext
takes the form of an
AccessibleJDesktopPane
.
A new AccessibleJDesktopPane
instance is created if necessary.
getAccessibleContext
in class JLayeredPane
AccessibleJDesktopPane
that serves as the
AccessibleContext
of this JDesktopPane
public JInternalFrame[] getAllFrames()
JInternalFrames
currently displayed in the
desktop. Returns iconified frames as well as expanded frames.
JInternalFrame
objectspublic JInternalFrame[] getAllFramesInLayer(int layer)
JInternalFrames
currently displayed in the
specified layer of the desktop. Returns iconified frames as well
expanded frames.
layer
- an int specifying the desktop layerJInternalFrame
objectspublic DesktopManager getDesktopManager()
DesktopManger
that handles
desktop-specific UI actions.
public int getDragMode()
Live_DRAG_MODE
or
OUTLINE_DRAG_MODE
public JInternalFrame getSelectedFrame()
JInternalFrame
in this JDesktopPane
, or null
if no JInternalFrame
is currently active.
JInternalFrame
or
null
public DesktopPaneUI getUI()
DesktopPaneUI
object that
renders this componentpublic String getUIClassID()
getUIClassID
in class JComponent
protected String paramString()
JDesktopPane
.
This method is intended to be used only for debugging purposes, and the
content and format of the returned string may vary between
implementations. The returned string may be empty but may not
be null
.
paramString
in class JLayeredPane
JDesktopPane
public void remove(int index)
remove
in class JLayeredPane
index
public void removeAll()
removeAll
in class JLayeredPane
public JInternalFrame selectFrame(boolean forward)
JInternalFrame
in this desktop pane.
forward
- a boolean indicating which direction to select in;
true
for forward, false
for
backwardnull
if nothing was selectedpublic void setComponentZOrder(Component comp, int index)
setComponentZOrder
in class Container
comp
index
public void setDesktopManager(DesktopManager d)
DesktopManger
that will handle
desktop-specific UI actions.
d
- the DesktopManager
to usepublic void setDragMode(int dragMode)
dragMode
- the style of drag to use for items in the Desktoppublic void setSelectedFrame(JInternalFrame f)
JInternalFrame
in this JDesktopPane
. This method is used to bridge
the package gap between JDesktopPane and the platform implementation
code and should not be called directly. To visually select the frame
the client must call JInternalFrame.setSelected(true) to activate
the frame.
f
- the internal frame that's currently selectedpublic void setUI(DesktopPaneUI ui)
ui
- the DesktopPaneUI L&F objectpublic void updateUI()
UIManager
that the L&F has changed.
Replaces the current UI object with the latest version from the
UIManager
.
updateUI
in class JComponent
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |