src/java.desktop/share/classes/javax/swing/JLayeredPane.java

Print this page




 142  * information see <a
 143  * href="package-summary.html#threading">Swing's Threading
 144  * Policy</a>.
 145  * <p>
 146  * <strong>Warning:</strong>
 147  * Serialized objects of this class will not be compatible with
 148  * future Swing releases. The current serialization support is
 149  * appropriate for short term storage or RMI between applications running
 150  * the same version of Swing.  As of 1.4, support for long term storage
 151  * of all JavaBeans&trade;
 152  * has been added to the <code>java.beans</code> package.
 153  * Please see {@link java.beans.XMLEncoder}.
 154  *
 155  * @author David Kloba
 156  * @since 1.2
 157  */
 158 @SuppressWarnings("serial")
 159 public class JLayeredPane extends JComponent implements Accessible {
 160     /// Watch the values in getObjectForLayer()
 161     /** Convenience object defining the Default layer. Equivalent to new Integer(0).*/
 162     public final static Integer DEFAULT_LAYER = 0;
 163     /** Convenience object defining the Palette layer. Equivalent to new Integer(100).*/
 164     public final static Integer PALETTE_LAYER = 100;
 165     /** Convenience object defining the Modal layer. Equivalent to new Integer(200).*/
 166     public final static Integer MODAL_LAYER = 200;
 167     /** Convenience object defining the Popup layer. Equivalent to new Integer(300).*/
 168     public final static Integer POPUP_LAYER = 300;
 169     /** Convenience object defining the Drag layer. Equivalent to new Integer(400).*/
 170     public final static Integer DRAG_LAYER = 400;
 171     /** Convenience object defining the Frame Content layer.
 172       * This layer is normally only use to position the contentPane and menuBar
 173       * components of JFrame.
 174       * Equivalent to new Integer(-30000).
 175       * @see JFrame
 176       */
 177     public final static Integer FRAME_CONTENT_LAYER = new Integer(-30000);
 178 
 179     /** Bound property */
 180     public final static String LAYER_PROPERTY = "layeredContainerLayer";
 181     // Hashtable to store layer values for non-JComponent components
 182     private Hashtable<Component,Integer> componentToLayer;
 183     private boolean optimizedDrawingPossible = true;
 184 
 185 
 186 //////////////////////////////////////////////////////////////////////////////
 187 //// Container Override methods
 188 //////////////////////////////////////////////////////////////////////////////
 189     /** Create a new JLayeredPane */
 190     public JLayeredPane() {
 191         setLayout(null);
 192     }
 193 
 194     private void validateOptimizedDrawing() {
 195         boolean layeredComponentFound = false;
 196         synchronized(getTreeLock()) {
 197             Integer layer;
 198 
 199             for (Component c : getComponents()) {
 200                 layer = null;




 142  * information see <a
 143  * href="package-summary.html#threading">Swing's Threading
 144  * Policy</a>.
 145  * <p>
 146  * <strong>Warning:</strong>
 147  * Serialized objects of this class will not be compatible with
 148  * future Swing releases. The current serialization support is
 149  * appropriate for short term storage or RMI between applications running
 150  * the same version of Swing.  As of 1.4, support for long term storage
 151  * of all JavaBeans&trade;
 152  * has been added to the <code>java.beans</code> package.
 153  * Please see {@link java.beans.XMLEncoder}.
 154  *
 155  * @author David Kloba
 156  * @since 1.2
 157  */
 158 @SuppressWarnings("serial")
 159 public class JLayeredPane extends JComponent implements Accessible {
 160     /// Watch the values in getObjectForLayer()
 161     /** Convenience object defining the Default layer. Equivalent to new Integer(0).*/
 162     public static final Integer DEFAULT_LAYER = 0;
 163     /** Convenience object defining the Palette layer. Equivalent to new Integer(100).*/
 164     public static final Integer PALETTE_LAYER = 100;
 165     /** Convenience object defining the Modal layer. Equivalent to new Integer(200).*/
 166     public static final Integer MODAL_LAYER = 200;
 167     /** Convenience object defining the Popup layer. Equivalent to new Integer(300).*/
 168     public static final Integer POPUP_LAYER = 300;
 169     /** Convenience object defining the Drag layer. Equivalent to new Integer(400).*/
 170     public static final Integer DRAG_LAYER = 400;
 171     /** Convenience object defining the Frame Content layer.
 172       * This layer is normally only use to position the contentPane and menuBar
 173       * components of JFrame.
 174       * Equivalent to new Integer(-30000).
 175       * @see JFrame
 176       */
 177     public static final Integer FRAME_CONTENT_LAYER = new Integer(-30000);
 178 
 179     /** Bound property */
 180     public static final String LAYER_PROPERTY = "layeredContainerLayer";
 181     // Hashtable to store layer values for non-JComponent components
 182     private Hashtable<Component,Integer> componentToLayer;
 183     private boolean optimizedDrawingPossible = true;
 184 
 185 
 186 //////////////////////////////////////////////////////////////////////////////
 187 //// Container Override methods
 188 //////////////////////////////////////////////////////////////////////////////
 189     /** Create a new JLayeredPane */
 190     public JLayeredPane() {
 191         setLayout(null);
 192     }
 193 
 194     private void validateOptimizedDrawing() {
 195         boolean layeredComponentFound = false;
 196         synchronized(getTreeLock()) {
 197             Integer layer;
 198 
 199             for (Component c : getComponents()) {
 200                 layer = null;