<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/*
 * @(#)TableColumn.java	1.49 00/02/02
 *
 * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
 * 
 * This software is the proprietary information of Sun Microsystems, Inc.  
 * Use is subject to license terms.
 * 
 */

package javax.swing.table;

import javax.swing.*;
import javax.swing.border.*;
import javax.swing.event.SwingPropertyChangeSupport;
import java.lang.Integer;
import java.awt.Color;
import java.awt.Component;
import java.io.Serializable;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;

/**
 *  A &lt;code&gt;TableColumn&lt;/code&gt; represents all the attributes of a column in a
 *  &lt;code&gt;JTable&lt;/code&gt;, such as width, resizibility, minimum and maximum width.
 *  In addition, the &lt;code&gt;TableColumn&lt;/code&gt; provides slots for a renderer and 
 *  an editor that can be used to display and edit the values in this column. 
 *  &lt;p&gt;
 *  It is also possible to specify renderers and editors on a per type basis
 *  rather than a per column basis - see the 
 *  &lt;code&gt;setDefaultRenderer&lt;/code&gt; method in the &lt;code&gt;JTable&lt;/code&gt; class.
 *  This default mechanism is only used when the renderer (or
 *  editor) in the &lt;code&gt;TableColumn&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;.
 * &lt;p&gt;
 *  The &lt;code&gt;TableColumn&lt;/code&gt; stores the link between the columns in the
 *  &lt;code&gt;JTable&lt;/code&gt; and the columns in the &lt;code&gt;TableModel&lt;/code&gt;.
 *  The &lt;code&gt;modelIndex&lt;/code&gt; is the column in the
 *  &lt;code&gt;TableModel&lt;/code&gt;, which will be queried for the data values for the
 *  cells in this column. As the column moves around in the view this
 *  &lt;code&gt;modelIndex&lt;/code&gt; does not change.
 *  &lt;p&gt;
 * &lt;strong&gt;Warning:&lt;/strong&gt;
 * 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.
 *
 * @version 1.49 02/02/00
 * @author Alan Chung
 * @author Philip Milne
 * @see javax.swing.table.TableColumnModel
 *
 * @see javax.swing.table.DefaultTableColumnModel
 * @see javax.swing.table.JTableHeader#getDefaultRenderer()
 * @see JTable#getDefaultRenderer(Class)
 * @see JTable#getDefaultEditor(Class)
 * @see JTable#getCellRenderer(int, int)
 * @see JTable#getCellEditor(int, int)
 */
public class TableColumn extends Object implements Serializable {

    /** 
     * Obsolete as of Java 2 platform v1.3.  Please use string literals to identify 
     * properties.
     */
    /* 
     * Warning: The value of this constant, "columWidth" is wrong as the
     * name of the property is "columnWidth".
     */
    public final static String COLUMN_WIDTH_PROPERTY = "columWidth";

    /** 
     * Obsolete as of Java 2 platform v1.3.  Please use string literals to identify 
     * properties.
     */
    public final static String HEADER_VALUE_PROPERTY = "headerValue";

    /** 
     * Obsolete as of Java 2 platform v1.3.  Please use string literals to identify 
     * properties.
     */
    public final static String HEADER_RENDERER_PROPERTY = "headerRenderer";

    /** 
     * Obsolete as of Java 2 platform v1.3.  Please use string literals to identify 
     * properties.
     */
    public final static String CELL_RENDERER_PROPERTY = "cellRenderer";

//
//  Instance Variables
//

    /**
      * The index of the column in the model which is to be displayed by
      * this &lt;code&gt;TableColumn&lt;/code&gt;. As columns are moved around in the
      * view &lt;code&gt;modelIndex&lt;/code&gt; remains constant.
      */
    protected int	modelIndex;

    /**
     *  This object is not used internally by the drawing machinery of
     *  the &lt;code&gt;JTable&lt;/code&gt;; identifiers may be set in the
     *  &lt;code&gt;TableColumn&lt;/code&gt; as as an
     *  optional way to tag and locate table columns. The table package does
     *  not modify or invoke any methods in these identifer objects other
     *  than the &lt;code&gt;equals&lt;/code&gt; method which is used in the
     *  &lt;code&gt;getColumnIndex()&lt;/code&gt; method in the
     *  &lt;code&gt;DefaultTableColumnModel&lt;/code&gt;.
     */
    protected Object	identifier;

    /** The width of the column. */
    protected int	width;

    /** The minimum width of the column. */
    protected int	minWidth;

