JavaTM 2 Platform
Std. Ed. v1.3.1

javax.swing.plaf.metal
Class MetalTreeUI

java.lang.Object
  |
  +--javax.swing.plaf.ComponentUI
        |
        +--javax.swing.plaf.TreeUI
              |
              +--javax.swing.plaf.basic.BasicTreeUI
                    |
                    +--javax.swing.plaf.metal.MetalTreeUI

public class MetalTreeUI
extends BasicTreeUI

MetalTreeUI supports the client property "value-add" system of customization It uses it to determine what style of line to draw. There are three choices. The default choice is to draw no lines. Also available is a more variant with angled legs running from parent to child. Lastly you can choose an option with horizonl lines be lines at all. Here is some code to turn on angled legs. tree.putClientProperty("JTree.lineStyle", "Angled"); Here is some code to turn on horizontal lines between root nodes. tree.putClientProperty("JTree.lineStyle", "Horizontal"); Here is some code to turn off lines all together (which is the default). tree.putClientProperty("JTree.lineStyle", "None");


Inner classes inherited from class javax.swing.plaf.basic.BasicTreeUI
BasicTreeUI.CellEditorHandler, BasicTreeUI.ComponentHandler, BasicTreeUI.FocusHandler, BasicTreeUI.KeyHandler, BasicTreeUI.MouseHandler, BasicTreeUI.MouseInputHandler, BasicTreeUI.NodeDimensionsHandler, BasicTreeUI.PropertyChangeHandler, BasicTreeUI.SelectionModelPropertyChangeHandler, BasicTreeUI.TreeCancelEditingAction, BasicTreeUI.TreeExpansionHandler, BasicTreeUI.TreeHomeAction, BasicTreeUI.TreeIncrementAction, BasicTreeUI.TreeModelHandler, BasicTreeUI.TreePageAction, BasicTreeUI.TreeSelectionHandler, BasicTreeUI.TreeToggleAction, BasicTreeUI.TreeTraverseAction
 
Fields inherited from class javax.swing.plaf.basic.BasicTreeUI
cellEditor, collapsedIcon, createdCellEditor, createdRenderer, currentCellRenderer, depthOffset, drawingCache, editingComponent, editingPath, editingRow, editorHasDifferentSize, expandedIcon, largeModel, lastSelectedRow, leftChildIndent, nodeDimensions, preferredMinSize, preferredSize, rendererPane, rightChildIndent, stopEditingInCompleteEditing, totalChildIndent, tree, treeModel, treeSelectionModel, treeState, validCachedPreferredSize
 
Constructor Summary
MetalTreeUI()
           
 
Method Summary
static ComponentUI createUI(JComponent x)
           
protected  void decodeLineStyle(Object lineStyleFlag)
          this function converts between the string passed into the client property and the internal representation (currently and int)
protected  int getHorizontalLegBuffer()
          The horizontal element of legs between nodes starts at the right of the left-hand side of the child node by default.
 void installUI(JComponent c)
           
protected  boolean isLocationInExpandControl(int row, int rowLevel, int mouseX, int mouseY)
           
 void paint(Graphics g, JComponent c)
           
protected  void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
          Paints the horizontal part of the leg.
protected  void paintHorizontalSeparators(Graphics g, JComponent c)
           
protected  void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path)
          Paints the vertical part of the leg.
 void uninstallUI(JComponent c)
           
 
