1 package org.oddjob.monitor.view; 2 3 import java.awt.Component ; 4 5 import javax.swing.ImageIcon ; 6 import javax.swing.JTree ; 7 import javax.swing.tree.DefaultTreeCellRenderer ; 8 9 import org.oddjob.images.IconTip; 10 import org.oddjob.monitor.model.JobTreeNode; 11 12 17 18 public class JobTreeCellRenderer extends DefaultTreeCellRenderer { 19 20 21 24 25 public Component getTreeCellRendererComponent( 26 JTree tree, 27 Object value, 28 boolean sel, 29 boolean expanded, 30 boolean leaf, 31 int row, 32 boolean hasFocus) { 33 34 super.getTreeCellRendererComponent( 35 tree, value, sel, 36 expanded, leaf, row, 37 hasFocus); 38 39 JobTreeNode node = (JobTreeNode)value; 40 41 IconTip iconTip = node.getIcon(); 42 if (iconTip != null) { 43 setIcon(new ImageIcon (iconTip.getImageData())); 44 setToolTipText(iconTip.getToolTip()); 45 } 46 return this; 47 } 48 49 } 50 | Popular Tags |