57 * Subclasses typically need override only {@code
58 * getLastPathComponent}, and {@code getParentPath}. As {@code JTree}
59 * internally creates {@code TreePath}s at various points, it's
60 * generally not useful to subclass {@code TreePath} and use with
61 * {@code JTree}.
62 * <p>
63 * While {@code TreePath} is serializable, a {@code
64 * NotSerializableException} is thrown if any elements of the path are
65 * not serializable.
66 * <p>
67 * For further information and examples of using tree paths,
68 * see <a
69 href="https://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Trees</a>
70 * in <em>The Java Tutorial.</em>
71 * <p>
72 * <strong>Warning:</strong>
73 * Serialized objects of this class will not be compatible with
74 * future Swing releases. The current serialization support is
75 * appropriate for short term storage or RMI between applications running
76 * the same version of Swing. As of 1.4, support for long term storage
77 * of all JavaBeans™
78 * has been added to the <code>java.beans</code> package.
79 * Please see {@link java.beans.XMLEncoder}.
80 *
81 * @author Scott Violet
82 * @author Philip Milne
83 */
84 @SuppressWarnings("serial") // Same-version serialization only
85 public class TreePath implements Serializable {
86 /** Path representing the parent, null if lastPathComponent represents
87 * the root. */
88 private TreePath parentPath;
89 /** Last path component. */
90 private Object lastPathComponent;
91
92 /**
93 * Creates a {@code TreePath} from an array. The array uniquely
94 * identifies the path to a node.
95 *
96 * @param path an array of objects representing the path to a node
97 * @throws IllegalArgumentException if {@code path} is {@code null},
|
57 * Subclasses typically need override only {@code
58 * getLastPathComponent}, and {@code getParentPath}. As {@code JTree}
59 * internally creates {@code TreePath}s at various points, it's
60 * generally not useful to subclass {@code TreePath} and use with
61 * {@code JTree}.
62 * <p>
63 * While {@code TreePath} is serializable, a {@code
64 * NotSerializableException} is thrown if any elements of the path are
65 * not serializable.
66 * <p>
67 * For further information and examples of using tree paths,
68 * see <a
69 href="https://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Trees</a>
70 * in <em>The Java Tutorial.</em>
71 * <p>
72 * <strong>Warning:</strong>
73 * Serialized objects of this class will not be compatible with
74 * future Swing releases. The current serialization support is
75 * appropriate for short term storage or RMI between applications running
76 * the same version of Swing. As of 1.4, support for long term storage
77 * of all JavaBeans
78 * has been added to the <code>java.beans</code> package.
79 * Please see {@link java.beans.XMLEncoder}.
80 *
81 * @author Scott Violet
82 * @author Philip Milne
83 */
84 @SuppressWarnings("serial") // Same-version serialization only
85 public class TreePath implements Serializable {
86 /** Path representing the parent, null if lastPathComponent represents
87 * the root. */
88 private TreePath parentPath;
89 /** Last path component. */
90 private Object lastPathComponent;
91
92 /**
93 * Creates a {@code TreePath} from an array. The array uniquely
94 * identifies the path to a node.
95 *
96 * @param path an array of objects representing the path to a node
97 * @throws IllegalArgumentException if {@code path} is {@code null},
|