|
JavaTM 2 Platform Std. Ed. v1.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.CellRendererPane
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);
A renderer component must override isShowing() and unconditionally return true to work correctly because the Swing paint does nothing for components with isShowing false.
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. A future release of Swing will provide support for long term persistence.
Inner Class Summary | |
protected class |
CellRendererPane.AccessibleCellRendererPane
This class implements accessibility support for the CellRendererPane class. |
Inner classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent |
Field Summary | |
protected AccessibleContext |
accessibleContext
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
CellRendererPane()
Construct a CellRendererPane object. |
Method Summary | |
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).< |
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this CellRendererPane. |
void |
invalidate()
Overridden to avoid propogating a invalidate up the tree when the cell renderer child is configured. |
void |
paint(Graphics g)
Shouldn't be called. |
void |
paintComponent(Graphics g,
Component c,
Container p,
int x,
int y,
int w,
int h)
Calls this.paintComponent(g, c, p, x, y, w, h, false). |
void |
paintComponent(Graphics g,
Component c,
Container p,
int x,
int y,
int w,
int h,
boolean shouldValidate)
Paint a cell renderer component c on graphics object g. |
void |
paintComponent(Graphics g,
Component c,
Container p,
Rectangle r)
Calls this.paintComponent() with the rectangles x,y,width,height fields. |
void |
update(Graphics g)
Shouldn't be called. |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addNotify, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, validate, validateTree |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected AccessibleContext accessibleContext
Constructor Detail |
public CellRendererPane()
Method Detail |
public void invalidate()
invalidate
in class Container
java.awt.Container
Container.validate()
,
Container.layout()
,
LayoutManager
public void paint(Graphics g)
paint
in class Container
java.awt.Container
g
- the specified Graphics windowComponent.update(java.awt.Graphics)
public void update(Graphics g)
update
in class Container
java.awt.Container
g
- the specified Graphics windowComponent.update(java.awt.Graphics)
protected void addImpl(Component x, Object constraints, int index)
addImpl
in class Container
java.awt.Container
comp
- the component to be added.constraints
- an object expressing layout contraints
for this component.index
- the position in the container's list at which to
insert the component, where -1
means insert at the end.Container.add(java.awt.Component)
,
Container.add(java.awt.Component, int)
,
Container.add(java.awt.Component, java.lang.Object)
,
LayoutManager
public void paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h, boolean shouldValidate)
public void paintComponent(Graphics g, Component c, Container p, int x, int y, int w, int h)
public void paintComponent(Graphics g, Component c, Container p, Rectangle r)
public AccessibleContext getAccessibleContext()
getAccessibleContext
in interface Accessible
getAccessibleContext
in class Component
|
JavaTM 2 Platform Std. Ed. v1.3 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.