    /** The preferred width of the column. */
    private int         preferredWidth;

    /** The maximum width of the column. */
    protected int	maxWidth;

    /** The renderer used to draw the header of the column. */
    protected TableCellRenderer	headerRenderer;

    /** The header value of the column. */
    protected Object		headerValue;

    /** The renderer used to draw the data cells of the column. */
    protected TableCellRenderer	cellRenderer;

    /** The editor used to edit the data cells of the column. */
    protected TableCellEditor	cellEditor;

    /** If true, the user is allowed to resize the column; the default is true. */
    protected boolean	isResizable;

    /**
     * This field was not used in previous releases and there are
     * currently no plans to support it in the future.
     * 
     * @deprecated as of Java 2 platform v1.3
     */
    /*
     *  Counter used to disable posting of resizing notifications until the
     *  end of the resize. 
     */
    transient protected int	resizedPostingDisableCount;

    /**
     * If any &lt;code&gt;PropertyChangeListeners&lt;/code&gt; have been registered, the
     * &lt;code&gt;changeSupport&lt;/code&gt; field describes them.
     */
    private SwingPropertyChangeSupport changeSupport;

//
// Constructors
//

    /** 
     *  Cover method, using a default model index of 0, 
     *  default width of 75, a &lt;code&gt;null&lt;/code&gt; renderer and a
     *  &lt;code&gt;null&lt;/code&gt; 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 &lt;code&gt;null&lt;/code&gt;
     *  renderer and a &lt;code&gt;null&lt;/code&gt; editor. 
     *  @see #TableColumn(int, int, TableCellRenderer, TableCellEditor)
     */
    public TableColumn(int modelIndex) {
	this(modelIndex, 75, null, null);
    }

    /** 
     *  Cover method, using a &lt;code&gt;null&lt;/code&gt; renderer and a
     *  &lt;code&gt;null&lt;/code&gt; editor. 
     *  @see #TableColumn(int, int, TableCellRenderer, TableCellEditor)
     */
    public TableColumn(int modelIndex, int width) {
	this(modelIndex, width, null, null);
    }

    /**
     *  Creates and initializes an instance of 
     *  &lt;code&gt;TableColumn&lt;/code&gt; with &lt;code&gt;modelIndex&lt;/code&gt;.
     *  All &lt;code&gt;TableColumn&lt;/code&gt; constructors delegate to this one.
     *  The &lt;code&gt;modelIndex&lt;/code&gt; is the index of the column 
     *  in the model which will supply the data for this column in the table. 
     *  The &lt;code&gt;modelIndex&lt;/code&gt; does not change as the columns are reordered
     *  in the view. The width parameter is used to set both the 
     *  &lt;code&gt;preferredWidth&lt;/code&gt; for this 
     *  column and the initial width. The renderer and editor are the objects 
     *  used respectively to render and edit values in this column. When 
     *  these are &lt;code&gt;null&lt;/code&gt;, default values, provided by the
     *  &lt;code&gt;getDefaultRenderer&lt;/code&gt; 
     *  and &lt;code&gt;getDefaultEditor&lt;/code&gt; methods in the
     *  &lt;code&gt;JTable&lt;/code&gt; class are 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 &lt;code&gt;getCellRenderer&lt;/code&gt; methods in the &lt;code&gt;JTable&lt;/code&gt;. 
     *  &lt;p&gt;
     *
     * @see JTable#getDefaultRenderer(Class)
     * @see JTable#getDefaultEditor(Class)
     * @see JTable#getCellRenderer(int, int)
     * @see JTable#getCellEditor(int, int)
     */
    public TableColumn(int modelIndex, int width,
				 TableCellRenderer cellRenderer,
				 TableCellEditor cellEditor) {
	super();
	this.modelIndex = modelIndex;
	this.width = width;
	this.preferredWidth = width;

	this.cellRenderer = cellRenderer;
	this.cellEditor = cellEditor;

	// Set other instance variables to default values.
	minWidth = 15;
	maxWidth = Integer.MAX_VALUE;
	isResizable = true;
	resizedPostingDisableCount = 0;
	headerValue = null;
    }

//
// Modifying and Querying attributes
//

