1 /*
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
30 import java.awt.Color;
31 import java.awt.Graphics;
32 import java.awt.Rectangle;
33 import java.beans.JavaBean;
34 import java.beans.BeanProperty;
35
36 import sun.awt.SunToolkit;
37
38 import javax.accessibility.*;
39
40 /**
41 * <code>JLayeredPane</code> adds depth to a JFC/Swing container,
42 * allowing components to overlap each other when needed.
43 * An <code>Integer</code> object specifies each component's depth in the
44 * container, where higher-numbered components sit "on top" of other
45 * components.
46 * For task-oriented documentation and examples of using layered panes see
47 * <a href="https://docs.oracle.com/javase/tutorial/uiswing/components/layeredpane.html">How to Use a Layered Pane</a>,
48 * a section in <em>The Java Tutorial</em>.
49 *
50 * <table class="borderless" style="float:right">
51 * <caption>Example</caption>
52 * <TR>
53 * <TD style="text-align:center">
54 * <P STYLE="TEXT-ALIGN:CENTER"><IMG SRC="doc-files/JLayeredPane-1.gif"
55 * alt="The following text describes this image."
56 * WIDTH="269" HEIGHT="264" STYLE="FLOAT:BOTTOM; BORDER=0">
57 * </TD>
58 * </TR>
59 * </TABLE>
60 * For convenience, <code>JLayeredPane</code> divides the depth-range
61 * into several different layers. Putting a component into one of those
62 * layers makes it easy to ensure that components overlap properly,
63 * without having to worry about specifying numbers for specific depths:
64 * <DL>
65 * <DT>DEFAULT_LAYER</DT>
66 * <DD>The standard layer, where most components go. This the bottommost
67 * layer.
68 * <DT>PALETTE_LAYER</DT>
69 * <DD>The palette layer sits over the default layer. Useful for floating
70 * toolbars and palettes, so they can be positioned above other components.
71 * <DT>MODAL_LAYER</DT>
72 * <DD>The layer used for modal dialogs. They will appear on top of any
73 * toolbars, palettes, or standard components in the container.
74 * <DT>POPUP_LAYER</DT>
75 * <DD>The popup layer displays above dialogs. That way, the popup windows
76 * associated with combo boxes, tooltips, and other help text will appear
77 * above the component, palette, or dialog that generated them.
78 * <DT>DRAG_LAYER</DT>
79 * <DD>When dragging a component, reassigning it to the drag layer ensures
|
1 /*
2 * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
30 import java.awt.Color;
31 import java.awt.Graphics;
32 import java.awt.Rectangle;
33 import java.beans.JavaBean;
34 import java.beans.BeanProperty;
35
36 import sun.awt.SunToolkit;
37
38 import javax.accessibility.*;
39
40 /**
41 * <code>JLayeredPane</code> adds depth to a JFC/Swing container,
42 * allowing components to overlap each other when needed.
43 * An <code>Integer</code> object specifies each component's depth in the
44 * container, where higher-numbered components sit "on top" of other
45 * components.
46 * For task-oriented documentation and examples of using layered panes see
47 * <a href="https://docs.oracle.com/javase/tutorial/uiswing/components/layeredpane.html">How to Use a Layered Pane</a>,
48 * a section in <em>The Java Tutorial</em>.
49 *
50 * <div style="float:right;text-align:center">
51 * <p><b>Example:</b>
52 * <p><img src="doc-files/JLayeredPane-1.gif"
53 * alt="The following text describes this image."
54 * width="269" height="264">
55 * </div>
56 * For convenience, <code>JLayeredPane</code> divides the depth-range
57 * into several different layers. Putting a component into one of those
58 * layers makes it easy to ensure that components overlap properly,
59 * without having to worry about specifying numbers for specific depths:
60 * <DL>
61 * <DT>DEFAULT_LAYER</DT>
62 * <DD>The standard layer, where most components go. This the bottommost
63 * layer.
64 * <DT>PALETTE_LAYER</DT>
65 * <DD>The palette layer sits over the default layer. Useful for floating
66 * toolbars and palettes, so they can be positioned above other components.
67 * <DT>MODAL_LAYER</DT>
68 * <DD>The layer used for modal dialogs. They will appear on top of any
69 * toolbars, palettes, or standard components in the container.
70 * <DT>POPUP_LAYER</DT>
71 * <DD>The popup layer displays above dialogs. That way, the popup windows
72 * associated with combo boxes, tooltips, and other help text will appear
73 * above the component, palette, or dialog that generated them.
74 * <DT>DRAG_LAYER</DT>
75 * <DD>When dragging a component, reassigning it to the drag layer ensures
|