1. /*
  2. * @(#)TreeExpansionEvent.java 1.20 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.event;
  8. import java.util.EventObject;
  9. import javax.swing.tree.TreePath;
  10. /**
  11. * An event used to identify a single path in a tree. The source
  12. * returned by <b>getSource</b> will be an instance of JTree.
  13. * <p>
  14. * For further documentation and examples see
  15. * the following sections in <em>The Java Tutorial</em>:
  16. * <a href="http://java.sun.com/docs/books/tutorial/uiswing/events/treeexpansionlistener.html">How to Write a Tree Expansion Listener</a> and
  17. * <a href="http://java.sun.com/docs/books/tutorial/uiswing/events/treewillexpandlistener.html">How to Write a Tree-Will-Expand Listener</a>.
  18. * <p>
  19. * <strong>Warning:</strong>
  20. * Serialized objects of this class will not be compatible with
  21. * future Swing releases. The current serialization support is
  22. * appropriate for short term storage or RMI between applications running
  23. * the same version of Swing. As of 1.4, support for long term storage
  24. * of all JavaBeans<sup><font size="-2">TM</font></sup>
  25. * has been added to the <code>java.beans</code> package.
  26. * Please see {@link java.beans.XMLEncoder}.
  27. *
  28. * @author Scott Violet
  29. * @version 1.20 12/19/03
  30. */
  31. public class TreeExpansionEvent extends EventObject
  32. {
  33. /**
  34. * Path to the value this event represents.
  35. */
  36. protected TreePath path;
  37. /**
  38. * Constructs a TreeExpansionEvent object.
  39. *
  40. * @param source the Object that originated the event
  41. * (typically <code>this</code>)
  42. * @param path a TreePath object identifying the newly expanded
  43. * node
  44. */
  45. public TreeExpansionEvent(Object source, TreePath path) {
  46. super(source);
  47. this.path = path;
  48. }
  49. /**
  50. * Returns the path to the value that has been expanded/collapsed.
  51. */
  52. public TreePath getPath() { return path; }
  53. }