Класс MetalTreeUI
public class MetalTreeUI extends BasicTreeUI
TreeUI. MetalTreeUI позволяет настроить визуальное отображение отступов и разделителей между узлами. Поддерживаются следующие подсказки:
| Подсказка | Описание |
|---|---|
| Angled | Рисуется линия, соединяющая дочерний узел с родительским. Для обработки корневого узла см. JTree.setRootVisible(boolean) и JTree.setShowsRootHandles(boolean). |
| Horizontal | Рисуется горизонтальная линия, разделяющая дочерние узлы корневого узла. |
| None | Не рисуется никакое визуальное разделение между узлами. |
Поскольку обычно непрактично получить TreeUI из JTree и привести его к экземпляру MetalTreeUI, вы можете включить эту собственность через свойство клиента JTree.lineStyle. Например, чтобы переключиться на стиль Horizontal, необходимо выполнить: tree.putClientProperty("JTree.lineStyle", "Horizontal");
По умолчанию установлено значение Angled.
Краткое описание вложенных классов
Вложенные классы/интерфейсы, объявленные в классе 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
Краткое описание полей
Поля, объявленные в классе 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
Краткое описание конструкторов
| Конструктор | Описание |
|---|---|
MetalTreeUI() |
Создает MetalTreeUI. |
Краткое описание методов
| Модификатор и тип | Метод | Описание |
|---|---|---|
static ComponentUI |
createUI |
Создает MetalTreeUI. |
protected void |
decodeLineStyle |
Преобразует строку, переданную в свойство клиента, во внутреннее представление (в настоящее время целое число) |
protected boolean |
isLocationInExpandControl |
Возвращает true, если точка с координатой X mouseX и координатой Y mouseY находится в расширяемом элементе управления. |
protected void |
paintHorizontalSeparators |
Рисует горизонтальные разделители. |
Методы, объявленные в классе 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, 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
Методы, объявленные в классе javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, installUI, paint, uninstallUI, update
Подробное описание конструкторов
MetalTreeUI
public MetalTreeUI()
MetalTreeUI.Подробное описание методов
createUI
public static ComponentUI createUI(JComponent x)
MetalTreeUI.- Параметры:
-
x- компонент - Возвращает:
- экземпляр
MetalTreeUI
decodeLineStyle
protected void decodeLineStyle(Object lineStyleFlag)
- Параметры:
-
lineStyleFlag- флаг
isLocationInExpandControl
protected boolean isLocationInExpandControl(int row, int rowLevel, int mouseX, int mouseY)
true, если точка с координатой X mouseX и координатой Y mouseY находится в расширяемом элементе управления.- Параметры:
-
row- строка -
rowLevel- уровень строки -
mouseX- координата X -
mouseY- координата Y - Возвращает:
-
trueесли точка с координатой XmouseXи координатой YmouseYнаходится в расширяемом элементе управления.
paintHorizontalSeparators
protected void paintHorizontalSeparators(Graphics g, JComponent c)
- Параметры:
-
g- экземплярGraphics -
c- компонент
© 1993, 2023, 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/21/docs/api/java.desktop/javax/swing/plaf/metal/MetalTreeUI.html