< prev index next >

src/java.desktop/share/classes/javax/swing/plaf/metal/MetalTreeUI.java

Print this page




  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>Descriptions of supported hints: Angled, Horizontal, and None
  49  * </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;
  84 
  85     private static final String LINE_STYLE = "JTree.lineStyle";
  86 
  87     private static final String LEG_LINE_STYLE_STRING = "Angled";




  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>Descriptions of supported hints: Angled, Horizontal, and None
  49  * </caption>
  50  *   <tr>
  51  *     <th scope="row">Angled
  52  *     <td>A line is drawn connecting the child to the parent. For handling of
  53  *     the root node refer to {@link JTree#setRootVisible} and
  54  *     {@link JTree#setShowsRootHandles}.



  55  *   <tr>
  56  *     <th scope="row">Horizontal
  57  *     <td>A horizontal line is drawn dividing the children of the root node.

  58  *   <tr>
  59  *     <th scope="row">None
  60  *     <td>Do not draw any visual indication between nodes.

  61  * </table>

  62  * <p>
  63  * As it is typically impractical to obtain the <code>TreeUI</code> from
  64  * the <code>JTree</code> and cast to an instance of <code>MetalTreeUI</code>
  65  * you enable this property via the client property
  66  * <code>JTree.lineStyle</code>. For example, to switch to
  67  * <code>Horizontal</code> style you would do:
  68  * <code>tree.putClientProperty("JTree.lineStyle", "Horizontal");</code>
  69  * <p>
  70  * The default is <code>Angled</code>.
  71  *
  72  * @author Tom Santos
  73  * @author Steve Wilson (value add stuff)
  74  */
  75 public class MetalTreeUI extends BasicTreeUI {
  76 
  77     private static Color lineColor;
  78 
  79     private static final String LINE_STYLE = "JTree.lineStyle";
  80 
  81     private static final String LEG_LINE_STYLE_STRING = "Angled";


< prev index next >