⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 boxlayout.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!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:14 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class  BoxLayout</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/BoxLayout.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/Box.Filler.AccessibleBoxFiller.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../javax/swing/ButtonGroup.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="BoxLayout.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">  SUMMARY: &nbsp;INNER&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  BoxLayout</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A>  |  +--<B>javax.swing.BoxLayout</B></PRE><DL><DT><B>All Implemented Interfaces:</B> <DD><A HREF="../../java/awt/LayoutManager.html">LayoutManager</A>, <A HREF="../../java/awt/LayoutManager2.html">LayoutManager2</A>, <A HREF="../../java/io/Serializable.html">Serializable</A></DD></DL><DL><DT><B>Direct Known Subclasses:</B> <DD><A HREF="../../javax/swing/plaf/basic/DefaultMenuLayout.html">DefaultMenuLayout</A></DD></DL><HR><DL><DT>public class <B>BoxLayout</B><DT>extends <A HREF="../../java/lang/Object.html">Object</A><DT>implements <A HREF="../../java/awt/LayoutManager2.html">LayoutManager2</A>, <A HREF="../../java/io/Serializable.html">Serializable</A></DL><P>A layout manager that allows multiple components to be layed out either vertically or horizontally. The components will not wrap so, for  example, a vertical arrangement of components will stay vertically  arranged when the frame is resized.  <TABLE ALIGN="RIGHT" BORDER="0">    <TR>      <TD ALIGN="CENTER">         <P ALIGN="CENTER"><IMG SRC="doc-files/BoxLayout-1.gif" WIDTH="191" HEIGHT="201" ALIGN="BOTTOM" BORDER="0">      </TD>    </TR> </TABLE> <p> Nesting multiple panels with different combinations of horizontal and  vertical gives an effect similar to GridBagLayout, without the  complexity. The diagram shows two panels arranged horizontally, each  of which contains 3 components arranged vertically. <p> The Box container uses BoxLayout (unlike JPanel, which defaults to flow layout). You can nest multiple boxes and add components to them to get the arrangement you want. <p> The BoxLayout manager that places each of its managed components from left to right or from top to bottom. When you create a BoxLayout, you specify whether its major axis is  the X axis (which means left to right placement) or Y axis (top to  bottom placement). Components are arranged from left to right (or  top to bottom), in the same order as they were added to the container. <p> Instead of using BoxLayout directly, many programs use the Box class. The Box class provides a lightweight container that uses a BoxLayout. Box also provides handy methods to help you use BoxLayout well. <p> BoxLayout attempts to arrange components at their preferred widths (for left to right layout) or heights (for top to bottom layout). For a left to right layout, if not all the components are the same height, BoxLayout attempts to make all the components  as high as the highest component. If that's not possible for a particular component,  then BoxLayout aligns that component vertically, according to the component's Y alignment. By default, a component has an Y alignment of 0.5, which means that the vertical center of the component should have the same Y coordinate as  the vertical centers of other components with 0.5 Y alignment. <p> Similarly, for a vertical layout, BoxLayout attempts to make all components in the column as wide as the widest component; if that fails, it aligns them horizontally according to their X alignments. <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.  A future release of Swing will provide support for long term persistence.<P><DL><DT><B>See Also: </B><DD><A HREF="../../javax/swing/Box.html"><CODE>Box</CODE></A>, <A HREF="../../java/awt/Component.html#getAlignmentX()"><CODE>Component.getAlignmentX()</CODE></A>, <A HREF="../../java/awt/Component.html#getAlignmentY()"><CODE>Component.getAlignmentY()</CODE></A>, <A HREF="../../serialized-form.html#javax.swing.BoxLayout">Serialized Form</A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/BoxLayout.html#X_AXIS">X_AXIS</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Specifies that components should be laid out left to right.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;int</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/BoxLayout.html#Y_AXIS">Y_AXIS</A></B></CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Specifies that components should be laid out top to bottom.</TD></TR></TABLE>&nbsp;<!-- ======== CONSTRUCTOR SUMMARY ======== --><A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><B><A HREF="../../javax/swing/BoxLayout.html#BoxLayout(java.awt.Container, int)">BoxLayout</A></B>(<A HREF="../../java/awt/Container.html">Container</A>&nbsp;target,          int&nbsp;axis)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates a layout manager that will lay out components either  left to right or top to bottom, as specified in the <code>axis</code> parameter.</TD></TR></TABLE>&nbsp;<!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/BoxLayout.html#addLayoutComponent(java.awt.Component, java.lang.Object)">addLayoutComponent</A></B>(<A HREF="../../java/awt/Component.html">Component</A>&nbsp;comp,                   <A HREF="../../java/lang/Object.html">Object</A>&nbsp;constraints)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Not used by this class.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/BoxLayout.html#addLayoutComponent(java.lang.String, java.awt.Component)">addLayoutComponent</A></B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;name,                   <A HREF="../../java/awt/Component.html">Component</A>&nbsp;comp)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Not used by this class.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;float</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/BoxLayout.html#getLayoutAlignmentX(java.awt.Container)">getLayoutAlignmentX</A></B>(<A HREF="../../java/awt/Container.html">Container</A>&nbsp;target)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the alignment along the X axis for the container.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;float</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/BoxLayout.html#getLayoutAlignmentY(java.awt.Container)">getLayoutAlignmentY</A></B>(<A HREF="../../java/awt/Container.html">Container</A>&nbsp;target)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the alignment along the Y axis for the container.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/BoxLayout.html#invalidateLayout(java.awt.Container)">invalidateLayout</A></B>(<A HREF="../../java/awt/Container.html">Container</A>&nbsp;target)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Indicates that a child has changed its layout related information, and thus any cached calculations should be flushed.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/BoxLayout.html#layoutContainer(java.awt.Container)">layoutContainer</A></B>(<A HREF="../../java/awt/Container.html">Container</A>&nbsp;target)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Called by the AWT <!-- XXX CHECK! --> when the specified container needs to be laid out.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/awt/Dimension.html">Dimension</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/BoxLayout.html#maximumLayoutSize(java.awt.Container)">maximumLayoutSize</A></B>(<A HREF="../../java/awt/Container.html">Container</A>&nbsp;target)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the maximum dimensions the target container can use to lay out the components it contains.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/awt/Dimension.html">Dimension</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/BoxLayout.html#minimumLayoutSize(java.awt.Container)">minimumLayoutSize</A></B>(<A HREF="../../java/awt/Container.html">Container</A>&nbsp;target)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the minimum dimensions needed to lay out the components contained in the specified target container.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/awt/Dimension.html">Dimension</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/BoxLayout.html#preferredLayoutSize(java.awt.Container)">preferredLayoutSize</A></B>(<A HREF="../../java/awt/Container.html">Container</A>&nbsp;target)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the preferred dimensions for this layout, given the components in the specified target container.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;void</CODE></FONT></TD><TD><CODE><B><A HREF="../../javax/swing/BoxLayout.html#removeLayoutComponent(java.awt.Component)">removeLayoutComponent</A></B>(<A HREF="../../java/awt/Component.html">Component</A>&nbsp;comp)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Not used by this class.</TD></TR>

⌨️ 快捷键说明

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