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
implements Accessible
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);
 


Variable Index

 o accessibleDescription
 o accessibleName

Constructor Index

 o CellRendererPane()

Method Index

 o addAccessibleSelection(int)
Adds the nth selected item in the object to the object's selection.
 o 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).<
 o clearAccessibleSelection()
Clears the selection in the object, so that nothing in the object is selected.
 o doAccessibleAction(int)
Perform the nth Action on the object
 o getAccessibleActionCount()
Returns the number of Actions available in this object If there is more than one, the first one is the "default" action (if any action is considered "default").
 o getAccessibleActionDescription(int)
Return a description of the nth action of the object.
 o getAccessibleAt(Point)
Returns the Accessible child contained at the local coordinate Point, if one exists.
 o getAccessibleChild(int)
Return the nth Accessible child of the object.
 o getAccessibleChildrenCount()
Returns the number of accessible children in the object.
 o getAccessibleDescription()
Get the accessible description of this object.
 o getAccessibleName()
Get the accessible name of this object.
 o getAccessibleParent()
Get the Accessible parent of this object.
 o getAccessibleRole()
Get the role of this object.
 o getAccessibleSelection(int)
Returns an Accessible representing the nth selected item in the object.
 o getAccessibleSelectionCount()
Returns the number of items currently selected.
 o getAccessibleStateSet()
Get the state of this object.
 o getAccessibleText()
Gets the AccessibleText interface for the component.
 o getAccessibleValue()
Get the value of this object as a String.
 o getNextAccessibleSibling()
Get the next sibling of this Accessible, if a preferred one exists.
 o getPreviousAccessibleSibling()
Get the previous sibling of this Accessible, if a preferred one exists.
 o invalidate()
Overridden to avoid propogating a invalidate up the tree when the cell renderer child is configured.
 o paint(Graphics)
Shouldn't be called.
 o paintComponent(Graphics, Component, Container, int, int, int, int)
Invokes paintComponent(g, c, p, x, y, w, h, false).
 o paintComponent(Graphics, Component, Container, int, int, int, int, boolean)
Paint a cell renderer component c on graphics object g.
 o paintComponent(Graphics, Component, Container, Rectangle)
Calls this.paintComponent() with the rectangles x,y,width,height fields.
 o removeAccessibleSelection(int)
Removes the nth selected item in the object from the object's selection.
 o repaint(long, int, int, int, int)
Overridden to avoid propogating a repaint up the tree when the cell renderer child is configured.
 o selectAllAccessibleSelection()
Causes every selected item in the object to be selected, if the object supports multiple selections (if getAccessibleStateSet returns a state that is MULTISELECTABLE).
 o setAccessibleDescription(String)
Set the accessible description of this object.
 o setAccessibleName(String)
Set the localized accessible name of this object.
 o update(Graphics)
Shouldn't be called.

Variables

 o accessibleName
 protected String accessibleName
 o accessibleDescription
 protected String accessibleDescription

Constructors

 o CellRendererPane
 public CellRendererPane()

Methods

 o 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
 o 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
 o paint
 public void paint(Graphics g)
Shouldn't be called.

Overrides:
paint in class Container
 o update
 public void update(Graphics g)
Shouldn't be called.

Overrides:
update in class Container
 o 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
 o paintComponent
 public 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. 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(). If shouldValidate is true the component c will be validated before painted.

 o paintComponent
 public void paintComponent(Graphics g,
                            Component c,
                            Container p,
                            int x,
                            int y,
                            int w,
                            int h)
Invokes paintComponent(g, c, p, x, y, w, h, false).

 o paintComponent
 public void paintComponent(Graphics g,
                            Component c,
                            Container p,
                            Rectangle r)
Calls this.paintComponent() with the rectangles x,y,width,height fields.

 o getNextAccessibleSibling
 public Accessible getNextAccessibleSibling()
Get the next sibling of this Accessible, if a preferred one exists. This should generally return the next item in the tab order, if that item implements Accessible

Returns:
the next Accessible, if there is one
 o getPreviousAccessibleSibling
 public Accessible getPreviousAccessibleSibling()
Get the previous sibling of this Accessible, if a preferred one exists. This should generally return the previous item in the tab order, if that item implements Accessible

Returns:
the previous Accessible, if there is one
 o getAccessibleAt
 public Accessible getAccessibleAt(Point p)
Returns the Accessible child contained at the local coordinate Point, if one exists.

Returns:
the Accessible at the specified location, if it exists
 o getAccessibleName
 public String getAccessibleName()
Get the accessible name of this object. This should almost never return java.awt.Component.getName(), as that generally isn't a localized name, and doesn't have meaning for the user. If the object is fundamentally a text object (e.g. a menu item), the accessible name should be the text of the object (e.g. "save"). If the object has a tooltip, the tooltip text may also be an appropriate String to return.

