< prev index next >
src/java.desktop/share/classes/javax/swing/JLayeredPane.java
Print this page
*** 33,45 ****
import sun.awt.SunToolkit;
import javax.accessibility.*;
/**
! * <code>JLayeredPane</code> adds depth to a JFC/Swing container,
* allowing components to overlap each other when needed.
! * An <code>Integer</code> object specifies each component's depth in the
* container, where higher-numbered components sit "on top" of other
* components.
* For task-oriented documentation and examples of using layered panes see
* <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/layeredpane.html">How to Use a Layered Pane</a>,
* a section in <em>The Java Tutorial</em>.
--- 33,45 ----
import sun.awt.SunToolkit;
import javax.accessibility.*;
/**
! * {@code JLayeredPane} adds depth to a JFC/Swing container,
* allowing components to overlap each other when needed.
! * An {@code Integer} object specifies each component's depth in the
* container, where higher-numbered components sit "on top" of other
* components.
* For task-oriented documentation and examples of using layered panes see
* <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/layeredpane.html">How to Use a Layered Pane</a>,
* a section in <em>The Java Tutorial</em>.
*** 51,61 ****
* alt="The following text describes this image."
* WIDTH="269" HEIGHT="264" STYLE="FLOAT:BOTTOM; BORDER=0">
* </TD>
* </TR>
* </TABLE>
! * For convenience, <code>JLayeredPane</code> divides the depth-range
* into several different layers. Putting a component into one of those
* layers makes it easy to ensure that components overlap properly,
* without having to worry about specifying numbers for specific depths:
* <DL>
* <DT>DEFAULT_LAYER</DT>
--- 51,61 ----
* alt="The following text describes this image."
* WIDTH="269" HEIGHT="264" STYLE="FLOAT:BOTTOM; BORDER=0">
* </TD>
* </TR>
* </TABLE>
! * For convenience, {@code JLayeredPane} divides the depth-range
* into several different layers. Putting a component into one of those
* layers makes it easy to ensure that components overlap properly,
* without having to worry about specifying numbers for specific depths:
* <DL>
* <DT>DEFAULT_LAYER</DT>
*** 74,127 ****
* <DT>DRAG_LAYER</DT>
* <DD>When dragging a component, reassigning it to the drag layer ensures
* that it is positioned over every other component in the container. When
* finished dragging, it can be reassigned to its normal layer.
* </DL>
! * The <code>JLayeredPane</code> methods <code>moveToFront(Component)</code>,
! * <code>moveToBack(Component)</code> and <code>setPosition</code> can be used
! * to reposition a component within its layer. The <code>setLayer</code> method
* can also be used to change the component's current layer.
*
* <h2>Details</h2>
! * <code>JLayeredPane</code> manages its list of children like
! * <code>Container</code>, but allows for the definition of a several
* layers within itself. Children in the same layer are managed exactly
! * like the normal <code>Container</code> object,
* with the added feature that when children components overlap, children
* in higher layers display above the children in lower layers.
* <p>
* Each layer is a distinct integer number. The layer attribute can be set
! * on a <code>Component</code> by passing an <code>Integer</code>
* object during the add call.<br> For example:
* <PRE>
* layeredPane.add(child, JLayeredPane.DEFAULT_LAYER);
* or
* layeredPane.add(child, new Integer(10));
* </PRE>
* The layer attribute can also be set on a Component by calling<PRE>
* layeredPaneParent.setLayer(child, 10)</PRE>
! * on the <code>JLayeredPane</code> that is the parent of component. The layer
* should be set <i>before</i> adding the child to the parent.
* <p>
* Higher number layers display above lower number layers. So, using
* numbers for the layers and letters for individual components, a
* representative list order would look like this:<PRE>
* 5a, 5b, 5c, 2a, 2b, 2c, 1a </PRE>
* where the leftmost components are closest to the top of the display.
* <p>
* A component can be moved to the top or bottom position within its
! * layer by calling <code>moveToFront</code> or <code>moveToBack</code>.
* <p>
* The position of a component within a layer can also be specified directly.
* Valid positions range from 0 up to one less than the number of
* components in that layer. A value of -1 indicates the bottommost
* position. A value of 0 indicates the topmost position. Unlike layer
* numbers, higher position values are <i>lower</i> in the display.
* <blockquote>
* <b>Note:</b> This sequence (defined by java.awt.Container) is the reverse
! * of the layer numbering sequence. Usually though, you will use <code>moveToFront</code>,
! * <code>moveToBack</code>, and <code>setLayer</code>.
* </blockquote>
* Here are some examples using the method add(Component, layer, position):
* Calling add(5x, 5, -1) results in:<PRE>
* 5a, 5b, 5c, 5x, 2a, 2b, 2c, 1a </PRE>
*
--- 74,127 ----
* <DT>DRAG_LAYER</DT>
* <DD>When dragging a component, reassigning it to the drag layer ensures
* that it is positioned over every other component in the container. When
* finished dragging, it can be reassigned to its normal layer.
* </DL>
! * The {@code JLayeredPane} methods {@code moveToFront(Component)},
! * {@code moveToBack(Component)} and {@code setPosition} can be used
! * to reposition a component within its layer. The {@code setLayer} method
* can also be used to change the component's current layer.
*
* <h2>Details</h2>
! * {@code JLayeredPane} manages its list of children like
! * {@code Container}, but allows for the definition of a several
* layers within itself. Children in the same layer are managed exactly
! * like the normal {@code Container} object,
* with the added feature that when children components overlap, children
* in higher layers display above the children in lower layers.
* <p>
* Each layer is a distinct integer number. The layer attribute can be set
! * on a {@code Component} by passing an {@code Integer}
* object during the add call.<br> For example:
* <PRE>
* layeredPane.add(child, JLayeredPane.DEFAULT_LAYER);
* or
* layeredPane.add(child, new Integer(10));
* </PRE>
* The layer attribute can also be set on a Component by calling<PRE>
* layeredPaneParent.setLayer(child, 10)</PRE>
! * on the {@code JLayeredPane} that is the parent of component. The layer
* should be set <i>before</i> adding the child to the parent.
* <p>
* Higher number layers display above lower number layers. So, using
* numbers for the layers and letters for individual components, a
* representative list order would look like this:<PRE>
* 5a, 5b, 5c, 2a, 2b, 2c, 1a </PRE>
* where the leftmost components are closest to the top of the display.
* <p>
* A component can be moved to the top or bottom position within its
! * layer by calling {@code moveToFront} or {@code moveToBack}.
* <p>
* The position of a component within a layer can also be specified directly.
* Valid positions range from 0 up to one less than the number of
* components in that layer. A value of -1 indicates the bottommost
* position. A value of 0 indicates the topmost position. Unlike layer
* numbers, higher position values are <i>lower</i> in the display.
* <blockquote>
* <b>Note:</b> This sequence (defined by java.awt.Container) is the reverse
! * of the layer numbering sequence. Usually though, you will use {@code moveToFront},
! * {@code moveToBack}, and {@code setLayer}.
* </blockquote>
* Here are some examples using the method add(Component, layer, position):
* Calling add(5x, 5, -1) results in:<PRE>
* 5a, 5b, 5c, 5x, 2a, 2b, 2c, 1a </PRE>
*
*** 147,157 ****
* 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}.
*
* @author David Kloba
* @since 1.2
*/
--- 147,157 ----
* 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}.
*
* @author David Kloba
* @since 1.2
*/
*** 438,448 ****
public void moveToBack(Component c) {
setPosition(c, -1);
}
/**
! * Moves the component to <code>position</code> within its current layer,
* where 0 is the topmost position within the layer and -1 is the bottommost
* position.
* <p>
* <b>Note:</b> Position numbering is defined by java.awt.Container, and
* is the opposite of layer numbering. Lower position numbers are closer
--- 438,448 ----
public void moveToBack(Component c) {
setPosition(c, -1);
}
/**
! * Moves the component to {@code position} within its current layer,
* where 0 is the topmost position within the layer and -1 is the bottommost
* position.
* <p>
* <b>Note:</b> Position numbering is defined by java.awt.Container, and
* is the opposite of layer numbering. Lower position numbers are closer
*** 711,721 ****
/**
* Returns a string representation of this JLayeredPane. 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 JLayeredPane.
*/
protected String paramString() {
String optimizedDrawingPossibleString = (optimizedDrawingPossible ?
--- 711,721 ----
/**
* Returns a string representation of this JLayeredPane. 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 JLayeredPane.
*/
protected String paramString() {
String optimizedDrawingPossibleString = (optimizedDrawingPossible ?
*** 745,765 ****
return accessibleContext;
}
/**
* This class implements accessibility support for the
! * <code>JLayeredPane</code> class. It provides an implementation of the
* Java Accessibility API appropriate to layered 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")
protected class AccessibleJLayeredPane extends AccessibleJComponent {
--- 745,765 ----
return accessibleContext;
}
/**
* This class implements accessibility support for the
! * {@code JLayeredPane} class. It provides an implementation of the
* Java Accessibility API appropriate to layered 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")
protected class AccessibleJLayeredPane extends AccessibleJComponent {
< prev index next >