< prev index next >

src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java

Print this page




  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" style="text-align:left">
  65  *     <th style="background-color:#CCCCFF;text-align:left">Property:
  66  *     <th style="background-color:#CCCCFF;text-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"
  73  *   <tr><td>"backgroundNonSelectionColor"<td>"Tree.textBackground"
  74  *   <tr><td>"borderSelectionColor"<td>"Tree.selectionBorderColor"

  75  * </table>
  76  * <p>
  77  * <strong><a id="override">Implementation Note:</a></strong>
  78  * This class overrides
  79  * <code>invalidate</code>,
  80  * <code>validate</code>,
  81  * <code>revalidate</code>,
  82  * <code>repaint</code>,
  83  * and
  84  * <code>firePropertyChange</code>
  85  * solely to improve performance.
  86  * If not overridden, these frequently called methods would execute code paths
  87  * that are unnecessary for the default tree cell renderer.
  88  * If you write your own renderer,
  89  * take care to weigh the benefits and
  90  * drawbacks of overriding these methods.
  91  *
  92  * <p>
  93  * <strong>Warning:</strong>
  94  * Serialized objects of this class will not be compatible with




  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  *
  64  * <table class="striped">
  65  * <caption>Properties</caption>
  66  * <thead>
  67  *   <tr>
  68  *     <th>Property:
  69  *     <th>Key:
  70  *   </tr>
  71  * </thead>
  72  * <tbody>
  73  *   <tr><td>"leafIcon"<td>"Tree.leafIcon"
  74  *   <tr><td>"closedIcon"<td>"Tree.closedIcon"
  75  *   <tr><td>"openIcon"<td>"Tree.openIcon"
  76  *   <tr><td>"textSelectionColor"<td>"Tree.selectionForeground"
  77  *   <tr><td>"textNonSelectionColor"<td>"Tree.textForeground"
  78  *   <tr><td>"backgroundSelectionColor"<td>"Tree.selectionBackground"
  79  *   <tr><td>"backgroundNonSelectionColor"<td>"Tree.textBackground"
  80  *   <tr><td>"borderSelectionColor"<td>"Tree.selectionBorderColor"
  81  * </tbody>
  82  * </table>
  83  * <p>
  84  * <strong><a id="override">Implementation Note:</a></strong>
  85  * This class overrides
  86  * <code>invalidate</code>,
  87  * <code>validate</code>,
  88  * <code>revalidate</code>,
  89  * <code>repaint</code>,
  90  * and
  91  * <code>firePropertyChange</code>
  92  * solely to improve performance.
  93  * If not overridden, these frequently called methods would execute code paths
  94  * that are unnecessary for the default tree cell renderer.
  95  * If you write your own renderer,
  96  * take care to weigh the benefits and
  97  * drawbacks of overriding these methods.
  98  *
  99  * <p>
 100  * <strong>Warning:</strong>
 101  * Serialized objects of this class will not be compatible with


< prev index next >