Editing and Rendering Utilities
Both the JTree
and JTable
classes make use of cell renderers to display cells and cell editors
to modify cell values. The CellEditor
interface is
the basis for these editors, and the
DefaultCellEditor
class provides a good
implementation of this interface. Unless you’re doing something
exotic, you should be able to base your cell editors on the
DefaultCellEditor
class.
The CellRendererPane Class
This utility class
was built to keep renderers from propagating
repaint()
and validate()
calls
to the components using renderer components such as
JTree
and JList
. If you played
around with creating your own renderers for any of the Swing
components that use them, you’ll recall that you did not use
this class yourself. Normally this pane is wrapped around the
renderer and the paintComponent()
methods below
are used to do the actual drawing. Developers will not normally need
to worry about this class.
Property
The CellRendererPane
has only one property
containing its accessible context, shown in Table 27.5.
Table 27-5. CellRendererPane Property
Property |
Data Type |
get |
is |
set |
bound |
Default Value |
---|---|---|---|---|---|---|
accessibleContext |
|
• |
|
Field
- protected AccessibleContext accessibleContext
This field supports the
accessibleContext
property.
Constructor
This class has only one constructor.
- public CellRendererPane()
This constructor creates a new renderer pane that has a
null
layout and is not initially ...
Get Java Swing now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.