1. /*
  2. * @(#)TreeCellRenderer.java 1.16 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.swing.tree;
  11. import java.awt.Component;
  12. import javax.swing.JTree;
  13. /**
  14. * Defines the requirements for an object that displays a tree node.
  15. * See <a
  16. href="http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html">How to Use Trees</a>
  17. * in <em>The Java Tutorial</em>
  18. * for an example of implementing a tree cell renderer
  19. * that displays custom icons.
  20. *
  21. * @version 1.16 02/02/00
  22. * @author Rob Davis
  23. * @author Ray Ryan
  24. * @author Scott Violet
  25. */
  26. public interface TreeCellRenderer {
  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 anf if <code>hasFocus</code> is true the node currently has
  33. * focus. <code>tree</code> is the JTree the receiver is being
  34. * configured for.
  35. * Returns the Component that the renderer uses to draw the value.
  36. *
  37. * @return Component 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. }