javax.swing.tree
Class DefaultTreeCellRendererjava.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JLabel | +--javax.swing.tree.DefaultTreeCellRenderer
- All Implemented Interfaces:
- Accessible, ImageObserver, MenuContainer, Serializable, SwingConstants, TreeCellRenderer
- public class DefaultTreeCellRenderer
- extends JLabel
- implements TreeCellRenderer
Displays an entry in a tree. See How to Use Trees in The Java Tutorial for examples of customizing node display using this class.
Implementation Note: This class overrides validate, revalidate, repaint, and firePropertyChange solely to improve performance. If not overridden, these frequently called methods would execute code paths that are unnecessary for the default tree cell renderer. If you write your own renderer, take care to weigh the benefits and drawbacks of overriding these methods.
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. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see XMLEncoder.
Nested Class Summary
Nested classes inherited from class javax.swing.JLabel JLabel.AccessibleJLabel
Nested classes inherited from class javax.swing.JComponent JComponent.AccessibleJComponent
Nested classes inherited from class java.awt.Container Container.AccessibleAWTContainer
Nested classes inherited from class java.awt.Component Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
Field Summary
protected Color backgroundNonSelectionColor
Color to use for the background when the node isn't selected.protected Color backgroundSelectionColor
Color to use for the background when a node is selected.protected Color borderSelectionColor
Color to use for the focus indicator when the node has focus.protected Icon closedIcon
Icon used to show non-leaf nodes that aren't expanded.protected boolean hasFocus
True if has focus.protected Icon leafIcon
Icon used to show leaf nodes.protected Icon openIcon
Icon used to show non-leaf nodes that are expanded.protected boolean selected
Is the value currently selected.protected Color textNonSelectionColor
Color to use for the foreground for non-selected nodes.protected Color textSelectionColor
Color to use for the foreground for selected nodes.
Fields inherited from class javax.swing.JLabel labelFor
Fields inherited from class javax.swing.JComponent accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT