1 /* 2 * @(#)TreeCellRenderer.java 1.20 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 package javax.swing.tree; 8 9 import java.awt.Component; 10 import javax.swing.JTree; 11 12 /** 13 * Defines the requirements for an object that displays a tree node. 14 * See <a 15 href="http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html">How to Use Trees</a> 16 * in <em>The Java Tutorial</em> 17 * for an example of implementing a tree cell renderer 18 * that displays custom icons. 19 * 20 * @version 1.20 12/19/03 21 * @author Rob Davis 22 * @author Ray Ryan 23 * @author Scott Violet 24 */ 25 public interface TreeCellRenderer { 26 27 /** 28 * Sets the value of the current tree cell to <code>value</code>. 29 * If <code>selected</code> is true, the cell will be drawn as if 30 * selected. If <code>expanded</code> is true the node is currently 31 * expanded and if <code>leaf</code> is true the node represets a 32 * leaf and if <code>hasFocus</code> is true the node currently has 33 * focus. <code>tree</code> is the <code>JTree</code> the receiver is being 34 * configured for. Returns the <code>Component</code> that the renderer 35 * uses to draw the value. 36 * 37 * @return the <code>Component</code> that the renderer uses to draw the value 38 */ 39 Component getTreeCellRendererComponent(JTree tree, Object value, 40 boolean selected, boolean expanded, 41 boolean leaf, int row, boolean hasFocus); 42 43 } 44