    private void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
        if (changeSupport != null) {
            changeSupport.firePropertyChange(propertyName, oldValue, newValue);
        }
    }

    private void firePropertyChange(String propertyName, int oldValue, int newValue) {
        if (oldValue != newValue) {
            firePropertyChange(propertyName, new Integer(oldValue), new Integer(newValue));
        }
    }

    private void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
        if (oldValue != newValue) {
            firePropertyChange(propertyName, new Boolean(oldValue), new Boolean(newValue));
        }
    }

    /**
     * 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
     * &lt;code&gt;TableColumn&lt;/code&gt;. As the &lt;code&gt;TableColumn&lt;/code&gt;
     * is moved around in the view the model index remains constant. 
     * @param  modelIndex  the new modelIndex
     * @beaninfo
     *  bound: true
     *  description: The model index.
     */
    public void setModelIndex(int modelIndex) {
	int old = this.modelIndex; 
	this.modelIndex = modelIndex; 
	firePropertyChange("modelIndex", old, modelIndex); 
    }

    /**
     * Returns the model index for this column.
     * @return the &lt;code&gt;modelIndex&lt;/code&gt; property
     */
    public int getModelIndex() {
	return modelIndex;
    }

    /**
     * Sets the &lt;code&gt;TableColumn&lt;/code&gt;'s identifier to
     * &lt;code&gt;anIdentifier&lt;/code&gt;. &lt;p&gt;
     * Note: identifiers are not used by the &lt;code&gt;JTable&lt;/code&gt;,
     * they are purely a
     * convenience for the external tagging and location of columns.
     *
     * @param	   identifier		an identifier for this column
     * @see	   #getIdentifier
     * @beaninfo
     *  bound: true
     *  description: A unique identifier for this column.
     */
    public void setIdentifier(Object identifier) { 
	Object old = this.identifier; 
	this.identifier = identifier; 
	firePropertyChange("identifier", old, identifier); 	
    }


    /**
     *  Returns the &lt;code&gt;identifier&lt;/code&gt; object for this column.
     *  Note identifiers are not used by &lt;code&gt;JTable&lt;/code&gt;,
     *  they are purely a convenience for external use.
     *  If the &lt;code&gt;identifier&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;,
     *  &lt;code&gt;getIdentifier()&lt;/code&gt; returns &lt;code&gt;getHeaderValue&lt;/code&gt;
     *  as a default.
     *
     * @return	the &lt;code&gt;identifier&lt;/code&gt; property
     * @see	#setIdentifier
     */
    public Object getIdentifier() {
        return (identifier != null) ? identifier : getHeaderValue();

    }

    /**
     * Sets the &lt;code&gt;Object&lt;/code&gt; whose string representation will be
     * used as the value for the &lt;code&gt;headerRenderer&lt;/code&gt;.  When the
     * &lt;code&gt;TableColumn&lt;/code&gt; is created, the default &lt;code&gt;headerValue&lt;/code&gt;
     * is &lt;code&gt;null&lt;/code&gt;.
     * @param headerValue  the new headerValue
     * @see	  #getHeaderValue
     * @beaninfo
     *  bound: true
     *  description: The text to be used by the header renderer.
     */
    public void setHeaderValue(Object headerValue) {
	Object old = this.headerValue;
	this.headerValue = headerValue;
	firePropertyChange("headerValue", old, headerValue);
    }

    /**
     * Returns the &lt;code&gt;Object&lt;/code&gt; used as the value for the header
     * renderer.
     *
     * @return	the &lt;code&gt;headerValue&lt;/code&gt; property
     * @see	#setHeaderValue
     */
    public Object getHeaderValue() {
	return headerValue;
    }

    //
    // Renderers and Editors
    //

    /**
     * Sets the &lt;code&gt;TableCellRenderer&lt;/code&gt; used to draw the 
     * &lt;code&gt;TableColumn&lt;/code&gt;'s header to &lt;code&gt;headerRenderer&lt;/code&gt;. 
     *
     * @param headerRenderer  the new headerRenderer
     *
     * @see	  #getHeaderRenderer
     * @beaninfo
     *  bound: true
     *  description: The header renderer.
     */
    public void setHeaderRenderer(TableCellRenderer headerRenderer) {
	TableCellRenderer old = this.headerRenderer;
	this.headerRenderer = headerRenderer;
	firePropertyChange("headerRenderer", old, headerRenderer);
    }

    /**
     * Returns the &lt;code&gt;TableCellRenderer&lt;/code&gt; used to draw the header of the
     * &lt;code&gt;TableColumn&lt;/code&gt;. When the &lt;code&gt;headerRenderer&lt;/code&gt; is
     * &lt;code&gt;null&lt;/code&gt;, the &lt;code&gt;JTableHeader&lt;/code&gt;
     * uses its &lt;code&gt;defaultRenderer&lt;/code&gt;. The default value for a 
     * &lt;code&gt;headerRenderer&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;.  
     *
     * @return	the &lt;code&gt;headerRenderer&lt;/code&gt; property
     * @see	#setHeaderRenderer
     * @see	#setHeaderValue     
     * @see	javax.swing.table.JTableHeader#getDefaultRenderer()
     */
    public TableCellRenderer getHeaderRenderer() {
	return headerRenderer;
    }

    /**
     * Sets the &lt;code&gt;TableCellRenderer&lt;/code&gt; used by &lt;code&gt;JTable&lt;/code&gt;
     * to draw individual values for this column.  
     *
     * @param cellRenderer  the new cellRenderer
     * @see	#getCellRenderer
     * @beaninfo
     *  bound: true
     *  description: The renderer to use for cell values.  
     */
    public void setCellRenderer(TableCellRenderer cellRenderer) {
	TableCellRenderer old = this.cellRenderer;
	this.cellRenderer = cellRenderer;
	firePropertyChange("cellRenderer", old, cellRenderer);
    }

    /**
     * Returns the &lt;code&gt;TableCellRenderer&lt;/code&gt; used by the
     * &lt;code&gt;JTable&lt;/code&gt; to draw
     * values for this column.  The &lt;code&gt;cellRenderer&lt;/code&gt; of the column
     * not only controls the visual look for the column, but is also used to
     * interpret the value object supplied by the &lt;code&gt;TableModel&lt;/code&gt;.
     * When the &lt;code&gt;cellRenderer&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;,
     * the &lt;code&gt;JTable&lt;/code&gt; uses a default renderer based on the 
     * class of the cells in that column. The default value for a 
     * &lt;code&gt;cellRenderer&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;.  
     *
     * @return	the &lt;code&gt;cellRenderer&lt;/code&gt; property
     * @see	#setCellRenderer
     * @see	JTable#setDefaultRenderer
     */
    public TableCellRenderer getCellRenderer() {
	return cellRenderer;
    }

    /**
     * Sets the editor to used by when a cell in this column is edited.  
     *
     * @param cellEditor  the new cellEditor
     * @see	#getCellEditor
     * @beaninfo
     *  bound: true
     *  description: The editor to use for cell values.     
     */
    public void setCellEditor(TableCellEditor cellEditor){
	TableCellEditor old = this.cellEditor;
	this.cellEditor = cellEditor;
	firePropertyChange("cellEditor", old, cellEditor);
    }

    /**
     * Returns the &lt;code&gt;TableCellEditor&lt;/code&gt; used by the
     * &lt;code&gt;JTable&lt;/code&gt; to edit values for this column.  When the 
     * &lt;code&gt;cellEditor&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;, the &lt;code&gt;JTable&lt;/code&gt;
     * uses a default editor based on the
     * class of the cells in that column. The default value for a 
     * &lt;code&gt;cellEditor&lt;/code&gt; is &lt;code&gt;null&lt;/code&gt;.  
     *
     * @return	the &lt;code&gt;cellEditor&lt;/code&gt; 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 
     * &lt;code&gt;JTable&lt;/code&gt;, use &lt;code&gt;setPreferredWidth&lt;/code&gt; instead.
     * Like a layout manager in the 
     * AWT, the &lt;code&gt;JTable&lt;/code&gt; 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. 
     * &lt;p&gt;
     * This method sets this column's width to &lt;code&gt;width&lt;/code&gt;.  
     * If &lt;code&gt;width&lt;/code&gt; exceeds the minimum or maximum width, 
     * it is adjusted to the appropriate limiting value.
     * &lt;p&gt;
     * @param  width  the new width
     * @see	#getWidth
     * @see	#setMinWidth
     * @see	#setMaxWidth
     * @see	#setPreferredWidth
     * @see     JTable#sizeColumnsToFit(int)
     * @beaninfo
     *  bound: true
     *  description: The width of the column.     
     */
    public void setWidth(int width) {
	int old = this.width;
	this.width = Math.min(Math.max(width, minWidth), maxWidth); 
	firePropertyChange("width", old, this.width);	
    }

    /**
     * Returns the width of the &lt;code&gt;TableColumn&lt;/code&gt;. The default width is
     * 75.
     *
     * @return	the &lt;code&gt;width&lt;/code&gt; property
     * @see	#setWidth
     */
    public int getWidth() {
	return width;
    }

    /**
     * Sets this column's preferred width to &lt;code&gt;preferredWidth&lt;/code&gt;.  
     * If &lt;code&gt;preferredWidth&lt;/code&gt; exceeds the minimum or maximum width, 
     * it is adjusted to the appropriate limiting value. 
     * &lt;p&gt;
     * For details on how the widths of columns in the &lt;code&gt;JTable&lt;/code&gt; 
     * (and &lt;code&gt;JTableHeader&lt;/code&gt;) are calculated from the
     * &lt;code&gt;preferredWidth&lt;/code&gt;, 
     * see the &lt;code&gt;sizeColumnsToFit&lt;/code&gt; method in &lt;code&gt;JTable&lt;/code&gt;. 
     *
     * @param  preferredWidth the new preferred width
     * @see	#getPreferredWidth
     * @see     JTable#sizeColumnsToFit(int)
     * @beaninfo
     *  bound: true
     *  description: The preferred width of the column.     
     */
    public void setPreferredWidth(int preferredWidth) { 
	int old = this.preferredWidth;
	this.preferredWidth = Math.min(Math.max(preferredWidth, minWidth), maxWidth); 
	firePropertyChange("preferredWidth", old, this.preferredWidth);	
    }

    /**
     * Returns the preferred width of the &lt;code&gt;TableColumn&lt;/code&gt;. 
     * The default preferred width is 75.
     *
     * @return	the &lt;code&gt;preferredWidth&lt;/code&gt; property
     * @see	#setPreferredWidth
     */
    public int getPreferredWidth() {
	return preferredWidth;
    }

    /**
     * Sets the &lt;code&gt;TableColumn&lt;/code&gt;'s minimum width to
     * &lt;code&gt;minWidth&lt;/code&gt;; also adjusts the current width
     * and preferred width if they are less than this value.
     *
     * @param minWidth  the new minimum width
     * @see	#getMinWidth
     * @see	#setPreferredWidth
     * @see	#setMaxWidth
     * @beaninfo
     *  bound: true
     *  description: The minimum width of the column.     
     */
    public void setMinWidth(int minWidth) { 
	int old = this.minWidth;	
	this.minWidth = Math.max(minWidth, 0);
	if (width &lt; minWidth) {
	    setWidth(minWidth);
	}
	if (preferredWidth &lt; minWidth) {
	    setPreferredWidth(minWidth);
	}
	firePropertyChange("minWidth", old, this.minWidth);	
    }

    /**
     * Returns the minimum width for the &lt;code&gt;TableColumn&lt;/code&gt;. The
     * &lt;code&gt;TableColumn&lt;/code&gt;'s width can't be made less than this either
     * by the user or programmatically.  The default minWidth is 15.
     *
     * @return	the &lt;code&gt;minWidth&lt;/code&gt; property
     * @see	#setMinWidth
     */
    public int getMinWidth() {
	return minWidth;
    }

    /**
     * Sets the &lt;code&gt;TableColumn&lt;/code&gt;'s maximum width to
     * &lt;code&gt;maxWidth&lt;/code&gt;; also adjusts the width and preferred
     * width if they are greater than this value.
     *
     * @param maxWidth  the new maximum width
     * @see	#getMaxWidth
     * @see	#setPreferredWidth
     * @see	#setMinWidth
     * @beaninfo
     *  bound: true
     *  description: The maximum width of the column.     
     */
    public void setMaxWidth(int maxWidth) {
	int old = this.maxWidth;	
	this.maxWidth = Math.max(minWidth, maxWidth);
	if (width &gt; maxWidth) {
	    setWidth(maxWidth);
	}
	if (preferredWidth &gt; maxWidth) {
	    setPreferredWidth(maxWidth);
	}
	firePropertyChange("maxWidth", old, this.maxWidth);	
    }

    /**
     * Returns the maximum width for the &lt;code&gt;TableColumn&lt;/code&gt;. The
     * &lt;code&gt;TableColumn&lt;/code&gt;'s width can't be made larger than this
     * either by the user or programmatically.  The default maxWidth
     * is Integer.MAX_VALUE.
     *
     * @return	the &lt;code&gt;maxWidth&lt;/code&gt; property
     * @see	#setMaxWidth
     */
    public int getMaxWidth() {
	return maxWidth;
    }

    /**
     * Sets whether this column can be resized.
     *
     * @param isResizable  if true, resizing is allowed; otherwise false
     * @see	#getResizable
     * @beaninfo
     *  bound: true
     *  description: Whether or not this column can be resized.
     */
    public void setResizable(boolean isResizable) {
	boolean old = this.isResizable;	
	this.isResizable = isResizable;
	firePropertyChange("isResizable", old, this.isResizable);	
    }

    /**
     * Returns true if the user is allowed to resize the
     * &lt;code&gt;TableColumn&lt;/code&gt;'s
     * width, false otherwise. You can change the width programmatically
     * regardless of this setting.  The default is true.
     *
     * @return	the &lt;code&gt;isResizable&lt;/code&gt; property
     * @see	#setResizable
     */
    public boolean getResizable() {
	return isResizable;
    }

    /**
     * Resizes the &lt;code&gt;TableColumn&lt;/code&gt; to fit the width of its header cell.
     * This method does nothing if the header renderer is &lt;code&gt;null&lt;/code&gt;
     * (the default case).
     *
     * @see	#setPreferredWidth
     */
    public void sizeWidthToFit() {
	// Get the preferred width of the header 
	if (headerRenderer == null) { 
	    return; 
	}
        Component comp = headerRenderer.getTableCellRendererComponent(null,
				getHeaderValue(), false, false, 0, 0);
	int headerWidth = comp.getPreferredSize().width;

	// Set the width
	this.setWidth(headerWidth);
    }

    /**
     * This field was not used in previous releases and there are
     * currently no plans to support it in the future.
     * 
     * @deprecated as of Java 2 platform v1.3
     */
    public void disableResizedPosting() {
	resizedPostingDisableCount++;
    }

    /**
     * This field was not used in previous releases and there are
     * currently no plans to support it in the future.
     * 
     * @deprecated as of Java 2 platform v1.3
     */
    public void enableResizedPosting() {
	resizedPostingDisableCount--;
    }

