tablecolumn.html
来自「API資料大全」· HTML 代码 · 共 1,325 行 · 第 1/4 页
HTML
1,325 行
setWidth</H3><PRE>public void <B>setWidth</B>(int width)</PRE><DL><DD>This method should not be used to set the widths of columns in the <code>JTable</code>, use <code>setPreferredWidth</code> instead. Like a layout manager in the AWT, the <code>JTable</code> adjusts a column's width automatically whenever the table itself changes size, or a column's preferred width is changed. Setting widths programmatically therefore has no long term effect. <p> This method sets this column's width to <code>width</code>. If <code>width</code> exceeds the minimum or maximum width, it is adjusted to the appropriate limiting value. <p><DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>width</CODE> - the new width<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/table/TableColumn.html#getWidth()"><CODE>getWidth()</CODE></A>, <A HREF="../../../javax/swing/table/TableColumn.html#setMinWidth(int)"><CODE>setMinWidth(int)</CODE></A>, <A HREF="../../../javax/swing/table/TableColumn.html#setMaxWidth(int)"><CODE>setMaxWidth(int)</CODE></A>, <A HREF="../../../javax/swing/table/TableColumn.html#setPreferredWidth(int)"><CODE>setPreferredWidth(int)</CODE></A>, <A HREF="../../../javax/swing/JTable.html#sizeColumnsToFit(int)"><CODE>JTable.sizeColumnsToFit(int)</CODE></A></DL></DD></DL><HR><A NAME="getWidth()"><!-- --></A><H3>getWidth</H3><PRE>public int <B>getWidth</B>()</PRE><DL><DD>Returns the width of the <code>TableColumn</code>. The default width is 75.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the <code>width</code> property<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/table/TableColumn.html#setWidth(int)"><CODE>setWidth(int)</CODE></A></DL></DD></DL><HR><A NAME="setPreferredWidth(int)"><!-- --></A><H3>setPreferredWidth</H3><PRE>public void <B>setPreferredWidth</B>(int preferredWidth)</PRE><DL><DD>Sets this column's preferred width to <code>preferredWidth</code>. If <code>preferredWidth</code> exceeds the minimum or maximum width, it is adjusted to the appropriate limiting value. <p> For details on how the widths of columns in the <code>JTable</code> (and <code>JTableHeader</code>) are calculated from the <code>preferredWidth</code>, see the <code>sizeColumnsToFit</code> method in <code>JTable</code>.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>preferredWidth</CODE> - the new preferred width<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/table/TableColumn.html#getPreferredWidth()"><CODE>getPreferredWidth()</CODE></A>, <A HREF="../../../javax/swing/JTable.html#sizeColumnsToFit(int)"><CODE>JTable.sizeColumnsToFit(int)</CODE></A></DL></DD></DL><HR><A NAME="getPreferredWidth()"><!-- --></A><H3>getPreferredWidth</H3><PRE>public int <B>getPreferredWidth</B>()</PRE><DL><DD>Returns the preferred width of the <code>TableColumn</code>. The default preferred width is 75.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the <code>preferredWidth</code> property<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/table/TableColumn.html#setPreferredWidth(int)"><CODE>setPreferredWidth(int)</CODE></A></DL></DD></DL><HR><A NAME="setMinWidth(int)"><!-- --></A><H3>setMinWidth</H3><PRE>public void <B>setMinWidth</B>(int minWidth)</PRE><DL><DD>Sets the <code>TableColumn</code>'s minimum width to <code>minWidth</code>; also adjusts the current width and preferred width if they are less than this value.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>minWidth</CODE> - the new minimum width<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/table/TableColumn.html#getMinWidth()"><CODE>getMinWidth()</CODE></A>, <A HREF="../../../javax/swing/table/TableColumn.html#setPreferredWidth(int)"><CODE>setPreferredWidth(int)</CODE></A>, <A HREF="../../../javax/swing/table/TableColumn.html#setMaxWidth(int)"><CODE>setMaxWidth(int)</CODE></A></DL></DD></DL><HR><A NAME="getMinWidth()"><!-- --></A><H3>getMinWidth</H3><PRE>public int <B>getMinWidth</B>()</PRE><DL><DD>Returns the minimum width for the <code>TableColumn</code>. The <code>TableColumn</code>'s width can't be made less than this either by the user or programmatically. The default minWidth is 15.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the <code>minWidth</code> property<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/table/TableColumn.html#setMinWidth(int)"><CODE>setMinWidth(int)</CODE></A></DL></DD></DL><HR><A NAME="setMaxWidth(int)"><!-- --></A><H3>setMaxWidth</H3><PRE>public void <B>setMaxWidth</B>(int maxWidth)</PRE><DL><DD>Sets the <code>TableColumn</code>'s maximum width to <code>maxWidth</code>; also adjusts the width and preferred width if they are greater than this value.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>maxWidth</CODE> - the new maximum width<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/table/TableColumn.html#getMaxWidth()"><CODE>getMaxWidth()</CODE></A>, <A HREF="../../../javax/swing/table/TableColumn.html#setPreferredWidth(int)"><CODE>setPreferredWidth(int)</CODE></A>, <A HREF="../../../javax/swing/table/TableColumn.html#setMinWidth(int)"><CODE>setMinWidth(int)</CODE></A></DL></DD></DL><HR><A NAME="getMaxWidth()"><!-- --></A><H3>getMaxWidth</H3><PRE>public int <B>getMaxWidth</B>()</PRE><DL><DD>Returns the maximum width for the <code>TableColumn</code>. The <code>TableColumn</code>'s width can't be made larger than this either by the user or programmatically. The default maxWidth is Integer.MAX_VALUE.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the <code>maxWidth</code> property<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/table/TableColumn.html#setMaxWidth(int)"><CODE>setMaxWidth(int)</CODE></A></DL></DD></DL><HR><A NAME="setResizable(boolean)"><!-- --></A><H3>setResizable</H3><PRE>public void <B>setResizable</B>(boolean isResizable)</PRE><DL><DD>Sets whether this column can be resized.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>isResizable</CODE> - if true, resizing is allowed; otherwise false<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/table/TableColumn.html#getResizable()"><CODE>getResizable()</CODE></A></DL></DD></DL><HR><A NAME="getResizable()"><!-- --></A><H3>getResizable</H3><PRE>public boolean <B>getResizable</B>()</PRE><DL><DD>Returns true if the user is allowed to resize the <code>TableColumn</code>'s width, false otherwise. You can change the width programmatically regardless of this setting. The default is true.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the <code>isResizable</code> property<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/table/TableColumn.html#setResizable(boolean)"><CODE>setResizable(boolean)</CODE></A></DL></DD></DL><HR><A NAME="sizeWidthToFit()"><!-- --></A><H3>sizeWidthToFit</H3><PRE>public void <B>sizeWidthToFit</B>()</PRE><DL><DD>Resizes the <code>TableColumn</code> to fit the width of its header cell. This method does nothing if the header renderer is <code>null</code> (the default case).<DD><DL></DL></DD><DD><DL><DT><B>See Also: </B><DD><A HREF="../../../javax/swing/table/TableColumn.html#setPreferredWidth(int)"><CODE>setPreferredWidth(int)</CODE></A></DL></DD></DL><HR><A NAME="disableResizedPosting()"><!-- --></A><H3>disableResizedPosting</H3><PRE>public void <B>disableResizedPosting</B>()</PRE><DL><DD><B>Deprecated.</B> <I>as of Java 2 platform v1.3</I><P><DD>This field was not used in previous releases and there are currently no plans to support it in the future.<DD><DL></DL></DD></DL><HR><A NAME="enableResizedPosting()"><!-- --></A><H3>enableResizedPosting</H3><PRE>public void <B>enableResizedPosting</B>()</PRE><DL><DD><B>Deprecated.</B> <I>as of Java 2 platform v1.3</I><P><DD>This field was not used in previous releases and there are currently no plans to support it in the future.<DD><DL></DL></DD></DL><HR><A NAME="addPropertyChangeListener(java.beans.PropertyChangeListener)"><!-- --></A><H3>addPropertyChangeListener</H3><PRE>public void <B>addPropertyChangeListener</B>(<A HREF="../../../java/beans/PropertyChangeListener.html">PropertyChangeListener</A> listener)</PRE><DL><DD>Adds a <code>PropertyChangeListener</code> to the listener list. The listener is registered for all properties. <p> A <code>PropertyChangeEvent</code> will get fired in response to an explicit call to <code>setFont</code>, <code>setBackground</code>, or <code>setForeground</code> on the current component. Note that if the current component is inheriting its foreground, background, or font from its container, then no event will be fired in response to a change in the inherited property.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>listener</CODE> - the listener to be added</DL></DD></DL><HR><A NAME="removePropertyChangeListener(java.beans.PropertyChangeListener)"><!-- --></A><H3>removePropertyChangeListener</H3><PRE>public void <B>removePropertyChangeListener</B>(<A HREF="../../../java/beans/PropertyChangeListener.html">PropertyChangeListener</A> listener)</PRE><DL><DD>Removes a <code>PropertyChangeListener</code> from the listener list. The <code>PropertyChangeListener</code> to be removed was registered for all properties.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>listener</CODE> - the listener to be removed</DL></DD></DL><HR><A NAME="createDefaultHeaderRenderer()"><!-- --></A><H3>createDefaultHeaderRenderer</H3><PRE>protected <A HREF="../../../javax/swing/table/TableCellRenderer.html">TableCellRenderer</A> <B>createDefaultHeaderRenderer</B>()</PRE><DL><DD>As of Java 2 platform v1.3, this method is not called by the <code>TableColumn</code> constructor. Previously this method was used by the <code>TableColumn</code> to create a default header renderer. As of Java 2 platform v1.3, the default header renderer is <code>null</code>. <code>JTableHeader</code> now provides its own shared default renderer, just as the <code>JTable</code> does for its cell renderers.<DD><DL></DL></DD><DD><DL><DT><B>Returns:</B><DD>the default header renderer<DT><B>See Also: </B><DD><A HREF="../../../javax/swing/table/JTableHeader.html#createDefaultRenderer()"><CODE>JTableHeader.createDefaultRenderer()</CODE></A></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> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/TableColumn.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../javax/swing/table/JTableHeader.AccessibleJTableHeader.AccessibleJTableHeaderEntry.html"><B>PREV CLASS</B></A> NEXT CLASS</FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="TableColumn.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <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 + -
显示快捷键?