1 19 20 package org.apache.excalibur.instrument.client; 21 22 import java.awt.Component ; 23 24 import javax.swing.JTree ; 25 import javax.swing.tree.DefaultMutableTreeNode ; 26 import javax.swing.tree.DefaultTreeCellRenderer ; 27 28 31 class InstrumentManagerTreeCellRenderer 32 extends DefaultTreeCellRenderer 33 { 34 37 InstrumentManagerTreeCellRenderer() 38 { 39 } 40 41 44 public Component getTreeCellRendererComponent( JTree tree, 45 Object value, 46 boolean sel, 47 boolean expanded, 48 boolean leaf, 49 int row, 50 boolean hasFocus) 51 { 52 super.getTreeCellRendererComponent( tree, value, sel, expanded, leaf, row, hasFocus ); 53 54 60 if ( value instanceof DefaultMutableTreeNode ) 61 { 62 DefaultMutableTreeNode treeNode = (DefaultMutableTreeNode )value; 63 Object userObject = treeNode.getUserObject(); 64 65 if ( userObject instanceof NodeData ) 66 { 67 NodeData nodeData = (NodeData)userObject; 68 setIcon( nodeData.getIcon() ); 69 setToolTipText( nodeData.getToolTipText() ); 70 } 71 } 72 73 return this; 74 } 75 76 79 } 80 | Popular Tags |