All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.CellRendererPane
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----com.sun.java.swing.CellRendererPane
- public class CellRendererPane
- extends Container
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();
renderer.configureListCellRenderer(dataModel.getElementAt(row), row);
cellRendererPane.paintComponent(g, rendererComponent, this, x, y, w, h);
-
CellRendererPane()
-
-
addImpl(Component, Object, int)
-
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).<
-
invalidate()
-
Overridden to avoid propogating a invalidate up the tree when the
cell renderer child is configured.
-
paint(Graphics)
-
Shouldn't be called.
-
paintComponent(Graphics, Component, Container, int, int, int, int)
-
Paint a cell renderer component c on graphics object g.
-
paintComponent(Graphics, Component, Container, Rectangle)
- Calls this.paintComponent() with the rectangles x,y,width,height fields.
-
repaint(long, int, int, int, int)
-
Overridden to avoid propogating a repaint up the tree when the
cell renderer child is configured.
-
update(Graphics)
- Shouldn't be called.
CellRendererPane
public CellRendererPane()
repaint
public void repaint(long tm,
int x,
int y,
int width,
int height)
- Overridden to avoid propogating a repaint up the tree when the
cell renderer child is configured.
- Overrides:
- repaint in class Component
invalidate
public void invalidate()
- Overridden to avoid propogating a invalidate up the tree when the
cell renderer child is configured.
- Overrides:
- invalidate in class Container
paint
public void paint(Graphics g)
- Shouldn't be called.
- Overrides:
- paint in class Container
update
public void update(Graphics g)
- Shouldn't be called.
- Overrides:
- update in class Container
addImpl
protected void addImpl(Component x,
Object constraints,
int index)
- 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).<
- Overrides:
- addImpl in class Container
paintComponent
public void paintComponent(Graphics g,
Component c,
Container p,
int x,
int y,
int w,
int h)
- 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,y
and the graphics object is (effectively) translated to x,y. 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().
paintComponent
public void paintComponent(Graphics g,
Component c,
Container p,
Rectangle r)
- Calls this.paintComponent() with the rectangles x,y,width,height fields.
All Packages Class Hierarchy This Package Previous Next Index