Methods inherited from class javax.swing.plaf.basic.BasicTreeUI
cancelEditing, checkForClickInExpandControl, completeEditing, completeEditing, completeUIInstall, completeUIUninstall, configureLayoutCache, createCellEditorListener, createCellRendererPane, createComponentListener, createDefaultCellEditor, createDefaultCellRenderer, createFocusListener, createKeyListener, createLayoutCache, createMouseListener, createNodeDimensions, createPropertyChangeListener, createSelectionModelPropertyChangeListener, createTreeExpansionListener, createTreeModelListener, createTreeSelectionListener, drawCentered, drawDashedHorizontalLine, drawDashedVerticalLine, ensureRowsAreVisible, getCellEditor, getCellRenderer, getClosestPathForLocation, getCollapsedIcon, getEditingPath, getExpandedIcon, getHashColor, getLastChildPath, getLeftChildIndent, getMaximumSize, getMinimumSize, getModel, getPathBounds, getPathForRow, getPreferredMinSize, getPreferredSize, getPreferredSize, getRightChildIndent, getRowCount, getRowForPath, getRowHeight, getSelectionModel, getShowsRootHandles, getVerticalLegBuffer, handleExpandControlClick, installComponents, installDefaults, installKeyboardActions, installListeners, isEditable, isEditing, isLargeModel, isLeaf, isLocationInExpandControl, isMultiSelectEvent, isRootVisible, isToggleEvent, isToggleSelectionEvent, paintExpandControl, paintHorizontalLine, paintRow, paintVerticalLine, pathWasCollapsed, pathWasExpanded, prepareForUIInstall, prepareForUIUninstall, selectPathForEvent, setCellEditor, setCellRenderer, setCollapsedIcon, setEditable, setExpandedIcon, setHashColor, setLargeModel, setLeftChildIndent, setModel, setPreferredMinSize, setRightChildIndent, setRootVisible, setRowHeight, setSelectionModel, setShowsRootHandles, shouldPaintExpandControl, startEditing, startEditingAtPath, stopEditing, toggleExpandState, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, updateCachedPreferredSize, updateCellEditor, updateDepthOffset, updateExpandedDescendants, updateLayoutCacheExpandedNodes, updateRenderer, updateSize
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetalTreeUI

public MetalTreeUI()
Method Detail

createUI

public static ComponentUI createUI(JComponent x)

getHorizontalLegBuffer

protected int getHorizontalLegBuffer()
Description copied from class: BasicTreeUI
The horizontal element of legs between nodes starts at the right of the left-hand side of the child node by default. This method makes the leg end before that.
Overrides:
getHorizontalLegBuffer in class BasicTreeUI

installUI

public void installUI(JComponent c)
Overrides:
installUI in class BasicTreeUI

uninstallUI

public void uninstallUI(JComponent c)
Overrides:
uninstallUI in class BasicTreeUI

decodeLineStyle

protected void decodeLineStyle(Object lineStyleFlag)
this function converts between the string passed into the client property and the internal representation (currently and int)

isLocationInExpandControl

protected boolean isLocationInExpandControl(int row,
                                            int rowLevel,
                                            int mouseX,
                                            int mouseY)

paint

public void paint(Graphics g,
                  JComponent c)
Overrides:
paint in class BasicTreeUI

paintHorizontalSeparators

protected void paintHorizontalSeparators(Graphics g,
                                         JComponent c)

paintVerticalPartOfLeg

protected void paintVerticalPartOfLeg(Graphics g,
                                      Rectangle clipBounds,
                                      Insets insets,
                                      TreePath path)
Description copied from class: BasicTreeUI
Paints the vertical part of the leg. The reciever should NOT modify clipBounds, insets.

Overrides:
paintVerticalPartOfLeg in class BasicTreeUI

paintHorizontalPartOfLeg

protected void paintHorizontalPartOfLeg(Graphics g,
                                        Rectangle clipBounds,
                                        Insets insets,
                                        Rectangle bounds,
                                        TreePath path,
                                        int row,
                                        boolean isExpanded,
                                        boolean hasBeenExpanded,
                                        boolean isLeaf)
Description copied from class: BasicTreeUI
Paints the horizontal part of the leg. The reciever should NOT modify clipBounds, or insets.

NOTE: parentRow can be -1 if the root is not visible.

Overrides:
paintHorizontalPartOfLeg in class BasicTreeUI

JavaTM 2 Platform
Std. Ed. v1.3.1

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Oracle and/or its affiliates, in the US and other countries.
Copyright © 1995, 2010 Oracle and/or its affiliates. All rights reserved.