gridlayout.html

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

HTML
676
字号
                   any number of columns.</DL></DD></DL><HR><A NAME="GridLayout(int, int, int, int)"><!-- --></A><H3>GridLayout</H3><PRE>public <B>GridLayout</B>(int&nbsp;rows,                  int&nbsp;cols,                  int&nbsp;hgap,                  int&nbsp;vgap)</PRE><DL><DD>Creates a grid layout with the specified number of rows and  columns. All components in the layout are given equal size.  <p> In addition, the horizontal and vertical gaps are set to the  specified values. Horizontal gaps are placed at the left and  right edges, and between each of the columns. Vertical gaps are  placed at the top and bottom edges, and between each of the rows.  <p> One, but not both, of <code>rows</code> and <code>cols</code> can  be zero, which means that any number of objects can be placed in a  row or in a column.<DD><DL><DT><B>Parameters:</B><DD><CODE>rows</CODE> - the rows, with the value zero meaning                    any number of rows.<DD><CODE>cols</CODE> - the columns, with the value zero meaning                    any number of columns.<DD><CODE>hgap</CODE> - the horizontal gap.<DD><CODE>vgap</CODE> - the vertical gap.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the of <code>rows</code>                    or <code>cols</code> is invalid.</DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="getRows()"><!-- --></A><H3>getRows</H3><PRE>public int <B>getRows</B>()</PRE><DL><DD>Gets the number of rows in this layout.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of rows in this layout.<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="setRows(int)"><!-- --></A><H3>setRows</H3><PRE>public void <B>setRows</B>(int&nbsp;rows)</PRE><DL><DD>Sets the number of rows in this layout to the specified value.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>rows</CODE> - the number of rows in this layout.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the value of both                <code>rows</code> and <code>cols</code> is set to zero.<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="getColumns()"><!-- --></A><H3>getColumns</H3><PRE>public int <B>getColumns</B>()</PRE><DL><DD>Gets the number of columns in this layout.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the number of columns in this layout.<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="setColumns(int)"><!-- --></A><H3>setColumns</H3><PRE>public void <B>setColumns</B>(int&nbsp;cols)</PRE><DL><DD>Sets the number of columns in this layout to the specified value.  Setting the number of columns has no affect on the layout  if the number of rows specified by a constructor or by  the <tt>setRows</tt> method is non-zero. In that case, the number  of columns displayed in the layout is determined by the total  number of components and the number of rows specified.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>cols</CODE> - the number of columns in this layout.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/lang/IllegalArgumentException.html">IllegalArgumentException</A></CODE> - if the value of both                <code>rows</code> and <code>cols</code> is set to zero.<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="getHgap()"><!-- --></A><H3>getHgap</H3><PRE>public int <B>getHgap</B>()</PRE><DL><DD>Gets the horizontal gap between components.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the horizontal gap between components.<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="setHgap(int)"><!-- --></A><H3>setHgap</H3><PRE>public void <B>setHgap</B>(int&nbsp;hgap)</PRE><DL><DD>Sets the horizontal gap between components to the specified value.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>hgap</CODE> - the horizontal gap between components.<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="getVgap()"><!-- --></A><H3>getVgap</H3><PRE>public int <B>getVgap</B>()</PRE><DL><DD>Gets the vertical gap between components.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the vertical gap between components.<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="setVgap(int)"><!-- --></A><H3>setVgap</H3><PRE>public void <B>setVgap</B>(int&nbsp;vgap)</PRE><DL><DD>Sets the vertical gap between components to the specified value.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>vgap</CODE> - the vertical gap between components.<DT><B>Since: </B><DD>JDK1.1</DD></DL></DD></DL><HR><A NAME="addLayoutComponent(java.lang.String, java.awt.Component)"><!-- --></A><H3>addLayoutComponent</H3><PRE>public void <B>addLayoutComponent</B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;name,                               <A HREF="../../java/awt/Component.html">Component</A>&nbsp;comp)</PRE><DL><DD>Adds the specified component with the specified name to the layout.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/awt/LayoutManager.html#addLayoutComponent(java.lang.String, java.awt.Component)">addLayoutComponent</A></CODE> in interface <CODE><A HREF="../../java/awt/LayoutManager.html">LayoutManager</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the name of the component.<DD><CODE>comp</CODE> - the component to be added.</DL></DD></DL><HR><A NAME="removeLayoutComponent(java.awt.Component)"><!-- --></A><H3>removeLayoutComponent</H3><PRE>public void <B>removeLayoutComponent</B>(<A HREF="../../java/awt/Component.html">Component</A>&nbsp;comp)</PRE><DL><DD>Removes the specified component from the layout.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/awt/LayoutManager.html#removeLayoutComponent(java.awt.Component)">removeLayoutComponent</A></CODE> in interface <CODE><A HREF="../../java/awt/LayoutManager.html">LayoutManager</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>comp</CODE> - the component to be removed.</DL></DD></DL><HR><A NAME="preferredLayoutSize(java.awt.Container)"><!-- --></A><H3>preferredLayoutSize</H3><PRE>public <A HREF="../../java/awt/Dimension.html">Dimension</A> <B>preferredLayoutSize</B>(<A HREF="../../java/awt/Container.html">Container</A>&nbsp;parent)</PRE><DL><DD>Determines the preferred size of the container argument using  this grid layout.  <p> The preferred width of a grid layout is the largest preferred  width of any of the widths in the container times the number of  columns, plus the horizontal padding times the number of columns  plus one, plus the left and right insets of the target container.  <p> The preferred height of a grid layout is the largest preferred  height of any of the heights in the container times the number of  rows, plus the vertical padding times the number of rows plus one,  plus the top and bottom insets of the target container.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/awt/LayoutManager.html#preferredLayoutSize(java.awt.Container)">preferredLayoutSize</A></CODE> in interface <CODE><A HREF="../../java/awt/LayoutManager.html">LayoutManager</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>target</CODE> - the container in which to do the layout.<DT><B>Returns:</B><DD>the preferred dimensions to lay out the                       subcomponents of the specified container.<DT><B>See Also: </B><DD><A HREF="../../java/awt/GridLayout.html#minimumLayoutSize(java.awt.Container)"><CODE>minimumLayoutSize(java.awt.Container)</CODE></A>, <A HREF="../../java/awt/Container.html#getPreferredSize()"><CODE>Container.getPreferredSize()</CODE></A></DL></DD></DL><HR><A NAME="minimumLayoutSize(java.awt.Container)"><!-- --></A><H3>minimumLayoutSize</H3><PRE>public <A HREF="../../java/awt/Dimension.html">Dimension</A> <B>minimumLayoutSize</B>(<A HREF="../../java/awt/Container.html">Container</A>&nbsp;parent)</PRE><DL><DD>Determines the minimum size of the container argument using this  grid layout.  <p> The minimum width of a grid layout is the largest minimum width  of any of the widths in the container times the number of columns,  plus the horizontal padding times the number of columns plus one,  plus the left and right insets of the target container.  <p> The minimum height of a grid layout is the largest minimum height  of any of the heights in the container times the number of rows,  plus the vertical padding times the number of rows plus one, plus  the top and bottom insets of the target container.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/awt/LayoutManager.html#minimumLayoutSize(java.awt.Container)">minimumLayoutSize</A></CODE> in interface <CODE><A HREF="../../java/awt/LayoutManager.html">LayoutManager</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>target</CODE> - the container in which to do the layout.<DT><B>Returns:</B><DD>the minimum dimensions needed to lay out the                       subcomponents of the specified container.<DT><B>See Also: </B><DD><A HREF="../../java/awt/GridLayout.html#preferredLayoutSize(java.awt.Container)"><CODE>preferredLayoutSize(java.awt.Container)</CODE></A>, <A HREF="../../java/awt/Container.html#doLayout()"><CODE>Container.doLayout()</CODE></A></DL></DD></DL><HR><A NAME="layoutContainer(java.awt.Container)"><!-- --></A><H3>layoutContainer</H3><PRE>public void <B>layoutContainer</B>(<A HREF="../../java/awt/Container.html">Container</A>&nbsp;parent)</PRE><DL><DD>Lays out the specified container using this layout.  <p> This method reshapes the components in the specified target  container in order to satisfy the constraints of the  <code>GridLayout</code> object.  <p> The grid layout manager determines the size of individual  components by dividing the free space in the container into  equal-sized portions according to the number of rows and columns  in the layout. The container's free space equals the container's  size minus any insets and any specified horizontal or vertical  gap. All components in a grid layout are given the same size.<DD><DL><DT><B>Specified by: </B><DD><CODE><A HREF="../../java/awt/LayoutManager.html#layoutContainer(java.awt.Container)">layoutContainer</A></CODE> in interface <CODE><A HREF="../../java/awt/LayoutManager.html">LayoutManager</A></CODE></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>target</CODE> - the container in which to do the layout.<DT><B>See Also: </B><DD><A HREF="../../java/awt/Container.html"><CODE>Container</CODE></A>, <A HREF="../../java/awt/Container.html#doLayout()"><CODE>Container.doLayout()</CODE></A></DL></DD></DL><HR><A NAME="toString()"><!-- --></A><H3>toString</H3><PRE>public <A HREF="../../java/lang/String.html">String</A> <B>toString</B>()</PRE><DL><DD>Returns the string representation of this grid layout's values.<DD><DL><DT><B>Overrides:</B><DD><CODE><A HREF="../../java/lang/Object.html#toString()">toString</A></CODE> in class <CODE><A HREF="../../java/lang/Object.html">Object</A></CODE></DL></DD><DD><DL><DT><B>Returns:</B><DD>a string representation of this grid layout.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_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/GridLayout.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="../../java/awt/GridBagLayout.html"><B>PREV CLASS</B></A>&nbsp;&nbsp;<A HREF="../../java/awt/Image.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="GridLayout.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;FIELD&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;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation  contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A.  All Rights Reserved.</font></BODY></HTML>

⌨️ 快捷键说明

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