< prev index next >

src/java.desktop/share/classes/javax/swing/table/TableColumn.java

Print this page

        

@@ -33,43 +33,43 @@
 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
+ *  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</code> method in the <code>JTable</code> class.
+ *  {@code setDefaultRenderer} method in the {@code JTable} class.
  *  This default mechanism is only used when the renderer (or
- *  editor) in the <code>TableColumn</code> is <code>null</code>.
+ *  editor) in the {@code TableColumn} is {@code null}.
  * <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
+ *  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</code> does not change.
+ *  {@code modelIndex} 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
+ *    {@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</code>.
+ *    {@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&trade;
- * has been added to the <code>java.beans</code> package.
+ * 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,24 +116,24 @@
 //  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.
+      * 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</code>; identifiers may be set in the
-     *  <code>TableColumn</code> as an
+     *  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</code> method which is used in the
-     *  <code>getColumnIndex()</code> method in the
-     *  <code>DefaultTableColumnModel</code>.
+     *  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,33 +174,33 @@
      */
     @Deprecated
     protected transient int     resizedPostingDisableCount;
 
     /**
-     * If any <code>PropertyChangeListeners</code> have been registered, the
-     * <code>changeSupport</code> field describes them.
+     * 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</code> renderer and a
-     *  <code>null</code> editor.
+     *  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</code>
-     *  renderer and a <code>null</code> editor.
+     *  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,12 +209,12 @@
     public TableColumn(int modelIndex) {
         this(modelIndex, 75, null, null);
     }
 
     /**
-     *  Cover method, using a <code>null</code> renderer and a
-     *  <code>null</code> editor.
+     *  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,31 +225,31 @@
         this(modelIndex, width, null, null);
     }
 
     /**
      *  Creates and initializes an instance of
-     *  <code>TableColumn</code> with the specified model index,
+     *  {@code TableColumn} 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
+     *  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</code> is negative,
+     *  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</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,
+     *  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</code> methods in <code>JTable</code>.
+     *  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,11 +303,11 @@
     }
 
     /**
      * 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>
+     * {@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,20 +318,20 @@
         firePropertyChange("modelIndex", old, modelIndex);
     }
 
     /**
      * Returns the model index for this column.
-     * @return the <code>modelIndex</code> property
+     * @return the {@code modelIndex} 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>,
+     * 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,30 +345,30 @@
         firePropertyChange("identifier", old, identifier);
     }
 
 
     /**
-     *  Returns the <code>identifier</code> object for this column.
-     *  Note identifiers are not used by <code>JTable</code>,
+     *  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</code> is <code>null</code>,
-     *  <code>getIdentifier()</code> returns <code>getHeaderValue</code>
+     *  If the {@code identifier} is {@code null},
+     *  {@code getIdentifier()} returns {@code getHeaderValue}
      *  as a default.
      *
-     * @return  the <code>identifier</code> property
+     * @return  the {@code identifier} 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>.
+     * 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,14 +378,14 @@
         this.headerValue = headerValue;
         firePropertyChange("headerValue", old, headerValue);
     }
 
     /**
-     * Returns the <code>Object</code> used as the value for the header
+     * Returns the {@code Object} used as the value for the header
      * renderer.
      *
-     * @return  the <code>headerValue</code> property
+     * @return  the {@code headerValue} property
      * @see     #setHeaderValue
      */
     public Object getHeaderValue() {
         return headerValue;
     }

@@ -393,12 +393,12 @@
     //
     // Renderers and Editors
     //
 
     /**
-     * Sets the <code>TableCellRenderer</code> used to draw the
-     * <code>TableColumn</code>'s header to <code>headerRenderer</code>.
+     * 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,27 +414,27 @@
         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>.
+     * 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</code> property
+     * @return  the {@code headerRenderer} 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>
+     * Sets the {@code TableCellRenderer} used by {@code JTable}
      * to draw individual values for this column.
      *
      * @param cellRenderer  the new cellRenderer
      * @see     #getCellRenderer
      * @beaninfo

@@ -446,21 +446,21 @@
         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
+     * 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</code>.
-     * When the <code>cellRenderer</code> is <code>null</code>,
-     * the <code>JTable</code> uses a default renderer based on the
+     * 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</code> is <code>null</code>.
+     * {@code cellRenderer} is {@code null}.
      *
-     * @return  the <code>cellRenderer</code> property
+     * @return  the {@code cellRenderer} property
      * @see     #setCellRenderer
      * @see     JTable#setDefaultRenderer
      */
     public TableCellRenderer getCellRenderer() {
         return cellRenderer;

@@ -480,36 +480,36 @@
         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>
+     * 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</code> is <code>null</code>.
+     * {@code cellEditor} is {@code null}.
      *
-     * @return  the <code>cellEditor</code> property
+     * @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</code>, use <code>setPreferredWidth</code> instead.
+     * {@code JTable}, use {@code setPreferredWidth} instead.
      * Like a layout manager in the
-     * AWT, the <code>JTable</code> adjusts a column's width automatically
+     * 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</code>.
-     * If <code>width</code> exceeds the minimum or maximum width,
+     * 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,29 +524,29 @@
         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
+     * Returns the width of the {@code TableColumn}. The default width is
      * 75.
      *
-     * @return  the <code>width</code> property
+     * @return  the {@code width} 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,
+     * 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</code>
-     * (and <code>JTableHeader</code>) are calculated from the
-     * <code>preferredWidth</code>,
-     * see the <code>doLayout</code> method in <code>JTable</code>.
+     * 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,31 +558,31 @@
         this.preferredWidth = Math.min(Math.max(preferredWidth, minWidth), maxWidth);
         firePropertyChange("preferredWidth", old, this.preferredWidth);
     }
 
     /**
-     * Returns the preferred width of the <code>TableColumn</code>.
+     * Returns the preferred width of the {@code TableColumn}.
      * The default preferred width is 75.
      *
-     * @return  the <code>preferredWidth</code> property
+     * @return  the {@code preferredWidth} property
      * @see     #setPreferredWidth
      */
     public int getPreferredWidth() {
         return preferredWidth;
     }
 
     /**
-     * Sets the <code>TableColumn</code>'s minimum width to
-     * <code>minWidth</code>,
+     * Sets the {@code TableColumn}'s minimum width to
+     * {@code minWidth},
      * adjusting the new minimum width if necessary to ensure that
-     * 0 &lt;= <code>minWidth</code> &lt;= <code>maxWidth</code>.
-     * For example, if the <code>minWidth</code> argument is negative,
-     * this method sets the <code>minWidth</code> property to 0.
+     * {@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</code> or <code>preferredWidth</code> property
+     * {@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,31 +603,31 @@
         }
         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
+     * 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</code> property
+     * @return  the {@code minWidth} 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,
+     * 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</code> or <code>preferredWidth</code> property
+     * {@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,16 +648,16 @@
         }
         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
+     * 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</code> property
+     * @return  the {@code maxWidth} property
      * @see     #setMaxWidth
      */
     public int getMaxWidth() {
         return maxWidth;
     }

@@ -677,24 +677,24 @@
         firePropertyChange("isResizable", old, this.isResizable);
     }
 
     /**
      * Returns true if the user is allowed to resize the
-     * <code>TableColumn</code>'s
+     * {@code TableColumn}'s
      * width, false otherwise. You can change the width programmatically
      * regardless of this setting.  The default is true.
      *
-     * @return  the <code>isResizable</code> property
+     * @return  the {@code isResizable} 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>
+     * 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,12 +770,12 @@
         }
         changeSupport.addPropertyChangeListener(listener);
     }
 
     /**
-     * Removes a <code>PropertyChangeListener</code> from the listener list.
-     * The <code>PropertyChangeListener</code> to be removed was registered
+     * 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,14 +786,14 @@
             changeSupport.removePropertyChangeListener(listener);
         }
     }
 
     /**
-     * Returns an array of all the <code>PropertyChangeListener</code>s added
+     * Returns an array of all the {@code PropertyChangeListener}s added
      * to this TableColumn with addPropertyChangeListener().
      *
-     * @return all of the <code>PropertyChangeListener</code>s added or an empty
+     * @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,16 +805,16 @@
 //
 // Protected Methods
 //
 
     /**
-     * As of Java 2 platform v1.3, this method is not called by the <code>TableColumn</code>
+     * 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</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.
+     * {@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 >