//
// Property Change Support
//

    /**
     * Adds a &lt;code&gt;PropertyChangeListener&lt;/code&gt; to the listener list.
     * The listener is registered for all properties.
     * &lt;p&gt;
     * A &lt;code&gt;PropertyChangeEvent&lt;/code&gt; will get fired in response to an
     * explicit call to &lt;code&gt;setFont&lt;/code&gt;, &lt;code&gt;setBackground&lt;/code&gt;,
     * or &lt;code&gt;setForeground&lt;/code&gt; 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.
     *
     * @param listener  the listener to be added
     *
     */
    public synchronized void addPropertyChangeListener(
                                PropertyChangeListener listener) {
        if (changeSupport == null) {
            changeSupport = new SwingPropertyChangeSupport(this);
        }
        changeSupport.addPropertyChangeListener(listener);
    }

    /**
     * Removes a &lt;code&gt;PropertyChangeListener&lt;/code&gt; from the listener list.
     * The &lt;code&gt;PropertyChangeListener&lt;/code&gt; to be removed was registered
     * for all properties.
     *
     * @param listener  the listener to be removed
     *
     */

    public synchronized void removePropertyChangeListener(
                                PropertyChangeListener listener) {
        if (changeSupport != null) {
	    changeSupport.removePropertyChangeListener(listener);
	}
    }

