- 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
金属外观实现TreeUI。
Descriptions of supported hints: Angled, Horizontal, and None Angled A line is drawn connecting the child to the parent. For handling of the root node refer toMetalTreeUI允许配置如何直观地渲染节点之间的间距和描述。 支持以下提示:JTree.setRootVisible(boolean)andJTree.setShowsRootHandles(boolean). Horizontal A horizontal line is drawn dividing the children of the root node. None Do not draw any visual indication between nodes.由于它一般是不切实际获得
TreeUI从JTree并浇铸成的实例MetalTreeUI启用通过客户端属性这个属性JTree.lineStyle。 例如,要切换到Horizontal样式,您可以执行以下操作:tree.putClientProperty("JTree.lineStyle", "Horizontal");默认值为
Angled。
-
-
Nested Class Summary
-
Nested classes/interfaces 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
-
-
Field Summary
-
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 描述 MetalTreeUI()构造MetalTreeUI。
-
方法摘要
所有方法 静态方法 接口方法 具体的方法 Modifier and Type 方法 描述 static ComponentUIcreateUI(JComponent x)构建MetalTreeUI。protected voiddecodeLineStyle(Object lineStyleFlag)传递给客户端属性的字符串和内部表示(当前和int)之间的转换protected intgetHorizontalLegBuffer()默认情况下,节点之间的腿的水平元素从子节点左侧的右侧开始。voidinstallUI(JComponent c)适当地配置指定的组件的外观和感觉。protected booleanisLocationInExpandControl(int row, int rowLevel, int mouseX, int mouseY)如果具有X坐标mouseX和Y坐标mouseY点处于扩展控制中,则返回true。voidpaint(Graphics g, JComponent c)适当地涂抹指定的组件的外观和感觉。protected voidpaintHorizontalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf)涂抹腿部的水平部分。protected voidpaintHorizontalSeparators(Graphics g, JComponent c)绘制水平分隔符。protected voidpaintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path)涂上腿部的垂直部分。voiduninstallUI(JComponent c)在installUI反转在指定组件上完成的配置。-
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, 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
-
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, update
-
-
-
-
方法详细信息
-
createUI
public static ComponentUI createUI(JComponent x)
构造MetalTreeUI。- 参数
-
x- 一个组件 - 结果
-
的例子是
MetalTreeUI
-
getHorizontalLegBuffer
protected int getHorizontalLegBuffer()
说明从类别复制:BasicTreeUI默认情况下,节点之间的腿的水平元素从子节点左侧的右侧开始。 这种方法使腿之前结束。- 重写:
-
getHorizontalLegBuffer在BasicTreeUI - 结果
- 水平腿缓冲
-
installUI
public void installUI(JComponent c)
描述从类复制:ComponentUI适当地配置指定的组件的外观和感觉。 当安装ComponentUI实例作为指定组件上的UI委托时,将调用此方法。 该方法应该完全配置组件的外观,包括以下内容:- 为组件上的颜色,字体,边框,图标,不透明度等安装默认属性值。 只要有可能,由客户端程序初始化的属性值不应该被重写。
- 如有必要,请在组件上安装
LayoutManager。 - 创建/添加任何所需的子组件到组件。
- 在组件上创建/安装事件监听器。
- 在组件上创建/安装
PropertyChangeListener,以便适当地检测和响应组件属性更改。 - 在组件上安装键盘UI(助记符,遍历等)。
- 初始化任何适当的实例数据。
- 重写:
-
installUI在BasicTreeUI - 参数
-
c- 正在安装此UIc的组件 - 另请参见:
-
ComponentUI.uninstallUI(javax.swing.JComponent),JComponent.setUI(javax.swing.plaf.ComponentUI),JComponent.updateUI()
-
uninstallUI
public void uninstallUI(JComponent c)
描述从类复制:ComponentUI在installUI反转在指定组件上完成的配置。 当将此UIComponent实例作为指定组件的UI委托删除时,将调用此方法。 该方法应该撤消在installUI执行的配置,小心将JComponent实例保持在干净的状态(没有无关的侦听器,特定于外观的属性对象等)。 这应该包括以下内容:- 从组件中删除任何UI集边框。
- 删除组件上的任何UI集布局管理器。
- 从组件中删除任何添加了UI的子组件。
- 从组件中删除任何UI添加的事件/属性侦听器。
- 从组件中删除任何UI安装的键盘UI。
- 对任何分配的实例数据对象进行空白以允许GC。
- 重写:
-
uninstallUI在BasicTreeUI - 参数
-
c- 从中删除此UIc的组件; 这个参数经常被忽略,但如果UI对象是无状态的并且被多个组件共享,则可能会被使用 - 另请参见:
-
ComponentUI.installUI(javax.swing.JComponent),JComponent.updateUI()
-
decodeLineStyle
protected void decodeLineStyle(Object lineStyleFlag)
传递给客户端属性的字符串和内部表示(当前和int)之间的转换- 参数
-
lineStyleFlag- 一个国旗
-
isLocationInExpandControl
protected boolean isLocationInExpandControl(int row, int rowLevel, int mouseX, int mouseY)如果具有X坐标mouseX和Y坐标mouseY点处于扩展控制中,则返回true。- 参数
-
row- 一排 -
rowLevel- 行级别 -
mouseX- X坐标 -
mouseY- Y坐标 - 结果
-
true如果与X坐标的点mouseX和Y坐标mouseY是在扩展的控制。
-
paint
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)
-
paintHorizontalSeparators
protected void paintHorizontalSeparators(Graphics g, JComponent c)
绘制水平分隔符。- 参数
-
g-实例Graphics -
c- 一个组件
-
paintVerticalPartOfLeg
protected void paintVerticalPartOfLeg(Graphics g, Rectangle clipBounds, Insets insets, TreePath path)
描述从类复制:BasicTreeUI涂上腿部的垂直部分。 该接收器不应修改clipBounds,insets。- 重写:
-
paintVerticalPartOfLeg在BasicTreeUI - 参数
-
g- 图形上下文 -
clipBounds- 一个剪切的矩形 -
insets- 插图 -
path- 树路径
-
paintHorizontalPartOfLeg
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 - 参数
-
g- 图形上下文 -
clipBounds- 一个剪切的矩形 -
insets- 插图 -
bounds- 一个边界矩形 -
path- 树路径 -
row- 一排 -
isExpanded-true如果路径被扩展 -
hasBeenExpanded-true如果路径已被扩展 -
isLeaf-true如果路径是叶
-
-