©
This document uses PHP Chinese website manual Release
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Object javax.swing.plaf.ComponentUI javax.swing.plaf.TreeUI javax.swing.plaf.basic.BasicTreeUI javax.swing.plaf.metal.MetalTreeUI
public class MetalTreeUI
TreeUI
的 metal 外观实现。
MetalTreeUI
允许配置如何在视觉上呈现节点之间的间隔和描绘。支持以下提示:
Angled |
绘制一条连接子节点和父节点的线。关于如何处理根节点,请参阅 JTree.setRootVisible(boolean) 和 JTree.setShowsRootHandles(boolean) 。
|
---|---|
Horizontal |
绘制用来分隔根节点的子节点的一条水平线。 |
None |
不在节点间绘制任何可见的指示。 |
因为通常无法从 JTree
中获得 TreeUI
并将它强制转换成 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()
|
方法摘要 | |
---|---|
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)
绘制支路 (leg) 的水平部分。 |
protected void |
paintHorizontalSeparators(Graphics g,
JComponent c)
|
protected void |
paintVerticalPartOfLeg(Graphics g,
Rectangle clipBounds,
Insets insets,
TreePath path)
绘制支路的垂直部分。 |
void |
uninstallUI(JComponent c)
在 installUI 期间,在指定组件上反向执行的配置操作。 |
从类 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, getEditingPath, getExpandedIcon, getHashColor, getLastChildPath, getLeftChildIndent, getMaximumSize, getMinimumSize, getModel, getPathBounds, getPathForRow, getPreferredMinSize, getPreferredSize, getPreferredSize, getRightChildIndent, getRowCount, getRowForPath, getRowHeight, getRowX, 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 |
从类 javax.swing.plaf.ComponentUI 继承的方法 |
---|
contains, getAccessibleChild, getAccessibleChildrenCount, update |
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
构造方法详细信息 |
---|
public MetalTreeUI()
方法详细信息 |
---|
public static ComponentUI createUI(JComponent x)
protected int getHorizontalLegBuffer()
BasicTreeUI
复制的描述
BasicTreeUI
中的 getHorizontalLegBuffer
public void installUI(JComponent c)
ComponentUI
复制的描述ComponentUI
实例将作为 UI 委托安装在指定组件上时,可调用此方法。此方法应该为外观完整地配置组件,包括以下方面:
LayoutManager
。
PropertyChangeListener
。
BasicTreeUI
中的 installUI
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
实例处于某种洁净状态(没有额外的侦听器、没有特定于外观的属性对象等等)。配置内容应该包括以下方面:
BasicTreeUI
中的 uninstallUI
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
对象来呈现组件的内容。
BasicTreeUI
中的 paint
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
。
BasicTreeUI
中的 paintVerticalPartOfLeg
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。
BasicTreeUI
中的 paintHorizontalPartOfLeg
|
JavaTM 2 Platform Standard Ed. 6 |
|||||||||
上一个类 下一个类 | 框架 无框架 | |||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。