01: /*
02: * $RCSfile: NodeTreeCellRenderer.java,v $
03: * @modification $Date: 2001/09/28 19:41:42 $
04: * @version $Id: NodeTreeCellRenderer.java,v 1.1 2001/09/28 19:41:42 hfalk Exp $
05: *
06: */
07:
08: package com.memoire.vainstall.builder.util;
09:
10: import java.awt.*;
11: import javax.swing.*;
12: import javax.swing.tree.*;
13:
14: /**
15: * This is
16: *
17: * @see
18: *
19: * @author Henrik Falk
20: * @version $Id: NodeTreeCellRenderer.java,v 1.1 2001/09/28 19:41:42 hfalk Exp $
21: */
22: public class NodeTreeCellRenderer extends DefaultTreeCellRenderer {
23:
24: public NodeTreeCellRenderer() {
25: super ();
26: }
27:
28: public Component getTreeCellRendererComponent(JTree tree,
29: Object value, boolean selected, boolean expanded,
30: boolean leaf, int row, boolean hasFocus) {
31: Component c = super .getTreeCellRendererComponent(tree, value,
32: selected, expanded, leaf, row, hasFocus);
33:
34: if (leaf == true && c instanceof JLabel) {
35: // Object obj=((DefaultMutableTreeNode)value).getUserObject();
36:
37: if (value instanceof VAINodeInterface) {
38: ((JLabel) c).setToolTipText(((VAINodeInterface) value)
39: .getName());
40: ((JLabel) c).setText(((VAINodeInterface) value)
41: .getName());
42: setIcon(((VAINodeInterface) value).getIcon());
43: }
44: }
45:
46: if (leaf == false && c instanceof JLabel) {
47: if (value instanceof VAINodeInterface) {
48: ((JLabel) c).setToolTipText(null);
49: ((JLabel) c).setText(((VAINodeInterface) value)
50: .getName());
51: setIcon(((VAINodeInterface) value).getIcon());
52: }
53: }
54:
55: return this;
56: }
57:
58: }
|