< prev index next >
src/java.desktop/share/classes/javax/swing/table/TableColumn.java
Print this page
*** 33,75 ****
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.event.SwingPropertyChangeSupport;
/**
! * A <code>TableColumn</code> represents all the attributes of a column in a
! * <code>JTable</code>, such as width, resizability, minimum and maximum width.
! * In addition, the <code>TableColumn</code> provides slots for a renderer and
* an editor that can be used to display and edit the values in this column.
* <p>
* It is also possible to specify renderers and editors on a per type basis
* rather than a per column basis - see the
! * <code>setDefaultRenderer</code> method in the <code>JTable</code> class.
* This default mechanism is only used when the renderer (or
! * editor) in the <code>TableColumn</code> is <code>null</code>.
* <p>
! * The <code>TableColumn</code> stores the link between the columns in the
! * <code>JTable</code> and the columns in the <code>TableModel</code>.
! * The <code>modelIndex</code> is the column in the
! * <code>TableModel</code>, which will be queried for the data values for the
* cells in this column. As the column moves around in the view this
! * <code>modelIndex</code> does not change.
* <p>
* <b>Note:</b> Some implementations may assume that all
! * <code>TableColumnModel</code>s are unique, therefore we would
! * recommend that the same <code>TableColumn</code> instance
! * not be added more than once to a <code>TableColumnModel</code>.
! * To show <code>TableColumn</code>s with the same column of
* data from the model, create a new instance with the same
! * <code>modelIndex</code>.
* <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. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Alan Chung
* @author Philip Milne
* @see javax.swing.table.TableColumnModel
--- 33,75 ----
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.event.SwingPropertyChangeSupport;
/**
! * A {@code TableColumn} represents all the attributes of a column in a
! * {@code JTable}, such as width, resizability, minimum and maximum width.
! * In addition, the {@code TableColumn} provides slots for a renderer and
* an editor that can be used to display and edit the values in this column.
* <p>
* It is also possible to specify renderers and editors on a per type basis
* rather than a per column basis - see the
! * {@code setDefaultRenderer} method in the {@code JTable} class.
* This default mechanism is only used when the renderer (or
! * editor) in the {@code TableColumn} is {@code null}.
* <p>
! * The {@code TableColumn} stores the link between the columns in the
! * {@code JTable} and the columns in the {@code TableModel}.
! * The {@code modelIndex} is the column in the
! * {@code TableModel}, which will be queried for the data values for the
* cells in this column. As the column moves around in the view this
! * {@code modelIndex} does not change.
* <p>
* <b>Note:</b> Some implementations may assume that all
! * {@code TableColumnModel}s are unique, therefore we would
! * recommend that the same {@code TableColumn} instance
! * not be added more than once to a {@code TableColumnModel}.
! * To show {@code TableColumn}s with the same column of
* data from the model, create a new instance with the same
! * {@code modelIndex}.
* <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. As of 1.4, support for long term storage
* of all JavaBeans™
! * has been added to the {@code java.beans} package.
* Please see {@link java.beans.XMLEncoder}.
*
* @author Alan Chung
* @author Philip Milne
* @see javax.swing.table.TableColumnModel
*** 116,139 ****
// Instance Variables
//
/**
* The index of the column in the model which is to be displayed by
! * this <code>TableColumn</code>. As columns are moved around in the
! * view <code>modelIndex</code> remains constant.
*/
protected int modelIndex;
/**
* This object is not used internally by the drawing machinery of
! * the <code>JTable</code>; identifiers may be set in the
! * <code>TableColumn</code> as an
* optional way to tag and locate table columns. The table package does
* not modify or invoke any methods in these identifier objects other
! * than the <code>equals</code> method which is used in the
! * <code>getColumnIndex()</code> method in the
! * <code>DefaultTableColumnModel</code>.
*/
protected Object identifier;
/** The width of the column. */
protected int width;
--- 116,139 ----
// Instance Variables
//
/**
* The index of the column in the model which is to be displayed by
! * this {@code TableColumn}. As columns are moved around in the
! * view {@code modelIndex} remains constant.
*/
protected int modelIndex;
/**
* This object is not used internally by the drawing machinery of
! * the {@code JTable}; identifiers may be set in the
! * {@code TableColumn} as an
* optional way to tag and locate table columns. The table package does
* not modify or invoke any methods in these identifier objects other
! * than the {@code equals} method which is used in the
! * {@code getColumnIndex()} method in the
! * {@code DefaultTableColumnModel}.
*/
protected Object identifier;
/** The width of the column. */
protected int width;
*** 174,206 ****
*/
@Deprecated
protected transient int resizedPostingDisableCount;
/**
! * If any <code>PropertyChangeListeners</code> have been registered, the
! * <code>changeSupport</code> field describes them.
*/
private SwingPropertyChangeSupport changeSupport;
//
// Constructors
//
/**
* Cover method, using a default model index of 0,
! * default width of 75, a <code>null</code> renderer and a
! * <code>null</code> editor.
* This method is intended for serialization.
* @see #TableColumn(int, int, TableCellRenderer, TableCellEditor)
*/
public TableColumn() {
this(0);
}
/**
! * Cover method, using a default width of 75, a <code>null</code>
! * renderer and a <code>null</code> editor.
* @see #TableColumn(int, int, TableCellRenderer, TableCellEditor)
*
* @param modelIndex the index of the column in the model
* that supplies the data for this column in the table;
* the model index remains the same even when columns
--- 174,206 ----
*/
@Deprecated
protected transient int resizedPostingDisableCount;
/**
! * If any {@code PropertyChangeListeners} have been registered, the
! * {@code changeSupport} field describes them.
*/
private SwingPropertyChangeSupport changeSupport;
//
// Constructors
//
/**
* Cover method, using a default model index of 0,
! * default width of 75, a {@code null} renderer and a
! * {@code null} editor.
* This method is intended for serialization.
* @see #TableColumn(int, int, TableCellRenderer, TableCellEditor)
*/
public TableColumn() {
this(0);
}
/**
! * Cover method, using a default width of 75, a {@code null}
! * renderer and a {@code null} editor.
* @see #TableColumn(int, int, TableCellRenderer, TableCellEditor)
*
* @param modelIndex the index of the column in the model
* that supplies the data for this column in the table;
* the model index remains the same even when columns
*** 209,220 ****
public TableColumn(int modelIndex) {
this(modelIndex, 75, null, null);
}
/**
! * Cover method, using a <code>null</code> renderer and a
! * <code>null</code> editor.
* @see #TableColumn(int, int, TableCellRenderer, TableCellEditor)
*
* @param modelIndex the index of the column in the model
* that supplies the data for this column in the table;
* the model index remains the same even when columns
--- 209,220 ----
public TableColumn(int modelIndex) {
this(modelIndex, 75, null, null);
}
/**
! * Cover method, using a {@code null} renderer and a
! * {@code null} editor.
* @see #TableColumn(int, int, TableCellRenderer, TableCellEditor)
*
* @param modelIndex the index of the column in the model
* that supplies the data for this column in the table;
* the model index remains the same even when columns
*** 225,255 ****
this(modelIndex, width, null, null);
}
/**
* Creates and initializes an instance of
! * <code>TableColumn</code> with the specified model index,
* width, cell renderer, and cell editor;
! * all <code>TableColumn</code> constructors delegate to this one.
! * The value of <code>width</code> is used
* for both the initial and preferred width;
! * if <code>width</code> is negative,
* they're set to 0.
* The minimum width is set to 15 unless the initial width is less,
* in which case the minimum width is set to
* the initial width.
*
* <p>
! * When the <code>cellRenderer</code>
! * or <code>cellEditor</code> parameter is <code>null</code>,
! * a default value provided by the <code>JTable</code>
! * <code>getDefaultRenderer</code>
! * or <code>getDefaultEditor</code> method, respectively,
* is used to
* provide defaults based on the type of the data in this column.
* This column-centric rendering strategy can be circumvented by overriding
! * the <code>getCellRenderer</code> methods in <code>JTable</code>.
*
* @param modelIndex the index of the column
* in the model that supplies the data for this column in the table;
* the model index remains the same
* even when columns are reordered in the view
--- 225,255 ----
this(modelIndex, width, null, null);
}
/**
* Creates and initializes an instance of
! * {@code TableColumn} with the specified model index,
* width, cell renderer, and cell editor;
! * all {@code TableColumn} constructors delegate to this one.
! * The value of {@code width} is used
* for both the initial and preferred width;
! * if {@code width} is negative,
* they're set to 0.
* The minimum width is set to 15 unless the initial width is less,
* in which case the minimum width is set to
* the initial width.
*
* <p>
! * When the {@code cellRenderer}
! * or {@code cellEditor} parameter is {@code null},
! * a default value provided by the {@code JTable}
! * {@code getDefaultRenderer}
! * or {@code getDefaultEditor} method, respectively,
* is used to
* provide defaults based on the type of the data in this column.
* This column-centric rendering strategy can be circumvented by overriding
! * the {@code getCellRenderer} methods in {@code JTable}.
*
* @param modelIndex the index of the column
* in the model that supplies the data for this column in the table;
* the model index remains the same
* even when columns are reordered in the view
*** 303,313 ****
}
/**
* Sets the model index for this column. The model index is the
* index of the column in the model that will be displayed by this
! * <code>TableColumn</code>. As the <code>TableColumn</code>
* is moved around in the view the model index remains constant.
* @param modelIndex the new modelIndex
* @beaninfo
* bound: true
* description: The model index.
--- 303,313 ----
}
/**
* Sets the model index for this column. The model index is the
* index of the column in the model that will be displayed by this
! * {@code TableColumn}. As the {@code TableColumn}
* is moved around in the view the model index remains constant.
* @param modelIndex the new modelIndex
* @beaninfo
* bound: true
* description: The model index.
*** 318,337 ****
firePropertyChange("modelIndex", old, modelIndex);
}
/**
* Returns the model index for this column.
! * @return the <code>modelIndex</code> property
*/
public int getModelIndex() {
return modelIndex;
}
/**
! * Sets the <code>TableColumn</code>'s identifier to
! * <code>anIdentifier</code>. <p>
! * Note: identifiers are not used by the <code>JTable</code>,
* they are purely a
* convenience for the external tagging and location of columns.
*
* @param identifier an identifier for this column
* @see #getIdentifier
--- 318,337 ----
firePropertyChange("modelIndex", old, modelIndex);
}
/**
* Returns the model index for this column.
! * @return the {@code modelIndex} property
*/
public int getModelIndex() {
return modelIndex;
}
/**
! * Sets the {@code TableColumn}'s identifier to
! * {@code anIdentifier}. <p>
! * Note: identifiers are not used by the {@code JTable},
* they are purely a
* convenience for the external tagging and location of columns.
*
* @param identifier an identifier for this column
* @see #getIdentifier
*** 345,374 ****
firePropertyChange("identifier", old, identifier);
}
/**
! * Returns the <code>identifier</code> object for this column.
! * Note identifiers are not used by <code>JTable</code>,
* they are purely a convenience for external use.
! * If the <code>identifier</code> is <code>null</code>,
! * <code>getIdentifier()</code> returns <code>getHeaderValue</code>
* as a default.
*
! * @return the <code>identifier</code> property
* @see #setIdentifier
*/
public Object getIdentifier() {
return (identifier != null) ? identifier : getHeaderValue();
}
/**
! * Sets the <code>Object</code> whose string representation will be
! * used as the value for the <code>headerRenderer</code>. When the
! * <code>TableColumn</code> is created, the default <code>headerValue</code>
! * is <code>null</code>.
* @param headerValue the new headerValue
* @see #getHeaderValue
* @beaninfo
* bound: true
* description: The text to be used by the header renderer.
--- 345,374 ----
firePropertyChange("identifier", old, identifier);
}
/**
! * Returns the {@code identifier} object for this column.
! * Note identifiers are not used by {@code JTable},
* they are purely a convenience for external use.
! * If the {@code identifier} is {@code null},
! * {@code getIdentifier()} returns {@code getHeaderValue}
* as a default.
*
! * @return the {@code identifier} property
* @see #setIdentifier
*/
public Object getIdentifier() {
return (identifier != null) ? identifier : getHeaderValue();
}
/**
! * Sets the {@code Object} whose string representation will be
! * used as the value for the {@code headerRenderer}. When the
! * {@code TableColumn} is created, the default {@code headerValue}
! * is {@code null}.
* @param headerValue the new headerValue
* @see #getHeaderValue
* @beaninfo
* bound: true
* description: The text to be used by the header renderer.
*** 378,391 ****
this.headerValue = headerValue;
firePropertyChange("headerValue", old, headerValue);
}
/**
! * Returns the <code>Object</code> used as the value for the header
* renderer.
*
! * @return the <code>headerValue</code> property
* @see #setHeaderValue
*/
public Object getHeaderValue() {
return headerValue;
}
--- 378,391 ----
this.headerValue = headerValue;
firePropertyChange("headerValue", old, headerValue);
}
/**
! * Returns the {@code Object} used as the value for the header
* renderer.
*
! * @return the {@code headerValue} property
* @see #setHeaderValue
*/
public Object getHeaderValue() {
return headerValue;
}
*** 393,404 ****
//
// Renderers and Editors
//
/**
! * Sets the <code>TableCellRenderer</code> used to draw the
! * <code>TableColumn</code>'s header to <code>headerRenderer</code>.
* <p>
* It is the header renderers responsibility to render the sorting
* indicator. If you are using sorting and specify a renderer your
* renderer must render the sorting indication.
*
--- 393,404 ----
//
// Renderers and Editors
//
/**
! * Sets the {@code TableCellRenderer} used to draw the
! * {@code TableColumn}'s header to {@code headerRenderer}.
* <p>
* It is the header renderers responsibility to render the sorting
* indicator. If you are using sorting and specify a renderer your
* renderer must render the sorting indication.
*
*** 414,440 ****
this.headerRenderer = headerRenderer;
firePropertyChange("headerRenderer", old, headerRenderer);
}
/**
! * Returns the <code>TableCellRenderer</code> used to draw the header of the
! * <code>TableColumn</code>. When the <code>headerRenderer</code> is
! * <code>null</code>, the <code>JTableHeader</code>
! * uses its <code>defaultRenderer</code>. The default value for a
! * <code>headerRenderer</code> is <code>null</code>.
*
! * @return the <code>headerRenderer</code> property
* @see #setHeaderRenderer
* @see #setHeaderValue
* @see javax.swing.table.JTableHeader#getDefaultRenderer()
*/
public TableCellRenderer getHeaderRenderer() {
return headerRenderer;
}
/**
! * Sets the <code>TableCellRenderer</code> used by <code>JTable</code>
* to draw individual values for this column.
*
* @param cellRenderer the new cellRenderer
* @see #getCellRenderer
* @beaninfo
--- 414,440 ----
this.headerRenderer = headerRenderer;
firePropertyChange("headerRenderer", old, headerRenderer);
}
/**
! * Returns the {@code TableCellRenderer} used to draw the header of the
! * {@code TableColumn}. When the {@code headerRenderer} is
! * {@code null}, the {@code JTableHeader}
! * uses its {@code defaultRenderer}. The default value for a
! * {@code headerRenderer} is {@code null}.
*
! * @return the {@code headerRenderer} property
* @see #setHeaderRenderer
* @see #setHeaderValue
* @see javax.swing.table.JTableHeader#getDefaultRenderer()
*/
public TableCellRenderer getHeaderRenderer() {
return headerRenderer;
}
/**
! * Sets the {@code TableCellRenderer} used by {@code JTable}
* to draw individual values for this column.
*
* @param cellRenderer the new cellRenderer
* @see #getCellRenderer
* @beaninfo
*** 446,466 ****
this.cellRenderer = cellRenderer;
firePropertyChange("cellRenderer", old, cellRenderer);
}
/**
! * Returns the <code>TableCellRenderer</code> used by the
! * <code>JTable</code> to draw
! * values for this column. The <code>cellRenderer</code> of the column
* not only controls the visual look for the column, but is also used to
! * interpret the value object supplied by the <code>TableModel</code>.
! * When the <code>cellRenderer</code> is <code>null</code>,
! * the <code>JTable</code> uses a default renderer based on the
* class of the cells in that column. The default value for a
! * <code>cellRenderer</code> is <code>null</code>.
*
! * @return the <code>cellRenderer</code> property
* @see #setCellRenderer
* @see JTable#setDefaultRenderer
*/
public TableCellRenderer getCellRenderer() {
return cellRenderer;
--- 446,466 ----
this.cellRenderer = cellRenderer;
firePropertyChange("cellRenderer", old, cellRenderer);
}
/**
! * Returns the {@code TableCellRenderer} used by the
! * {@code JTable} to draw
! * values for this column. The {@code cellRenderer} of the column
* not only controls the visual look for the column, but is also used to
! * interpret the value object supplied by the {@code TableModel}.
! * When the {@code cellRenderer} is {@code null},
! * the {@code JTable} uses a default renderer based on the
* class of the cells in that column. The default value for a
! * {@code cellRenderer} is {@code null}.
*
! * @return the {@code cellRenderer} property
* @see #setCellRenderer
* @see JTable#setDefaultRenderer
*/
public TableCellRenderer getCellRenderer() {
return cellRenderer;
*** 480,515 ****
this.cellEditor = cellEditor;
firePropertyChange("cellEditor", old, cellEditor);
}
/**
! * Returns the <code>TableCellEditor</code> used by the
! * <code>JTable</code> to edit values for this column. When the
! * <code>cellEditor</code> is <code>null</code>, the <code>JTable</code>
* uses a default editor based on the
* class of the cells in that column. The default value for a
! * <code>cellEditor</code> is <code>null</code>.
*
! * @return the <code>cellEditor</code> property
* @see #setCellEditor
* @see JTable#setDefaultEditor
*/
public TableCellEditor getCellEditor() {
return cellEditor;
}
/**
* 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.
* @param width the new width
* @see #getWidth
* @see #setMinWidth
* @see #setMaxWidth
--- 480,515 ----
this.cellEditor = cellEditor;
firePropertyChange("cellEditor", old, cellEditor);
}
/**
! * Returns the {@code TableCellEditor} used by the
! * {@code JTable} to edit values for this column. When the
! * {@code cellEditor} is {@code null}, the {@code JTable}
* uses a default editor based on the
* class of the cells in that column. The default value for a
! * {@code cellEditor} is {@code null}.
*
! * @return the {@code cellEditor} property
* @see #setCellEditor
* @see JTable#setDefaultEditor
*/
public TableCellEditor getCellEditor() {
return cellEditor;
}
/**
* This method should not be used to set the widths of columns in the
! * {@code JTable}, use {@code setPreferredWidth} instead.
* Like a layout manager in the
! * AWT, the {@code JTable} 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}.
! * If {@code width} exceeds the minimum or maximum width,
* it is adjusted to the appropriate limiting value.
* @param width the new width
* @see #getWidth
* @see #setMinWidth
* @see #setMaxWidth
*** 524,552 ****
this.width = Math.min(Math.max(width, minWidth), maxWidth);
firePropertyChange("width", old, this.width);
}
/**
! * Returns the width of the <code>TableColumn</code>. The default width is
* 75.
*
! * @return the <code>width</code> property
* @see #setWidth
*/
public int getWidth() {
return width;
}
/**
! * 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>doLayout</code> method in <code>JTable</code>.
*
* @param preferredWidth the new preferred width
* @see #getPreferredWidth
* @see JTable#doLayout()
* @beaninfo
--- 524,552 ----
this.width = Math.min(Math.max(width, minWidth), maxWidth);
firePropertyChange("width", old, this.width);
}
/**
! * Returns the width of the {@code TableColumn}. The default width is
* 75.
*
! * @return the {@code width} property
* @see #setWidth
*/
public int getWidth() {
return width;
}
/**
! * Sets this column's preferred width to {@code preferredWidth}.
! * If {@code preferredWidth} 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}
! * (and {@code JTableHeader}) are calculated from the
! * {@code preferredWidth},
! * see the {@code doLayout} method in {@code JTable}.
*
* @param preferredWidth the new preferred width
* @see #getPreferredWidth
* @see JTable#doLayout()
* @beaninfo
*** 558,588 ****
this.preferredWidth = Math.min(Math.max(preferredWidth, minWidth), maxWidth);
firePropertyChange("preferredWidth", old, this.preferredWidth);
}
/**
! * Returns the preferred width of the <code>TableColumn</code>.
* The default preferred width is 75.
*
! * @return the <code>preferredWidth</code> property
* @see #setPreferredWidth
*/
public int getPreferredWidth() {
return preferredWidth;
}
/**
! * Sets the <code>TableColumn</code>'s minimum width to
! * <code>minWidth</code>,
* adjusting the new minimum width if necessary to ensure that
! * 0 <= <code>minWidth</code> <= <code>maxWidth</code>.
! * For example, if the <code>minWidth</code> argument is negative,
! * this method sets the <code>minWidth</code> property to 0.
*
* <p>
* If the value of the
! * <code>width</code> or <code>preferredWidth</code> property
* is less than the new minimum width,
* this method sets that property to the new minimum width.
*
* @param minWidth the new minimum width
* @see #getMinWidth
--- 558,588 ----
this.preferredWidth = Math.min(Math.max(preferredWidth, minWidth), maxWidth);
firePropertyChange("preferredWidth", old, this.preferredWidth);
}
/**
! * Returns the preferred width of the {@code TableColumn}.
* The default preferred width is 75.
*
! * @return the {@code preferredWidth} property
* @see #setPreferredWidth
*/
public int getPreferredWidth() {
return preferredWidth;
}
/**
! * Sets the {@code TableColumn}'s minimum width to
! * {@code minWidth},
* adjusting the new minimum width if necessary to ensure that
! * {@code 0 <= minWidth <= maxWidth}.
! * For example, if the {@code minWidth} argument is negative,
! * this method sets the {@code minWidth} property to 0.
*
* <p>
* If the value of the
! * {@code width} or {@code preferredWidth} property
* is less than the new minimum width,
* this method sets that property to the new minimum width.
*
* @param minWidth the new minimum width
* @see #getMinWidth
*** 603,633 ****
}
firePropertyChange("minWidth", old, this.minWidth);
}
/**
! * 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.
*
! * @return the <code>minWidth</code> property
* @see #setMinWidth
* @see #TableColumn(int, int, TableCellRenderer, TableCellEditor)
*/
public int getMinWidth() {
return minWidth;
}
/**
! * Sets the <code>TableColumn</code>'s maximum width to
! * <code>maxWidth</code> or,
! * if <code>maxWidth</code> is less than the minimum width,
* to the minimum width.
*
* <p>
* If the value of the
! * <code>width</code> or <code>preferredWidth</code> property
* is more than the new maximum width,
* this method sets that property to the new maximum width.
*
* @param maxWidth the new maximum width
* @see #getMaxWidth
--- 603,633 ----
}
firePropertyChange("minWidth", old, this.minWidth);
}
/**
! * Returns the minimum width for the {@code TableColumn}. The
! * {@code TableColumn}'s width can't be made less than this either
* by the user or programmatically.
*
! * @return the {@code minWidth} property
* @see #setMinWidth
* @see #TableColumn(int, int, TableCellRenderer, TableCellEditor)
*/
public int getMinWidth() {
return minWidth;
}
/**
! * Sets the {@code TableColumn}'s maximum width to
! * {@code maxWidth} or,
! * if {@code maxWidth} is less than the minimum width,
* to the minimum width.
*
* <p>
* If the value of the
! * {@code width} or {@code preferredWidth} property
* is more than the new maximum width,
* this method sets that property to the new maximum width.
*
* @param maxWidth the new maximum width
* @see #getMaxWidth
*** 648,663 ****
}
firePropertyChange("maxWidth", old, this.maxWidth);
}
/**
! * 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.
*
! * @return the <code>maxWidth</code> property
* @see #setMaxWidth
*/
public int getMaxWidth() {
return maxWidth;
}
--- 648,663 ----
}
firePropertyChange("maxWidth", old, this.maxWidth);
}
/**
! * Returns the maximum width for the {@code TableColumn}. The
! * {@code TableColumn}'s width can't be made larger than this
* either by the user or programmatically. The default maxWidth
* is Integer.MAX_VALUE.
*
! * @return the {@code maxWidth} property
* @see #setMaxWidth
*/
public int getMaxWidth() {
return maxWidth;
}
*** 677,700 ****
firePropertyChange("isResizable", old, this.isResizable);
}
/**
* 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.
*
! * @return the <code>isResizable</code> property
* @see #setResizable
*/
public boolean getResizable() {
return isResizable;
}
/**
! * 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). Otherwise, it sets the minimum, maximum and preferred
* widths of this column to the widths of the minimum, maximum and preferred
* sizes of the Component delivered by the header renderer.
* The transient "width" property of this TableColumn is also set to the
* preferred width. Note this method is not used internally by the table
--- 677,700 ----
firePropertyChange("isResizable", old, this.isResizable);
}
/**
* Returns true if the user is allowed to resize the
! * {@code TableColumn}'s
* width, false otherwise. You can change the width programmatically
* regardless of this setting. The default is true.
*
! * @return the {@code isResizable} property
* @see #setResizable
*/
public boolean getResizable() {
return isResizable;
}
/**
! * Resizes the {@code TableColumn} to fit the width of its header cell.
! * This method does nothing if the header renderer is {@code null}
* (the default case). Otherwise, it sets the minimum, maximum and preferred
* widths of this column to the widths of the minimum, maximum and preferred
* sizes of the Component delivered by the header renderer.
* The transient "width" property of this TableColumn is also set to the
* preferred width. Note this method is not used internally by the table
*** 770,781 ****
}
changeSupport.addPropertyChangeListener(listener);
}
/**
! * Removes a <code>PropertyChangeListener</code> from the listener list.
! * The <code>PropertyChangeListener</code> to be removed was registered
* for all properties.
*
* @param listener the listener to be removed
*
*/
--- 770,781 ----
}
changeSupport.addPropertyChangeListener(listener);
}
/**
! * Removes a {@code PropertyChangeListener} from the listener list.
! * The {@code PropertyChangeListener} to be removed was registered
* for all properties.
*
* @param listener the listener to be removed
*
*/
*** 786,799 ****
changeSupport.removePropertyChangeListener(listener);
}
}
/**
! * Returns an array of all the <code>PropertyChangeListener</code>s added
* to this TableColumn with addPropertyChangeListener().
*
! * @return all of the <code>PropertyChangeListener</code>s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public synchronized PropertyChangeListener[] getPropertyChangeListeners() {
if (changeSupport == null) {
--- 786,799 ----
changeSupport.removePropertyChangeListener(listener);
}
}
/**
! * Returns an array of all the {@code PropertyChangeListener}s added
* to this TableColumn with addPropertyChangeListener().
*
! * @return all of the {@code PropertyChangeListener}s added or an empty
* array if no listeners have been added
* @since 1.4
*/
public synchronized PropertyChangeListener[] getPropertyChangeListeners() {
if (changeSupport == null) {
*** 805,820 ****
//
// Protected Methods
//
/**
! * 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.
*
* @return the default header renderer
* @see javax.swing.table.JTableHeader#createDefaultRenderer()
*/
protected TableCellRenderer createDefaultHeaderRenderer() {
--- 805,820 ----
//
// Protected Methods
//
/**
! * As of Java 2 platform v1.3, this method is not called by the {@code TableColumn}
* constructor. Previously this method was used by the
! * {@code TableColumn} to create a default header renderer.
! * As of Java 2 platform v1.3, the default header renderer is {@code null}.
! * {@code JTableHeader} now provides its own shared default
! * renderer, just as the {@code JTable} does for its cell renderers.
*
* @return the default header renderer
* @see javax.swing.table.JTableHeader#createDefaultRenderer()
*/
protected TableCellRenderer createDefaultHeaderRenderer() {
< prev index next >