1. /*
  2. * @(#)MutableTreeNode.java 1.11 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.tree;
  8. /**
  9. * Defines the requirements for a tree node object that can change --
  10. * by adding or removing child nodes, or by changing the contents
  11. * of a user object stored in the node.
  12. *
  13. * @see DefaultMutableTreeNode
  14. * @see javax.swing.JTree
  15. *
  16. * @version 1.11 12/19/03
  17. * @author Rob Davis
  18. * @author Scott Violet
  19. */
  20. public interface MutableTreeNode extends TreeNode
  21. {
  22. /**
  23. * Adds <code>child</code> to the receiver at <code>index</code>.
  24. * <code>child</code> will be messaged with <code>setParent</code>.
  25. */
  26. void insert(MutableTreeNode child, int index);
  27. /**
  28. * Removes the child at <code>index</code> from the receiver.
  29. */
  30. void remove(int index);
  31. /**
  32. * Removes <code>node</code> from the receiver. <code>setParent</code>
  33. * will be messaged on <code>node</code>.
  34. */
  35. void remove(MutableTreeNode node);
  36. /**
  37. * Resets the user object of the receiver to <code>object</code>.
  38. */
  39. void setUserObject(Object object);
  40. /**
  41. * Removes the receiver from its parent.
  42. */
  43. void removeFromParent();
  44. /**
  45. * Sets the parent of the receiver to <code>newParent</code>.
  46. */
  47. void setParent(MutableTreeNode newParent);
  48. }