| # JTable | Other Swing Changes

> As a result of JTable changes, code written for v 1.2 or for JFC/Swing 1.1 might have the following problems when run in v 1.3:
> - Since the `TableColumn` `getHeaderRenderer` method now returns null by default, you can't use that method to get the default header renderer. Instead, change your code to use the `JTableHeader` `getDefaultRenderer` method. See How to Use Tables in The Java Tutorial for an example.
> - Because JTable's default text editor is now smarter about data types, it now gives `setValueAt` objects of the appropriate type, instead of always specifying strings. For example, if `setValueAt` is invoked for an Integer cell, then the value is specified as an Integer instead of a String. If you implemented a table model, then you might have to change its `setValueAt` method to take the new data type into account. If you implemented a class used as a data type for cells, make sure that your class has a constructor that takes a single String argument.

> ## Column and Row Layout Improvements

> We made the following changes:

> - Improved performance in tables with large numbers of columns
>   Moving the header renderers from the columns themselves to the table header represents the most significant change to performance and footprint by sharing similar header renderers on a per-table basis.
> - Dynamic changing of individual row height
>   The rendering machinery in the JTable has been substantially overhauled in this release to enable this much sought after feature in the JTable.
> - Simplified creation of non-standard editor components
>   The `AbstractCellEditor` class has been included in response to continued feedback on the difficulty of creating non-standard editor components.
> - Better handling of inter-cell spacing
>   Previously JTable did not correctly implement its specification for inter-cell spacing. Changes in the inter-cell spacing affected a number of other properties including the overall height of the table. In v 1.3, the inter-cell spacing has only one effect: to provide an inset for the cells, where the inset is the amount that renderers and editors are shrunk to accommodate the spacing between the cells.

> For more information, see the API documentation for the following methods and fields. Note that "obsolete" means that you should avoid using the obsolete API, but that using the API isn't dangerous enough to warrant a compile-time warning. "Deprecated" API, on the other hand, is not only obsolete but also results in a compile-time warning.

> #### In JTable

> - `public void removeNotify()`
> - `protected void unconfigureEnclosingScrollPane()`
> - `public void changeSelection(int rowIndex, int columnIndex, boolean toggle, boolean extend)`
> - `protected boolean cellSelectionEnabled` // obsolete
> - `public void setRowHeight(int row, int height)`
> - `public int getRowHeight(int row)`

> #### In JTableHeader

> - `protected boolean updateTableInRealTime` // obsolete
> - `public boolean getUpdateTableInRealTime()` // obsolete
> - `public void setUpdateTableInRealTime(boolean flag)` // obsolete
> - `public void setDefaultRenderer(TableCellRenderer defaultRenderer)`
> - `public TableCellRenderer getDefaultRenderer()`
> - `protected TableCellRenderer createDefaultRenderer()`

> #### In TableColumn

> - `public final static String COLUMN_WIDTH_PROPERTY;` // obsolete
> - `public final static String HEADER_VALUE_PROPERTY;` // obsolete
> - `public final static String HEADER_RENDERER_PROPERTY` // obsolete
> - `public final static String CELL_RENDERER_PROPERTY` // obsolete
> - `protected TableCellRenderer createDefaultHeaderRenderer()`
> - `transient protected int resizedPostingDisableCount` // deprecated
> - `public void disableResizedPosting()` // deprecated
> - `public void enableResizedPosting()` //deprecated

> #### New Class: `javax.swing.AbstractCellEditor`

> #### Existing Class `DefaultCellEditor` now extends `AbstractCellEditor`

> ## New SizeSequence Utility Class

> Before this release the height of rows in a JTable was always fixed. Introducing variable height rows whilst retaining the scalability requirements of the JTable (no O(N) behavior on rows) has required this new class and we have made it public as we think it may be generally useful. Indeed, table columns and the variable height rows of a JList might both use this class in the future to improve performance.

> See: `javax.swing.SizeSequence`

Copyright © 1995-98 Sun Microsystems, Inc. All Rights Reserved. Please send comments to: swing-feedback@java.sun.com. This is not a subscription list. | Java Software