- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.TreeUI
-
- 已知直接子类:
-
BasicTreeUI,MultiTreeUI
public abstract class TreeUI extends ComponentUI
JTree的可插拔外观界面。
-
-
构造方法摘要
构造方法 构造器 描述 TreeUI()
-
方法摘要
所有方法 实例方法 抽象方法 变量和类型 方法 描述 abstract voidcancelEditing(JTree tree)取消当前编辑会话。abstract TreePathgetClosestPathForLocation(JTree tree, int x, int y)返回最接近x,y的节点的路径。abstract TreePathgetEditingPath(JTree tree)返回正在编辑的元素的路径。abstract RectanglegetPathBounds(JTree tree, TreePath path)返回包含将绘制路径中最后一项的标签部分的Rectangle。abstract TreePathgetPathForRow(JTree tree, int row)返回传入行的路径。abstract intgetRowCount(JTree tree)返回正在显示的行数。abstract intgetRowForPath(JTree tree, TreePath path)返回路径中标识的最后一项可见的行。abstract booleanisEditing(JTree tree)如果正在编辑树,则返回true。abstract voidstartEditingAtPath(JTree tree, TreePath path)选择路径中的最后一项并尝试编辑它。abstract booleanstopEditing(JTree tree)停止当前的编辑会话。-
声明方法的类 javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update
-
-
-
-
方法详细信息
-
getPathBounds
public abstract Rectangle getPathBounds(JTree tree, TreePath path)
返回包含将绘制路径中最后一项的标签部分的Rectangle。 如果路径中的任何组件当前有效,则返回null。- 参数
-
tree-JTree代表path -
path- 标识节点的TreePath - 结果
-
Rectangle包含将绘制路径中最后一项的标签部分,如果路径中的任何组件当前有效,null。
-
getPathForRow
public abstract TreePath getPathForRow(JTree tree, int row)
返回传入行的路径。 如果row不可见,则返回null。- 参数
-
tree- 一个JTree对象 -
row- 指定行的整数 - 结果
-
pathforrow或null如果row不可见
-
getRowForPath
public abstract int getRowForPath(JTree tree, TreePath path)
返回路径中标识的最后一项可见的行。 如果路径中的任何元素当前不可见,则返回-1。- 参数
-
tree-JTree代表path -
path- 要查看的对象TreePath - 结果
-
指定标识最后一项的行的整数,如果
path中的任何元素当前不可见,则返回-1
-
getRowCount
public abstract int getRowCount(JTree tree)
返回正在显示的行数。- 参数
-
tree- 要为其计数行的JTree - 结果
- 一个整数,指定要显示的行数
-
getClosestPathForLocation
public abstract TreePath getClosestPathForLocation(JTree tree, int x, int y)
返回最接近x,y的节点的路径。 如果当前没有任何内容可见,则返回null,否则它将始终返回有效路径。 如果你需要测试返回的对象是否正好在x,y,你应该获得返回路径的边界并测试x,y。- 参数
-
tree-JTree对象 -
x- 一个整数,给出显示区域左边缘水平的像素数 -
y- 一个整数,给出显示区域顶部垂直的像素数,减去任何上边距 - 结果
-
TreePath节点最接近x,y或null如果当前没有任何可见的节点
-
isEditing
public abstract boolean isEditing(JTree tree)
如果正在编辑树,则返回true。 getEditingPath()可以返回正在编辑的项目。- 参数
-
tree-JTree对象 - 结果
-
如果正在编辑
tree则为true
-
stopEditing
public abstract boolean stopEditing(JTree tree)
停止当前的编辑会话。 如果未编辑树,则无效。 如果编辑器允许编辑会话停止,则返回true。- 参数
-
tree-JTree对象 - 结果
- 如果编辑器允许编辑会话停止,则为true
-
cancelEditing
public abstract void cancelEditing(JTree tree)
取消当前编辑会话。 如果未编辑树,则无效。- 参数
-
tree-JTree对象
-
startEditingAtPath
public abstract void startEditingAtPath(JTree tree, TreePath path)
选择路径中的最后一项并尝试编辑它。 如果CellEditor不允许编辑所选项目,编辑将失败。- 参数
-
tree- 正在编辑的JTree -
path- 要编辑的TreePath
-
-