0N/A/*
2362N/A * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/Apackage javax.swing.tree;
0N/A
0N/Aimport java.awt.Component;
0N/Aimport javax.swing.JTree;
0N/A
0N/A/**
0N/A * Defines the requirements for an object that displays a tree node.
0N/A * See <a
0N/A href="http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html">How to Use Trees</a>
0N/A * in <em>The Java Tutorial</em>
0N/A * for an example of implementing a tree cell renderer
0N/A * that displays custom icons.
0N/A *
0N/A * @author Rob Davis
0N/A * @author Ray Ryan
0N/A * @author Scott Violet
0N/A */
0N/Apublic interface TreeCellRenderer {
0N/A
0N/A /**
0N/A * Sets the value of the current tree cell to <code>value</code>.
0N/A * If <code>selected</code> is true, the cell will be drawn as if
0N/A * selected. If <code>expanded</code> is true the node is currently
0N/A * expanded and if <code>leaf</code> is true the node represents a
0N/A * leaf and if <code>hasFocus</code> is true the node currently has
0N/A * focus. <code>tree</code> is the <code>JTree</code> the receiver is being
0N/A * configured for. Returns the <code>Component</code> that the renderer
0N/A * uses to draw the value.
0N/A * <p>
0N/A * The <code>TreeCellRenderer</code> is also responsible for rendering the
0N/A * the cell representing the tree's current DnD drop location if
0N/A * it has one. If this renderer cares about rendering
0N/A * the DnD drop location, it should query the tree directly to
0N/A * see if the given row represents the drop location:
0N/A * <pre>
0N/A * JTree.DropLocation dropLocation = tree.getDropLocation();
0N/A * if (dropLocation != null
0N/A * && dropLocation.getChildIndex() == -1
0N/A * && tree.getRowForPath(dropLocation.getPath()) == row) {
0N/A *
0N/A * // this row represents the current drop location
0N/A * // so render it specially, perhaps with a different color
0N/A * }
0N/A * </pre>
0N/A *
0N/A * @return the <code>Component</code> that the renderer uses to draw the value
0N/A */
0N/A Component getTreeCellRendererComponent(JTree tree, Object value,
0N/A boolean selected, boolean expanded,
0N/A boolean leaf, int row, boolean hasFocus);
0N/A
0N/A}