1. /*
  2. * @(#)TreeNode.java 1.20 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.util.Enumeration;
  9. /**
  10. * Defines the requirements for an object that can be used as a
  11. * tree node in a JTree.
  12. *
  13. * <p>
  14. *
  15. * For further information and examples of using tree nodes,
  16. * see <a
  17. href="http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html">How to Use Tree Nodes</a>
  18. * in <em>The Java Tutorial.</em>
  19. *
  20. * @version 1.20 01/23/03
  21. * @author Rob Davis
  22. * @author Scott Violet
  23. */
  24. public interface TreeNode
  25. {
  26. /**
  27. * Returns the child <code>TreeNode</code> at index
  28. * <code>childIndex</code>.
  29. */
  30. TreeNode getChildAt(int childIndex);
  31. /**
  32. * Returns the number of children <code>TreeNode</code>s the receiver
  33. * contains.
  34. */
  35. int getChildCount();
  36. /**
  37. * Returns the parent <code>TreeNode</code> of the receiver.
  38. */
  39. TreeNode getParent();
  40. /**
  41. * Returns the index of <code>node</code> in the receivers children.
  42. * If the receiver does not contain <code>node</code>, -1 will be
  43. * returned.
  44. */
  45. int getIndex(TreeNode node);
  46. /**
  47. * Returns true if the receiver allows children.
  48. */
  49. boolean getAllowsChildren();
  50. /**
  51. * Returns true if the receiver is a leaf.
  52. */
  53. boolean isLeaf();
  54. /**
  55. * Returns the children of the receiver as an <code>Enumeration</code>.
  56. */
  57. Enumeration children();
  58. }