public class MetalTreeUI extends BasicTreeUI
TreeUI
。
MetalTreeUI
允许配置如何可视化渲染节点之间的间距和划分。支持以下提示:
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. |
它通常是从JTree
抛到MetalTreeUI
启用此属性通过客户财产JTree.lineStyle
实例获得TreeUI
不切实际。例如,切换到Horizontal
风格你会做的事:tree.putClientProperty("JTree.lineStyle", "Horizontal");
默认的是Angled
。
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
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 and Description |
---|
MetalTreeUI() |
Modifier and Type | Method and Description |
---|---|
static ComponentUI |
createUI(JComponent x) |
protected void |
decodeLineStyle(Object lineStyleFlag)
这个函数将字符串传递到客户端的性能和内部表征之间(目前和int)
|
protected int |
getHorizontalLegBuffer()
节点之间的腿的水平元素在默认情况下,在子节点的左侧右侧开始。
|
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)
油漆腿的水平部分。
|
protected void |
paintHorizontalSeparators(Graphics g, JComponent c) |
protected void |
paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path)
油漆腿的垂直部分。
|
void |
uninstallUI(JComponent c)
逆转形态,完成指定的组件在
installUI 。
|
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, 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, 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, updateLeadSelectionRow, updateRenderer, updateSize
contains, getAccessibleChild, getAccessibleChildrenCount, update
public static ComponentUI createUI(JComponent x)
protected int getHorizontalLegBuffer()
BasicTreeUI
getHorizontalLegBuffer
方法重写,继承类
BasicTreeUI
public void installUI(JComponent c)
ComponentUI
ComponentUI
实例被安装在指定组件的UI代理。这种方法应该完全配置的组件外观和感觉,包括以下内容:
LayoutManager
组件上的必要。PropertyChangeListener
变化适当。installUI
方法重写,继承类
BasicTreeUI
c
-组件,UI代理被安装
ComponentUI.uninstallUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
public void uninstallUI(JComponent c)
ComponentUI
installUI
。这个方法被调用时,这个
UIComponent
实例被作为指定组件的UI代理删除。这种方法应该撤消配置进行
installUI
,小心留下的
JComponent
实例在干净的状态(没有多余的听众,外观和感觉的特定属性的对象,等)。这应包括以下几个方面:
uninstallUI
方法重写,继承类
BasicTreeUI
c
-从这个UI代理被删除的组件;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
ComponentUI.installUI(javax.swing.JComponent)
,
JComponent.updateUI()
protected void decodeLineStyle(Object lineStyleFlag)
protected boolean isLocationInExpandControl(int row, int rowLevel, int mouseX, int mouseY)
public void paint(Graphics g, JComponent c)
ComponentUI
ComponentUI.update
方法调用时指定的组件正在粉刷。子类应重写此方法,并使用指定的
Graphics
对象呈现的成分含量。
paint
方法重写,继承类
BasicTreeUI
g
-
Graphics
背景的画
c
-正在绘制的构件;这种说法常常被忽视,但可能如果UI对象是无状态的,共享由多个组件
ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)
protected void paintHorizontalSeparators(Graphics g, JComponent c)
protected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path)
BasicTreeUI
clipBounds
,
insets
。
paintVerticalPartOfLeg
方法重写,继承类
BasicTreeUI
protected void paintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)
BasicTreeUI
clipBounds
,或
insets
。
注:parentRow
可以1如果根是不可见的。
paintHorizontalPartOfLeg
方法重写,继承类
BasicTreeUI
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.