Print this page
Split |
Close |
Expand all |
Collapse all |
--- old/src/share/classes/javax/swing/tree/TreeCellRenderer.java
+++ new/src/share/classes/javax/swing/tree/TreeCellRenderer.java
1 1 /*
2 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation. Oracle designates this
8 8 * particular file as subject to the "Classpath" exception as provided
9 9 * by Oracle in the LICENSE file that accompanied this code.
10 10 *
11 11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 14 * version 2 for more details (a copy is included in the LICENSE file that
15 15 * accompanied this code).
16 16 *
17 17 * You should have received a copy of the GNU General Public License version
18 18 * 2 along with this work; if not, write to the Free Software Foundation,
19 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 20 *
21 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 22 * or visit www.oracle.com if you need additional information or have any
↓ open down ↓ |
22 lines elided |
↑ open up ↑ |
23 23 * questions.
24 24 */
25 25 package javax.swing.tree;
26 26
27 27 import java.awt.Component;
28 28 import javax.swing.JTree;
29 29
30 30 /**
31 31 * Defines the requirements for an object that displays a tree node.
32 32 * See <a
33 - href="http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Trees</a>
33 + href="https://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Trees</a>
34 34 * in <em>The Java Tutorial</em>
35 35 * for an example of implementing a tree cell renderer
36 36 * that displays custom icons.
37 37 *
38 38 * @author Rob Davis
39 39 * @author Ray Ryan
40 40 * @author Scott Violet
41 41 */
42 42 public interface TreeCellRenderer {
43 43
44 44 /**
45 45 * Sets the value of the current tree cell to <code>value</code>.
46 46 * If <code>selected</code> is true, the cell will be drawn as if
47 47 * selected. If <code>expanded</code> is true the node is currently
48 48 * expanded and if <code>leaf</code> is true the node represents a
49 49 * leaf and if <code>hasFocus</code> is true the node currently has
50 50 * focus. <code>tree</code> is the <code>JTree</code> the receiver is being
51 51 * configured for. Returns the <code>Component</code> that the renderer
52 52 * uses to draw the value.
53 53 * <p>
54 54 * The <code>TreeCellRenderer</code> is also responsible for rendering the
55 55 * the cell representing the tree's current DnD drop location if
56 56 * it has one. If this renderer cares about rendering
57 57 * the DnD drop location, it should query the tree directly to
58 58 * see if the given row represents the drop location:
59 59 * <pre>
60 60 * JTree.DropLocation dropLocation = tree.getDropLocation();
61 61 * if (dropLocation != null
62 62 * && dropLocation.getChildIndex() == -1
63 63 * && tree.getRowForPath(dropLocation.getPath()) == row) {
64 64 *
65 65 * // this row represents the current drop location
66 66 * // so render it specially, perhaps with a different color
67 67 * }
68 68 * </pre>
69 69 *
70 70 * @return the <code>Component</code> that the renderer uses to draw the value
71 71 */
72 72 Component getTreeCellRendererComponent(JTree tree, Object value,
73 73 boolean selected, boolean expanded,
74 74 boolean leaf, int row, boolean hasFocus);
75 75
76 76 }
↓ open down ↓ |
33 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX