< prev index next >
src/java.desktop/share/classes/javax/swing/JDesktopPane.java
Print this page
*** 44,68 ****
import java.util.Set;
import java.util.TreeSet;
import java.util.LinkedHashSet;
/**
* A container used to create a multiple-document interface or a virtual desktop.
! * You create <code>JInternalFrame</code> objects and add them to the
! * <code>JDesktopPane</code>. <code>JDesktopPane</code> extends
! * <code>JLayeredPane</code> to manage the potentially overlapping internal
* frames. It also maintains a reference to an instance of
! * <code>DesktopManager</code> that is set by the UI
! * class for the current look and feel (L&F). Note that <code>JDesktopPane</code>
* does not support borders.
* <p>
! * This class is normally used as the parent of <code>JInternalFrames</code>
! * to provide a pluggable <code>DesktopManager</code> object to the
! * <code>JInternalFrames</code>. The <code>installUI</code> of the
* L&F specific implementation is responsible for setting the
! * <code>desktopManager</code> variable appropriately.
! * When the parent of a <code>JInternalFrame</code> is a <code>JDesktopPane</code>,
! * it should delegate most of its behavior to the <code>desktopManager</code>
* (closing, resizing, etc).
* <p>
* For further documentation and examples see
* <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/internalframe.html">How to Use Internal Frames</a>,
* a section in <em>The Java Tutorial</em>.
--- 44,68 ----
import java.util.Set;
import java.util.TreeSet;
import java.util.LinkedHashSet;
/**
* A container used to create a multiple-document interface or a virtual desktop.
! * You create {@code JInternalFrame} objects and add them to the
! * {@code JDesktopPane}. {@code JDesktopPane} extends
! * {@code JLayeredPane} to manage the potentially overlapping internal
* frames. It also maintains a reference to an instance of
! * {@code DesktopManager} that is set by the UI
! * class for the current look and feel (L&F). Note that {@code JDesktopPane}
* does not support borders.
* <p>
! * This class is normally used as the parent of {@code JInternalFrames}
! * to provide a pluggable {@code DesktopManager} object to the
! * {@code JInternalFrames}. The {@code installUI} of the
* L&F specific implementation is responsible for setting the
! * {@code desktopManager} variable appropriately.
! * When the parent of a {@code JInternalFrame} is a {@code JDesktopPane},
! * it should delegate most of its behavior to the {@code desktopManager}
* (closing, resizing, etc).
* <p>
* For further documentation and examples see
* <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/internalframe.html">How to Use Internal Frames</a>,
* a section in <em>The Java Tutorial</em>.
*** 76,86 ****
* 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 JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see JInternalFrame
* @see JInternalFrame.JDesktopIcon
* @see DesktopManager
--- 76,86 ----
* 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 JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see JInternalFrame
* @see JInternalFrame.JDesktopIcon
* @see DesktopManager
*** 124,134 ****
private transient List<JInternalFrame> framesCache;
private boolean componentOrderCheckingEnabled = true;
private boolean componentOrderChanged = false;
/**
! * Creates a new <code>JDesktopPane</code>.
*/
public JDesktopPane() {
setUIProperty("opaque", Boolean.TRUE);
setFocusCycleRoot(true);
--- 124,134 ----
private transient List<JInternalFrame> framesCache;
private boolean componentOrderCheckingEnabled = true;
private boolean componentOrderChanged = false;
/**
! * Creates a new {@code JDesktopPane}.
*/
public JDesktopPane() {
setUIProperty("opaque", Boolean.TRUE);
setFocusCycleRoot(true);
*** 149,159 ****
}
/**
* Returns the L&F object that renders this component.
*
! * @return the <code>DesktopPaneUI</code> object that
* renders this component
*/
public DesktopPaneUI getUI() {
return (DesktopPaneUI)ui;
}
--- 149,159 ----
}
/**
* Returns the L&F object that renders this component.
*
! * @return the {@code DesktopPaneUI} object that
* renders this component
*/
public DesktopPaneUI getUI() {
return (DesktopPaneUI)ui;
}
*** 197,208 ****
dragModeSet = true;
}
/**
* Gets the current "dragging style" used by the desktop pane.
! * @return either <code>Live_DRAG_MODE</code> or
! * <code>OUTLINE_DRAG_MODE</code>
* @see #setDragMode
* @since 1.3
*/
public int getDragMode() {
return dragMode;
--- 197,208 ----
dragModeSet = true;
}
/**
* Gets the current "dragging style" used by the desktop pane.
! * @return either {@code Live_DRAG_MODE} or
! * {@code OUTLINE_DRAG_MODE}
* @see #setDragMode
* @since 1.3
*/
public int getDragMode() {
return dragMode;
*** 218,232 ****
public DesktopManager getDesktopManager() {
return desktopManager;
}
/**
! * Sets the <code>DesktopManger</code> that will handle
* desktop-specific UI actions. This may be overridden by
* {@code LookAndFeel}.
*
! * @param d the <code>DesktopManager</code> to use
*
* @beaninfo
* bound: true
* description: Desktop manager to handle the internal frames in the
* desktop pane.
--- 218,232 ----
public DesktopManager getDesktopManager() {
return desktopManager;
}
/**
! * Sets the {@code DesktopManger} that will handle
* desktop-specific UI actions. This may be overridden by
* {@code LookAndFeel}.
*
! * @param d the {@code DesktopManager} to use
*
* @beaninfo
* bound: true
* description: Desktop manager to handle the internal frames in the
* desktop pane.
*** 236,248 ****
desktopManager = d;
firePropertyChange("desktopManager", oldValue, desktopManager);
}
/**
! * Notification from the <code>UIManager</code> that the L&F has changed.
* Replaces the current UI object with the latest version from the
! * <code>UIManager</code>.
*
* @see JComponent#updateUI
*/
public void updateUI() {
setUI((DesktopPaneUI)UIManager.getUI(this));
--- 236,248 ----
desktopManager = d;
firePropertyChange("desktopManager", oldValue, desktopManager);
}
/**
! * Notification from the {@code UIManager} that the L&F has changed.
* Replaces the current UI object with the latest version from the
! * {@code UIManager}.
*
* @see JComponent#updateUI
*/
public void updateUI() {
setUI((DesktopPaneUI)UIManager.getUI(this));
*** 259,272 ****
public String getUIClassID() {
return uiClassID;
}
/**
! * Returns all <code>JInternalFrames</code> currently displayed in the
* desktop. Returns iconified frames as well as expanded frames.
*
! * @return an array of <code>JInternalFrame</code> objects
*/
public JInternalFrame[] getAllFrames() {
return getAllFrames(this).toArray(new JInternalFrame[0]);
}
--- 259,272 ----
public String getUIClassID() {
return uiClassID;
}
/**
! * Returns all {@code JInternalFrames} currently displayed in the
* desktop. Returns iconified frames as well as expanded frames.
*
! * @return an array of {@code JInternalFrame} objects
*/
public JInternalFrame[] getAllFrames() {
return getAllFrames(this).toArray(new JInternalFrame[0]);
}
*** 288,312 ****
}
}
return results;
}
! /** Returns the currently active <code>JInternalFrame</code>
! * in this <code>JDesktopPane</code>, or <code>null</code>
! * if no <code>JInternalFrame</code> is currently active.
*
! * @return the currently active <code>JInternalFrame</code> or
! * <code>null</code>
* @since 1.3
*/
public JInternalFrame getSelectedFrame() {
return selectedFrame;
}
! /** Sets the currently active <code>JInternalFrame</code>
! * in this <code>JDesktopPane</code>. 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.
* @see JInternalFrame#setSelected(boolean)
--- 288,312 ----
}
}
return results;
}
! /** Returns the currently active {@code JInternalFrame}
! * in this {@code JDesktopPane}, or {@code null}
! * if no {@code JInternalFrame} is currently active.
*
! * @return the currently active {@code JInternalFrame} or
! * {@code null}
* @since 1.3
*/
public JInternalFrame getSelectedFrame() {
return selectedFrame;
}
! /** Sets the currently active {@code JInternalFrame}
! * in this {@code 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.
* @see JInternalFrame#setSelected(boolean)
*** 318,333 ****
public void setSelectedFrame(JInternalFrame f) {
selectedFrame = f;
}
/**
! * Returns all <code>JInternalFrames</code> currently displayed in the
* specified layer of the desktop. Returns iconified frames as well
* expanded frames.
*
* @param layer an int specifying the desktop layer
! * @return an array of <code>JInternalFrame</code> objects
* @see JLayeredPane
*/
public JInternalFrame[] getAllFramesInLayer(int layer) {
Collection<JInternalFrame> allFrames = getAllFrames(this);
Iterator<JInternalFrame> iterator = allFrames.iterator();
--- 318,333 ----
public void setSelectedFrame(JInternalFrame f) {
selectedFrame = f;
}
/**
! * Returns all {@code JInternalFrames} currently displayed in the
* specified layer of the desktop. Returns iconified frames as well
* expanded frames.
*
* @param layer an int specifying the desktop layer
! * @return an array of {@code JInternalFrame} objects
* @see JLayeredPane
*/
public JInternalFrame[] getAllFramesInLayer(int layer) {
Collection<JInternalFrame> allFrames = getAllFrames(this);
Iterator<JInternalFrame> iterator = allFrames.iterator();
*** 441,456 ****
super.remove(comp);
updateFramesCache();
}
/**
! * Selects the next <code>JInternalFrame</code> in this desktop pane.
*
* @param forward a boolean indicating which direction to select in;
! * <code>true</code> for forward, <code>false</code> for
* backward
! * @return the JInternalFrame that was selected or <code>null</code>
* if nothing was selected
* @since 1.6
*/
public JInternalFrame selectFrame(boolean forward) {
JInternalFrame selectedFrame = getSelectedFrame();
--- 441,456 ----
super.remove(comp);
updateFramesCache();
}
/**
! * Selects the next {@code JInternalFrame} in this desktop pane.
*
* @param forward a boolean indicating which direction to select in;
! * {@code true} for forward, {@code false} for
* backward
! * @return the JInternalFrame that was selected or {@code null}
* if nothing was selected
* @since 1.6
*/
public JInternalFrame selectFrame(boolean forward) {
JInternalFrame selectedFrame = getSelectedFrame();
*** 470,480 ****
return frameToSelect;
}
/*
* Sets whether component order checking is enabled.
! * @param enable a boolean value, where <code>true</code> means
* a change in component order will cause a change in the keyboard
* navigation order.
* @since 1.6
*/
void setComponentOrderCheckingEnabled(boolean enable) {
--- 470,480 ----
return frameToSelect;
}
/*
* Sets whether component order checking is enabled.
! * @param enable a boolean value, where {@code true} means
* a change in component order will cause a change in the keyboard
* navigation order.
* @since 1.6
*/
void setComponentOrderCheckingEnabled(boolean enable) {
*** 568,584 ****
super.setUIProperty(propertyName, value);
}
}
/**
! * Returns a string representation of this <code>JDesktopPane</code>.
* 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 <code>null</code>.
*
! * @return a string representation of this <code>JDesktopPane</code>
*/
protected String paramString() {
String desktopManagerString = (desktopManager != null ?
desktopManager.toString() : "");
--- 568,584 ----
super.setUIProperty(propertyName, value);
}
}
/**
! * Returns a string representation of this {@code 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 {@code null}.
*
! * @return a string representation of this {@code JDesktopPane}
*/
protected String paramString() {
String desktopManagerString = (desktopManager != null ?
desktopManager.toString() : "");
*** 589,627 ****
/////////////////
// Accessibility support
////////////////
/**
! * Gets the <code>AccessibleContext</code> associated with this
! * <code>JDesktopPane</code>. For desktop panes, the
! * <code>AccessibleContext</code> takes the form of an
! * <code>AccessibleJDesktopPane</code>.
! * A new <code>AccessibleJDesktopPane</code> instance is created if necessary.
*
! * @return an <code>AccessibleJDesktopPane</code> that serves as the
! * <code>AccessibleContext</code> of this <code>JDesktopPane</code>
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJDesktopPane();
}
return accessibleContext;
}
/**
* This class implements accessibility support for the
! * <code>JDesktopPane</code> class. It provides an implementation of the
* Java Accessibility API appropriate to desktop pane user-interface
* elements.
* <p>
* <strong>Warning:</strong>
* 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 JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
protected class AccessibleJDesktopPane extends AccessibleJComponent {
--- 589,627 ----
/////////////////
// Accessibility support
////////////////
/**
! * Gets the {@code AccessibleContext} associated with this
! * {@code JDesktopPane}. For desktop panes, the
! * {@code AccessibleContext} takes the form of an
! * {@code AccessibleJDesktopPane}.
! * A new {@code AccessibleJDesktopPane} instance is created if necessary.
*
! * @return an {@code AccessibleJDesktopPane} that serves as the
! * {@code AccessibleContext} of this {@code JDesktopPane}
*/
public AccessibleContext getAccessibleContext() {
if (accessibleContext == null) {
accessibleContext = new AccessibleJDesktopPane();
}
return accessibleContext;
}
/**
* This class implements accessibility support for the
! * {@code JDesktopPane} class. It provides an implementation of the
* Java Accessibility API appropriate to desktop pane user-interface
* elements.
* <p>
* <strong>Warning:</strong>
* 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 JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*/
@SuppressWarnings("serial") // Same-version serialization only
protected class AccessibleJDesktopPane extends AccessibleJComponent {
< prev index next >