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
accessibleContextproperty.
Constructor
This class has only one constructor.
- public CellRendererPane()
This constructor creates a new renderer pane that has a
nulllayout and is not initially ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access