java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.TreeUI
- 直接已知的子类:
-
BasicTreeUI,MultiTreeUI
可插拔的外观接口,用于JTree。
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidcancelEditing(JTree tree) 取消当前的编辑会话。abstract TreePathgetClosestPathForLocation(JTree tree, int x, int y) 返回最接近x、y的节点的路径。abstract TreePathgetEditingPath(JTree tree) 返回正在编辑的元素的路径。abstract RectanglegetPathBounds(JTree tree, TreePath path) 返回包围标签部分的矩形,最后一个路径项将绘制到其中。abstract TreePathgetPathForRow(JTree tree, int row) 返回传入行的路径。abstract intgetRowCount(JTree tree) 返回正在显示的行数。abstract intgetRowForPath(JTree tree, TreePath path) 返回最后一个路径项可见的行。abstract boolean如果树正在编辑,则返回true。abstract voidstartEditingAtPath(JTree tree, TreePath path) 选择路径中的最后一个项并尝试编辑它。abstract booleanstopEditing(JTree tree) 停止当前的编辑会话。Methods declared in class javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update
-
Constructor Details
-
TreeUI
protected TreeUI()子类调用的构造函数。
-
-
Method Details
-
getPathBounds
返回包围标签部分的矩形,最后一个路径项将绘制到其中。如果路径中的任何组件当前无效,则返回null。- 参数:
-
tree-path的JTree -
path- 标识节点的TreePath - 返回:
-
包围标签部分的矩形,最后一个路径项将绘制到其中,如果路径中的任何组件当前有效,则返回
null。
-
getPathForRow
返回传入行的路径。如果行不可见,则返回null。- 参数:
-
tree- 一个JTree对象 -
row- 指定行的整数 - 返回:
-
row的path,如果row不可见则返回null
-
getRowForPath
返回最后一个路径项可见的行。如果路径中的任何元素当前不可见,则返回-1。- 参数:
-
tree-path的JTree -
path- 要查找的TreePath对象 - 返回:
-
指定最后一个标识项可见的行,如果
path中的任何元素当前不可见则返回-1
-
getRowCount
返回正在显示的行数。- 参数:
-
tree- 要计算行数的JTree - 返回:
- 指定正在显示的行数的整数
-
getClosestPathForLocation
返回最接近x、y的节点的路径。如果当前没有任何可见内容,则返回null,否则始终返回有效路径。如果需要测试返回的对象是否确切地位于x、y,则应获取返回路径的边界并将x、y与其进行比较。- 参数:
-
tree- 一个JTree对象 -
x- 从显示区域左边缘水平像素数的整数 -
y- 从显示区域顶部垂直像素数的整数,减去任何顶部边距 - 返回:
-
最接近
x,y的TreePath节点,如果当前没有任何可见内容则返回null
-
isEditing
如果树正在编辑,则返回true。正在编辑的项可以通过getEditingPath()返回。- 参数:
-
tree- 一个JTree对象 - 返回:
-
如果
tree正在编辑,则返回true
-
stopEditing
停止当前的编辑会话。如果树没有被编辑,则此操作无效。如果编辑器允许停止编辑会话,则返回true。- 参数:
-
tree- 一个JTree对象 - 返回:
- 如果编辑器允许停止编辑会话,则返回true
-
cancelEditing
取消当前的编辑会话。如果树没有被编辑,则此操作无效。- 参数:
-
tree- 一个JTree对象
-
startEditingAtPath
选择路径中的最后一个项并尝试编辑它。如果CellEditor不允许对所选项进行编辑,则编辑将失败。- 参数:
-
tree- 正在编辑的JTree -
path- 要编辑的TreePath
-
getEditingPath
返回正在编辑的元素的路径。- 参数:
-
tree- 要返回路径的JTree - 返回:
-
包含到
tree的路径的TreePath
-