KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > admin > common > XTreeCellRenderer


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.admin.common;
5
6 import org.dijon.DefaultTreeCellRenderer;
7
8 import java.awt.Component JavaDoc;
9
10 import javax.swing.JTree JavaDoc;
11
12 public class XTreeCellRenderer extends DefaultTreeCellRenderer {
13   public Component JavaDoc getTreeCellRendererComponent(JTree JavaDoc tree, Object JavaDoc value, boolean sel,
14                                                 boolean expanded, boolean leaf, int row,
15                                                 boolean focused)
16   {
17     Component JavaDoc comp =
18       super.getTreeCellRendererComponent(
19         tree, value, sel, expanded, leaf, row, focused);
20
21     if(value instanceof XTreeNode) {
22       setIcon(((XTreeNode)value).getIcon());
23     }
24
25     return comp;
26   }
27 }
28
Popular Tags