< prev index next >

src/java.desktop/share/classes/javax/swing/JTree.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  27 import java.awt.*;
  28 import java.awt.event.*;
  29 import java.beans.JavaBean;
  30 import java.beans.BeanProperty;
  31 import java.beans.ConstructorProperties;
  32 import java.beans.PropertyChangeEvent;
  33 import java.beans.PropertyChangeListener;
  34 import java.io.*;
  35 import java.util.*;
  36 import javax.swing.event.*;
  37 import javax.swing.plaf.*;
  38 import javax.swing.tree.*;
  39 import javax.swing.text.Position;
  40 import javax.accessibility.*;
  41 
  42 import sun.swing.SwingUtilities2;
  43 import sun.swing.SwingUtilities2.Section;
  44 import static sun.swing.SwingUtilities2.Section.*;
  45 
  46 /**
  47  * <a name="jtree_description"></a>
  48  * A control that displays a set of hierarchical data as an outline.
  49  * You can find task-oriented documentation and examples of using trees in
  50  * <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Trees</a>,
  51  * a section in <em>The Java Tutorial.</em>
  52  * <p>
  53  * A specific node in a tree can be identified either by a
  54  * <code>TreePath</code> (an object
  55  * that encapsulates a node and all of its ancestors), or by its
  56  * display row, where each row in the display area displays one node.
  57  * An <i>expanded</i> node is a non-leaf node (as identified by
  58  * <code>TreeModel.isLeaf(node)</code> returning false) that will displays
  59  * its children when all its ancestors are <i>expanded</i>.
  60  * A <i>collapsed</i>
  61  * node is one which hides them. A <i>hidden</i> node is one which is
  62  * under a collapsed ancestor. All of a <i>viewable</i> nodes parents
  63  * are expanded, but may or may not be displayed. A <i>displayed</i> node
  64  * is both viewable and in the display area, where it can be seen.
  65  * </p>
  66  * The following <code>JTree</code> methods use "visible" to mean "displayed":
  67  * <ul>


   1 /*
   2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  27 import java.awt.*;
  28 import java.awt.event.*;
  29 import java.beans.JavaBean;
  30 import java.beans.BeanProperty;
  31 import java.beans.ConstructorProperties;
  32 import java.beans.PropertyChangeEvent;
  33 import java.beans.PropertyChangeListener;
  34 import java.io.*;
  35 import java.util.*;
  36 import javax.swing.event.*;
  37 import javax.swing.plaf.*;
  38 import javax.swing.tree.*;
  39 import javax.swing.text.Position;
  40 import javax.accessibility.*;
  41 
  42 import sun.swing.SwingUtilities2;
  43 import sun.swing.SwingUtilities2.Section;
  44 import static sun.swing.SwingUtilities2.Section.*;
  45 
  46 /**
  47  * <a id="jtree_description"></a>
  48  * A control that displays a set of hierarchical data as an outline.
  49  * You can find task-oriented documentation and examples of using trees in
  50  * <a href="http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Trees</a>,
  51  * a section in <em>The Java Tutorial.</em>
  52  * <p>
  53  * A specific node in a tree can be identified either by a
  54  * <code>TreePath</code> (an object
  55  * that encapsulates a node and all of its ancestors), or by its
  56  * display row, where each row in the display area displays one node.
  57  * An <i>expanded</i> node is a non-leaf node (as identified by
  58  * <code>TreeModel.isLeaf(node)</code> returning false) that will displays
  59  * its children when all its ancestors are <i>expanded</i>.
  60  * A <i>collapsed</i>
  61  * node is one which hides them. A <i>hidden</i> node is one which is
  62  * under a collapsed ancestor. All of a <i>viewable</i> nodes parents
  63  * are expanded, but may or may not be displayed. A <i>displayed</i> node
  64  * is both viewable and in the display area, where it can be seen.
  65  * </p>
  66  * The following <code>JTree</code> methods use "visible" to mean "displayed":
  67  * <ul>


< prev index next >