javax.swing.table
Class DefaultTableCellRenderer
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--javax.swing.JLabel
|
+--javax.swing.table.DefaultTableCellRenderer
- All Implemented Interfaces:
- Accessible, ImageObserver, MenuContainer, Serializable, SwingConstants, TableCellRenderer
- Direct Known Subclasses:
- DefaultTableCellRenderer.UIResource
- public class DefaultTableCellRenderer
- extends JLabel
- implements TableCellRenderer, Serializable
The standard class for rendering (displaying) individual cells
in a JTable.
Implementation Note:
This class inherits from JLabel, a standard component class.
However JTable employs a unique mechanism for rendering
its cells and therefore requires some slightly modified behavior
from its cell renderer.
The table class defines a single cell renderer and uses it as a
as a rubber-stamp for rendering all cells in the table;
it renders the first cell,
changes the contents of that cell renderer,
shifts the origin to the new location, re-draws it, and so on.
The standard JLabel component was not
designed to be used this way and we want to avoid
triggering a revalidate each time the
cell is drawn. This would greatly decrease performance because the
revalidate message would be
passed up the hierarchy of the container to determine whether any other
components would be affected. So this class
overrides the validate, revalidate,
repaint, and firePropertyChange methods to be
no-ops. If you write your own renderer,
please keep this performance consideration in mind.
Warning:
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 JavaBeansTM
has been added to the java.beans package.
Please see XMLEncoder.
- See Also:
- JTable
Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, |