Returns:
the localized name of the object -- can be null if this object does not have a name
See Also:
setAccessibleName
 o setAccessibleName
 public void setAccessibleName(String s)
Set the localized accessible name of this object.

Parameters:
s - the new localized name of the object.
See Also:
getAccessibleName
 o getAccessibleDescription
 public String getAccessibleDescription()
Get the accessible description of this object. This should be a concise, localized description of what this object is - what is it's meaning to the user. If the object has a tooltip, the tooltip text may be an appropriate string to return, assuming it contains a concise description of the object (instead of just the name of the object - e.g. a "Save" icon on a toolbar that had "save" as the tooltip text shouldn't return the tooltip text as the description, but something like "Saves the current text document" instead).

Returns:
the localized description of the object -- can be null if this object does not have a description
See Also:
setAccessibleDescription
 o setAccessibleDescription
 public void setAccessibleDescription(String s)
Set the accessible description of this object.

Parameters:
s - the new localized description of the object
See Also:
getAccessibleDescription
 o getAccessibleStateSet
 public AccessibleStateSet getAccessibleStateSet()
Get the state of this object.

Returns:
an instance of AccessibleStateSet containing the current state set of the object
See Also:
AccessibleState
 o getAccessibleRole
 public AccessibleRole getAccessibleRole()
Get the role of this object.

Returns:
an instance of AccessibleRole describing the role of the object
See Also:
AccessibleRole
 o getAccessibleValue
 public String getAccessibleValue()
Get the value of this object as a String. This should almost never return java.Object.toString(), as that is not a localized, human readable representation of the value of the object.

Returns:
human readable value of the object -- can be null if this object does not have a value
 o getAccessibleParent
 public Accessible getAccessibleParent()
Get the Accessible parent of this object. If the parent of this object implements Accessible, this method should simply return getParent().

Returns:
the Accessible parent of this object -- can be null if this object does not have an Accessible parent
 o getAccessibleChildrenCount
 public int getAccessibleChildrenCount()
Returns the number of accessible children in the object. If all of the children of this object implement Accessible, than this method should return the number of children of this object.

Returns:
the number of accessible children in the object.
 o getAccessibleChild
 public Accessible getAccessibleChild(int i)
Return the nth Accessible child of the object.

Parameters:
i - zero-based index of child
Returns:
the nth Accessible child of the object
 o getAccessibleActionCount
 public int getAccessibleActionCount()
Returns the number of Actions available in this object If there is more than one, the first one is the "default" action (if any action is considered "default").

Returns:
the number of Actions in this object
 o getAccessibleActionDescription
 public String getAccessibleActionDescription(int i)
Return a description of the nth action of the object. This description should be human-readable; by default it currently isn't...

Parameters:
i - zero-based index of the actions
Returns:
a description of the nth action
 o doAccessibleAction
 public boolean doAccessibleAction(int i)
Perform the nth Action on the object

Parameters:
i - zero-based index of actions
Returns:
whether the action was performed or not.
 o getAccessibleText
 public AccessibleText getAccessibleText()
Gets the AccessibleText interface for the component. If the component does not speak AccessibleText, or have a proxy which does, this method returns null.

Returns:
the AccessibleText of the object.
See Also:
AccessibleText
 o getAccessibleSelectionCount
 public int getAccessibleSelectionCount()
Returns the number of items currently selected. If no items are selected, the return value will be 0.

Returns:
the number of items currently selected.
 o getAccessibleSelection
 public Accessible getAccessibleSelection(int i)
Returns an Accessible representing the nth selected item in the object. If there isn't a selection, or there are fewer items selcted than the integer passed in, the return value will be null.

Parameters:
i - the zero-based index of selected items
Returns:
an Accessible containing the selected item
 o addAccessibleSelection
 public void addAccessibleSelection(int i)
Adds the nth selected item in the object to the object's selection. If the object supports multiple selections, (the method getAccessibleStateSet returns a state that is MULTISELECTABLE) the nth item is added to any existing selection, otherwse it replaces any existing selection in the objct. If the nth item is already selected, this method has no effect.

Parameters:
i - the zero-based index of selectable items
See Also:
getAccessibleStateSet
 o removeAccessibleSelection
 public void removeAccessibleSelection(int i)
Removes the nth selected item in the object from the object's selection. If the nth item isn't currently selected, this method has no effect.

Parameters:
i - the zero-based index of selectable items
 o clearAccessibleSelection
 public void clearAccessibleSelection()
Clears the selection in the object, so that nothing in the object is selected.

 o selectAllAccessibleSelection
 public void selectAllAccessibleSelection()
Causes every selected item in the object to be selected, if the object supports multiple selections (if getAccessibleStateSet returns a state that is MULTISELECTABLE).

See Also:
getAccessibleStateSet

All Packages  Class Hierarchy  This Package  Previous  Next  Index