Spec-Zone.ru › OpenJDK 25

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
The metal look and feel implementation of TreeUI.

MetalTreeUI allows for configuring how to visually render the spacing and delineation between nodes. The following hints are supported:

Descriptions of supported hints: Angled, Horizontal, and None
Hint Description
Angled A line is drawn connecting the child to the parent. For handling of the root node refer to JTree.setRootVisible(boolean) and JTree.setShowsRootHandles(boolean).
Horizontal A horizontal line is drawn dividing the children of the root node.
None Do not draw any visual indication between nodes.

As it is typically impractical to obtain the TreeUI from the JTree and cast to an instance of MetalTreeUI you enable this property via the client property JTree.lineStyle. For example, to switch to Horizontal style you would do: tree.putClientProperty("JTree.lineStyle", "Horizontal");

The default is Angled.

Nested Class Summary

Nested classes/interfaces declared in class 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

Field Summary

Fields declared in class 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

Constructor Description
MetalTreeUI()
Constructs the MetalTreeUI.

Method Summary

Modifier and Type Method Description
static ComponentUI createUI(JComponent x)
Constructs the MetalTreeUI.
protected void decodeLineStyle(Object lineStyleFlag)
Converts between the string passed into the client property and the internal representation (currently and int)
protected boolean isLocationInExpandControl(int row, int rowLevel, int mouseX, int mouseY)
Returns true if a point with X coordinate mouseX and Y coordinate mouseY is in expanded control.
protected void paintHorizontalSeparators(Graphics g, JComponent c)
Paints the horizontal separators.

Methods declared in class 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, getBaseline, getBaselineResizeBehavior, getCellEditor, getCellRenderer, getClosestPathForLocation, getCollapsedIcon, getDropLineRect, getEditingPath, getExpandedIcon, getHashColor, getHorizontalLegBuffer, getLastChildPath, getLeadSelectionRow, getLeftChildIndent, getMaximumSize, getMinimumSize, getModel, getPathBounds, getPathForRow, getPreferredMinSize, getPreferredSize, getPreferredSize, getRightChildIndent, getRowCount, getRowForPath, getRowHeight, getRowX, getSelectionModel, getShowsRootHandles, getVerticalLegBuffer, handleExpandControlClick, installComponents, installDefaults, installKeyboardActions, installListeners, isDropLine, isEditable, isEditing, isLargeModel, isLeaf, isLocationInExpandControl, isMultiSelectEvent, isRootVisible, isToggleEvent, isToggleSelectionEvent, paintDropLine, paintExpandControl, paintHorizontalLine, paintHorizontalPartOfLeg, paintRow, paintVerticalLine, paintVerticalPartOfLeg, 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, updateLeadSelectionRow, updateRenderer, updateSize

Methods declared in class ComponentUI

contains, getAccessibleChild, getAccessibleChildrenCount, installUI, paint, uninstallUI, update

Methods declared in class Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

MetalTreeUI

public MetalTreeUI()
Constructs the MetalTreeUI.

Method Details

createUI

public static ComponentUI createUI(JComponent x)
Constructs the MetalTreeUI.
Parameters:
x - a component
Returns:
the instance of the MetalTreeUI

decodeLineStyle

protected void decodeLineStyle(Object lineStyleFlag)
Converts between the string passed into the client property and the internal representation (currently and int)
Parameters:
lineStyleFlag - a flag

isLocationInExpandControl

protected boolean isLocationInExpandControl(int row, int rowLevel, int mouseX, int mouseY)
Returns true if a point with X coordinate mouseX and Y coordinate mouseY is in expanded control.
Parameters:
row - a row
rowLevel - a row level
mouseX - X coordinate
mouseY - Y coordinate
Returns:
true if a point with X coordinate mouseX and Y coordinate mouseY is in expanded control.

paintHorizontalSeparators

protected void paintHorizontalSeparators(Graphics g, JComponent c)
Paints the horizontal separators.
Parameters:
g - an instance of Graphics
c - a component

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2025, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/25/docs/api/java.desktop/javax/swing/plaf/metal/MetalTreeUI.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API