< prev index next >

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

Print this page




  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>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";




  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>Descriptions of supported hints: Angled, Horizontal, and None
  49  * </caption>
  50  * <thead>
  51  *   <tr>
  52  *     <th scope="col">Hint
  53  *     <th scope="col">Description
  54  * </thead>
  55  * <tbody>



  56  *   <tr>
  57  *     <th scope="row">Angled
  58  *     <td>A line is drawn connecting the child to the parent. For handling of
  59  *     the root node refer to {@link JTree#setRootVisible} and
  60  *     {@link JTree#setShowsRootHandles}.
  61  *   <tr>
  62  *     <th scope="row">Horizontal
  63  *     <td>A horizontal line is drawn dividing the children of the root node.
  64  *   <tr>
  65  *     <th scope="row">None
  66  *     <td>Do not draw any visual indication between nodes.
  67  * </tbody>
  68  * </table>

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


< prev index next >