This class is inserted in between cell renderers and the components that
use them. It just exists to thwart the repaint() and invalidate() methods
which would otherwise propogate up the tree when the renderer was configured.
It's used by the implementations of JTable, JTree, and JList. For example,
here's how CellRendererPane is used in the code the paints each row
in a JList:
cellRendererPane = new CellRendererPane();
Component rendererComponent = renderer.getListCellRendererComponent();
cellRendererPane.paintComponent(g, rendererComponent, this, x, y, w, h);
A renderer component must override isShowing() and unconditionally return
true to work correctly because the Swing paint does nothing for components
with isShowing false.
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.
If the specified component is already a child of this then we don't
bother doing anything - stacking order doesn't matter for cell
renderer components (CellRendererPane doesn't paint anyway).<
Paint a cell renderer component c on graphics object g. Before the component
is drawn it's reparented to this (if that's neccessary), it's bounds
are set to w,h and the graphics object is (effectively) translated to x,y.
If it's a JComponent, double buffering is temporarily turned off. After
the component is painted it's bounds are reset to -w, -h, 0, 0 so that, if
it's the last renderer component painted, it will not start consuming input.
The Container p is the component we're actually drawing on, typically it's
equal to this.getParent(). If shouldValidate is true the component c will be
validated before painted.
Gets the AccessibleContext associated with this CellRendererPane.
For CellRendererPanes, the AccessibleContext takes the form of an
A new AccessibleCellRendererPane instance is created if necessary.
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 1993-2001 Sun Microsystems, Inc. 901 San Antonio Road Palo Alto, California, 94303, U.S.A. All Rights Reserved.