32 import java.awt.Graphics;
33 import java.awt.Insets;
34 import java.awt.Rectangle;
35 import javax.swing.plaf.ColorUIResource;
36 import javax.swing.plaf.FontUIResource;
37 import javax.swing.plaf.UIResource;
38 import javax.swing.plaf.basic.BasicGraphicsUtils;
39 import javax.swing.Icon;
40 import javax.swing.JLabel;
41 import javax.swing.JTree;
42 import javax.swing.LookAndFeel;
43 import javax.swing.UIManager;
44 import javax.swing.border.EmptyBorder;
45 import sun.swing.DefaultLookup;
46
47 /**
48 * Displays an entry in a tree.
49 * <code>DefaultTreeCellRenderer</code> is not opaque and
50 * unless you subclass paint you should not change this.
51 * See <a
52 href="http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html">How to Use Trees</a>
53 * in <em>The Java Tutorial</em>
54 * for examples of customizing node display using this class.
55 * <p>
56 * The set of icons and colors used by {@code DefaultTreeCellRenderer}
57 * can be configured using the various setter methods. The value for
58 * each property is initialized from the defaults table. When the
59 * look and feel changes ({@code updateUI} is invoked), any properties
60 * that have a value of type {@code UIResource} are refreshed from the
61 * defaults table. The following table lists the mapping between
62 * {@code DefaultTreeCellRenderer} property and defaults table key:
63 * <table border="1" cellpadding="1" cellspacing="0" summary="">
64 * <tr valign="top" align="left">
65 * <th bgcolor="#CCCCFF" align="left">Property:
66 * <th bgcolor="#CCCCFF" align="left">Key:
67 * <tr><td>"leafIcon"<td>"Tree.leafIcon"
68 * <tr><td>"closedIcon"<td>"Tree.closedIcon"
69 * <tr><td>"openIcon"<td>"Tree.openIcon"
70 * <tr><td>"textSelectionColor"<td>"Tree.selectionForeground"
71 * <tr><td>"textNonSelectionColor"<td>"Tree.textForeground"
72 * <tr><td>"backgroundSelectionColor"<td>"Tree.selectionBackground"
|
32 import java.awt.Graphics;
33 import java.awt.Insets;
34 import java.awt.Rectangle;
35 import javax.swing.plaf.ColorUIResource;
36 import javax.swing.plaf.FontUIResource;
37 import javax.swing.plaf.UIResource;
38 import javax.swing.plaf.basic.BasicGraphicsUtils;
39 import javax.swing.Icon;
40 import javax.swing.JLabel;
41 import javax.swing.JTree;
42 import javax.swing.LookAndFeel;
43 import javax.swing.UIManager;
44 import javax.swing.border.EmptyBorder;
45 import sun.swing.DefaultLookup;
46
47 /**
48 * Displays an entry in a tree.
49 * <code>DefaultTreeCellRenderer</code> is not opaque and
50 * unless you subclass paint you should not change this.
51 * See <a
52 href="http://docs.oracle.com/javase/tutorial/uiswing/components/tree.html">How to Use Trees</a>
53 * in <em>The Java Tutorial</em>
54 * for examples of customizing node display using this class.
55 * <p>
56 * The set of icons and colors used by {@code DefaultTreeCellRenderer}
57 * can be configured using the various setter methods. The value for
58 * each property is initialized from the defaults table. When the
59 * look and feel changes ({@code updateUI} is invoked), any properties
60 * that have a value of type {@code UIResource} are refreshed from the
61 * defaults table. The following table lists the mapping between
62 * {@code DefaultTreeCellRenderer} property and defaults table key:
63 * <table border="1" cellpadding="1" cellspacing="0" summary="">
64 * <tr valign="top" align="left">
65 * <th bgcolor="#CCCCFF" align="left">Property:
66 * <th bgcolor="#CCCCFF" align="left">Key:
67 * <tr><td>"leafIcon"<td>"Tree.leafIcon"
68 * <tr><td>"closedIcon"<td>"Tree.closedIcon"
69 * <tr><td>"openIcon"<td>"Tree.openIcon"
70 * <tr><td>"textSelectionColor"<td>"Tree.selectionForeground"
71 * <tr><td>"textNonSelectionColor"<td>"Tree.textForeground"
72 * <tr><td>"backgroundSelectionColor"<td>"Tree.selectionBackground"
|