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