src/share/classes/javax/swing/tree/TreeCellRenderer.java

Print this page




  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
  23  * questions.
  24  */
  25 package javax.swing.tree;
  26 
  27 import java.awt.Component;
  28 import javax.swing.JTree;
  29 
  30 /**
  31  * Defines the requirements for an object that displays a tree node.
  32  * See <a
  33  href="http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html">How to Use Trees</a>
  34  * in <em>The Java Tutorial</em>
  35  * for an example of implementing a tree cell renderer
  36  * that displays custom icons.
  37  *
  38  * @author Rob Davis
  39  * @author Ray Ryan
  40  * @author Scott Violet
  41  */
  42 public interface TreeCellRenderer {
  43 
  44     /**
  45      * Sets the value of the current tree cell to <code>value</code>.
  46      * If <code>selected</code> is true, the cell will be drawn as if
  47      * selected. If <code>expanded</code> is true the node is currently
  48      * expanded and if <code>leaf</code> is true the node represents a
  49      * leaf and if <code>hasFocus</code> is true the node currently has
  50      * focus. <code>tree</code> is the <code>JTree</code> the receiver is being
  51      * configured for.  Returns the <code>Component</code> that the renderer
  52      * uses to draw the value.
  53      * <p>




  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
  23  * questions.
  24  */
  25 package javax.swing.tree;
  26 
  27 import java.awt.Component;
  28 import javax.swing.JTree;
  29 
  30 /**
  31  * Defines the requirements for an object that displays a tree node.
  32  * See <a
  33  href="http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Trees</a>
  34  * in <em>The Java Tutorial</em>
  35  * for an example of implementing a tree cell renderer
  36  * that displays custom icons.
  37  *
  38  * @author Rob Davis
  39  * @author Ray Ryan
  40  * @author Scott Violet
  41  */
  42 public interface TreeCellRenderer {
  43 
  44     /**
  45      * Sets the value of the current tree cell to <code>value</code>.
  46      * If <code>selected</code> is true, the cell will be drawn as if
  47      * selected. If <code>expanded</code> is true the node is currently
  48      * expanded and if <code>leaf</code> is true the node represents a
  49      * leaf and if <code>hasFocus</code> is true the node currently has
  50      * focus. <code>tree</code> is the <code>JTree</code> the receiver is being
  51      * configured for.  Returns the <code>Component</code> that the renderer
  52      * uses to draw the value.
  53      * <p>