1 /*
2 * Copyright (c) 1998, 2013, 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
28 import javax.swing.*;
29 import javax.swing.event.*;
30 import java.awt.*;
31 import java.awt.event.*;
32 import java.beans.*;
33 import java.io.*;
34 import java.util.*;
35 import javax.swing.plaf.*;
36 import javax.swing.tree.*;
37
38 import javax.swing.plaf.basic.*;
39
40 /**
41 * The metal look and feel implementation of <code>TreeUI</code>.
42 * <p>
43 * <code>MetalTreeUI</code> allows for configuring how to
44 * visually render the spacing and delineation between nodes. The following
45 * hints are supported:
46 *
47 * <table summary="Descriptions of supported hints: Angled, Horizontal, and None">
48 * <tr>
49 * <th><p style="text-align:left">Angled</p></th>
50 * <td>A line is drawn connecting the child to the parent. For handling
51 * of the root node refer to
52 * {@link javax.swing.JTree#setRootVisible} and
53 * {@link javax.swing.JTree#setShowsRootHandles}.
54 * </td>
55 * </tr>
56 * <tr>
57 * <th><p style="text-align:left">Horizontal</p></th>
58 * <td>A horizontal line is drawn dividing the children of the root node.</td>
59 * </tr>
60 * <tr>
61 * <th><p style="text-align:left">None</p></th>
62 * <td>Do not draw any visual indication between nodes.</td>
63 * </tr>
64 * </table>
65 *
66 * <p>
67 * As it is typically impractical to obtain the <code>TreeUI</code> from
68 * the <code>JTree</code> and cast to an instance of <code>MetalTreeUI</code>
69 * you enable this property via the client property
70 * <code>JTree.lineStyle</code>. For example, to switch to
71 * <code>Horizontal</code> style you would do:
72 * <code>tree.putClientProperty("JTree.lineStyle", "Horizontal");</code>
73 * <p>
74 * The default is <code>Angled</code>.
75 *
76 * @author Tom Santos
77 * @author Steve Wilson (value add stuff)
78 */
79 public class MetalTreeUI extends BasicTreeUI {
80
81 private static Color lineColor;
|
1 /*
2 * Copyright (c) 1998, 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
28 import javax.swing.*;
29 import javax.swing.event.*;
30 import java.awt.*;
31 import java.awt.event.*;
32 import java.beans.*;
33 import java.io.*;
34 import java.util.*;
35 import javax.swing.plaf.*;
36 import javax.swing.tree.*;
37
38 import javax.swing.plaf.basic.*;
39
40 /**
41 * The metal look and feel implementation of <code>TreeUI</code>.
42 * <p>
43 * <code>MetalTreeUI</code> allows for configuring how to
44 * visually render the spacing and delineation between nodes. The following
45 * hints are supported:
46 *
47 * <table class="striped">
48 * <caption style="display:none">Descriptions of supported hints: Angled,
49 * Horizontal, and None</caption>
50 * <tr>
51 * <th>Angled</th>
52 * <td>A line is drawn connecting the child to the parent. For handling
53 * of the root node refer to
54 * {@link javax.swing.JTree#setRootVisible} and
55 * {@link javax.swing.JTree#setShowsRootHandles}.
56 * </td>
57 * </tr>
58 * <tr>
59 * <th>Horizontal</th>
60 * <td>A horizontal line is drawn dividing the children of the root node.</td>
61 * </tr>
62 * <tr>
63 * <th>None</th>
64 * <td>Do not draw any visual indication between nodes.</td>
65 * </tr>
66 * </table>
67 *
68 * <p>
69 * As it is typically impractical to obtain the <code>TreeUI</code> from
70 * the <code>JTree</code> and cast to an instance of <code>MetalTreeUI</code>
71 * you enable this property via the client property
72 * <code>JTree.lineStyle</code>. For example, to switch to
73 * <code>Horizontal</code> style you would do:
74 * <code>tree.putClientProperty("JTree.lineStyle", "Horizontal");</code>
75 * <p>
76 * The default is <code>Angled</code>.
77 *
78 * @author Tom Santos
79 * @author Steve Wilson (value add stuff)
80 */
81 public class MetalTreeUI extends BasicTreeUI {
82
83 private static Color lineColor;
|