edu.rice.cs.plt.swing
Class ShadedTreeCellRenderer
java.lang.Object
edu.rice.cs.plt.swing.ShadedTreeCellRenderer
- All Implemented Interfaces:
- TreeCellRenderer
public class ShadedTreeCellRenderer
- extends Object
- implements TreeCellRenderer
A tree cell renderer that sets the backgrounds of cells to alternating colors.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ShadedTreeCellRenderer
public ShadedTreeCellRenderer(TreeCellRenderer renderer,
Color even,
Color odd)
- Parameters:
renderer - A renderer to provide the contents of each cell. For the shading
to be visible, the returned components must honor their backgroud
color setting, and must not be obscured by opaque child components.even - Color to shade the first (at index 0) row and each subsequent even row.odd - Color to shade the second (at index 1) row and each subsequent odd row.
getTreeCellRendererComponent
public Component getTreeCellRendererComponent(JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus)
- Specified by:
getTreeCellRendererComponent in interface TreeCellRenderer
shadeTree
public static void shadeTree(JTree tree,
Color even,
Color odd)
- Wrap the given tree's cell renderer in a
ShadedTreeCellRenderer using the given
colors.