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