//
// Protected Methods
//

    /** 
     * As of Java 2 platform v1.3, this method is not called by the &lt;code&gt;TableColumn&lt;/code&gt;
     * constructor.  Previously this method was used by the
     * &lt;code&gt;TableColumn&lt;/code&gt; to create a default header renderer.
     * As of Java 2 platform v1.3, the default header renderer is &lt;code&gt;null&lt;/code&gt;.
     * &lt;code&gt;JTableHeader&lt;/code&gt; now provides its own shared default
     * renderer, just as the &lt;code&gt;JTable&lt;/code&gt; does for its cell renderers.
     *
     * @return the default header renderer
     * @see javax.swing.table.JTableHeader#createDefaultRenderer()
     */
    protected TableCellRenderer createDefaultHeaderRenderer() {
	DefaultTableCellRenderer label = new DefaultTableCellRenderer() {
	    public Component getTableCellRendererComponent(JTable table, Object value,
                         boolean isSelected, boolean hasFocus, int row, int column) {
	        if (table != null) {
	            JTableHeader header = table.getTableHeader();
	            if (header != null) {
	                setForeground(header.getForeground());
	                setBackground(header.getBackground());
	                setFont(header.getFont());
	            }
                }

                setText((value == null) ? "" : value.toString());
		setBorder(UIManager.getBorder("TableHeader.cellBorder"));
	        return this;
            }
	};
	label.setHorizontalAlignment(JLabel.CENTER);
	return label;
    }

} // End of class TableColumn





</pre></body></html>