jlayeredpane.html

来自「API資料大全」· HTML 代码 · 共 813 行 · 第 1/5 页

HTML
813
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:38:51 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class  JLayeredPane</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">  <TR ALIGN="center" VALIGN="top">  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="class-use/JLayeredPane.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>  </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup>&nbsp;2&nbsp;Platform<br>Std.&nbsp;Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">&nbsp;<A HREF="../../javax/swing/JLabel.AccessibleJLabel.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../javax/swing/JLayeredPane.AccessibleJLayeredPane.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">  <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>  &nbsp;&nbsp;<A HREF="JLayeredPane.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;<A HREF="#inner_class_summary">INNER</A>&nbsp;|&nbsp;<A HREF="#field_summary">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: &nbsp;<A HREF="#field_detail">FIELD</A>&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">javax.swing</FONT><BR>Class  JLayeredPane</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A>  |  +--<A HREF="../../java/awt/Component.html">java.awt.Component</A>        |        +--<A HREF="../../java/awt/Container.html">java.awt.Container</A>              |              +--<A HREF="../../javax/swing/JComponent.html">javax.swing.JComponent</A>                    |                    +--<B>javax.swing.JLayeredPane</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../javax/accessibility/Accessible.html">Accessible</A>, <A HREF="../../java/awt/image/ImageObserver.html">ImageObserver</A>, <A HREF="../../java/awt/MenuContainer.html">MenuContainer</A>, <A HREF="../../java/io/Serializable.html">Serializable</A></DD></DL><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../javax/swing/JDesktopPane.html">JDesktopPane</A></DD></DL><HR><DL><DT>public class <B>JLayeredPane</B><DT>extends <A HREF="../../javax/swing/JComponent.html">JComponent</A><DT>implements <A HREF="../../javax/accessibility/Accessible.html">Accessible</A></DL><P>JLayeredPane adds depth to a JFC/Swing container, allowing components to overlap  each other when needed. An Integer object specifies each component's depth in the container, where higher-numbered components sit &quot;on top&quot; of other  components. For task-oriented documentation and examples of using layered panes see <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/layeredpane.html">How to Use a Layered Pane</a>, a section in <em>The Java Tutorial</em>. <P> <TABLE ALIGN="RIGHT" BORDER="0"> <TR>   <TD ALIGN="CENTER">     <P ALIGN="CENTER"><IMG SRC="doc-files/JLayeredPane-1.gif" WIDTH="269" HEIGHT="264" ALIGN="BOTTOM" BORDER="0">   </TD> </TR> </TABLE> For convenience, 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><FONT SIZE="2">DEFAULT_LAYER</FONT></DT>         <DD>The standard layer, where most components go. This the bottommost          layer.    <DT><FONT SIZE="2">PALETTE_LAYER</FONT></DT>         <DD>The palette layer sits over the default layer. Useful for floating          toolbars and palettes, so they can be positioned above other components.    <DT><FONT SIZE="2">MODAL_LAYER</FONT></DT>         <DD>The layer used for modal dialogs. They will appear on top of any         toolbars, palettes, or standard components in the container.    <DT><FONT SIZE="2">POPUP_LAYER</FONT></DT>         <DD>The popup layer displays above dialogs. That way, the popup windows          associated with combo boxes, tooltips, and other help text will appear          above the component, palette, or dialog that generated them.    <DT><FONT SIZE="2">DRAG_LAYER</FONT></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 JLayeredPane 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> JLayeredPane manages it's list of children like Container, but allows for the definition of a several layers within itself. Children in the same layer are managed exactly like the normal 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 Component by passing an 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 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</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>.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?