1. /*
  2. * @(#)MutableTreeNode.java 1.8 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. /**
  12. * Defines the requirements for a tree node object that can change --
  13. * by adding or removing child nodes, or by changing the contents
  14. * of a user object stored in the node.
  15. *
  16. * @see DefaultMutableTreeNode
  17. * @see javax.swing.JTree
  18. *
  19. * @version 1.8 02/02/00
  20. * @author Rob Davis
  21. * @author Scott Violet
  22. */
  23. public interface MutableTreeNode extends TreeNode
  24. {
  25. /**
  26. * Adds <code>child</code> to the receiver at <code>index</code>.
  27. * <code>child</code> will be messaged with <code>setParent</code>.
  28. */
  29. void insert(MutableTreeNode child, int index);
  30. /**
  31. * Removes the child at <code>index</code> from the receiver.
  32. */
  33. void remove(int index);
  34. /**
  35. * Removes <code>node</code> from the receiver. <code>setParent</code>
  36. * will be messaged on <code>node</code>.
  37. */
  38. void remove(MutableTreeNode node);
  39. /**
  40. * Resets the user object of the receiver to <code>object</code>.
  41. */
  42. void setUserObject(Object object);
  43. /**
  44. * Removes the receiver from its parent.
  45. */
  46. void removeFromParent();
  47. /**
  48. * Sets the parent of the receiver to <code>newParent</code>.
  49. */
  50. void setParent(MutableTreeNode newParent);
  51. }