1 19 20 package org.netbeans.modules.java.navigation; 21 22 import java.awt.Component ; 23 import javax.swing.JLabel ; 24 import javax.swing.JTree ; 25 import javax.swing.tree.DefaultTreeCellRenderer ; 26 27 31 public final class JavaTreeCellRenderer extends DefaultTreeCellRenderer { 32 public Component getTreeCellRendererComponent(JTree tree, Object value, 33 boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { 34 JLabel label = (JLabel ) super.getTreeCellRendererComponent(tree, value, 35 sel, expanded, leaf, row, hasFocus); 36 37 if (!sel) { 38 setBackgroundNonSelectionColor(tree.getBackground()); 39 } 40 41 if (value instanceof JavaElement) { 42 label.setIcon(((JavaElement) value).getIcon()); 43 label.setToolTipText(((JavaElement) value).getTooltip()); 44 } 45 46 return label; 47 } 48 } 49 | Popular Tags |