- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.TreeUI
-
- 已知直接子类:
-
BasicTreeUI,MultiTreeUI
public abstract class TreeUI extends ComponentUI
JTree可插拔的外观和界面。
-
-
构造方法摘要
构造方法 Constructor 描述 TreeUI()
-
方法摘要
所有方法 接口方法 抽象方法 Modifier and Type 方法 描述 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)停止当前编辑会话。-
Methods inherited from class 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)
返回在行中传递的路径。 如果行不可见返回null。- 参数
-
tree- aJTree对象 -
row- 指定行的整数 - 结果
-
path为row或null如果row不可见
-
getRowForPath
public abstract int getRowForPath(JTree tree, TreePath path)
返回在路径中识别的最后一个项目可见的行。 如果路径中的任何元素当前不可见,则返回-1。- 参数
-
tree-JTree为path -
path- 要查看的TreePath对象 - 结果
-
一个整数,指定最后一个项目被识别的行,-1,如果
path中的任何元素当前不可见
-
getRowCount
public abstract int getRowCount(JTree tree)
返回正在显示的行数。- 参数
-
tree-JTree计数行的JTree - 结果
- 一个指定要显示的行数的整数
-
getClosestPathForLocation
public abstract TreePath getClosestPathForLocation(JTree tree, int x, int y)
返回最接近x,y的节点的路径。 如果当前没有任何可见的内容,则返回null,否则返回一个有效的路径。 如果您需要测试返回的对象是否完全在x处,那么您应该获得返回路径的边界,并对其进行测试x,y。- 参数
-
tree- aJTree对象 -
x- 从显示区域的左边缘水平地提供像素数的整数 -
y- 从显示区域顶部垂直排列的像素数减去任何顶部边距 - 结果
-
在
TreePath最接近节点x,y或者null如果当前没有任何可见
-
isEditing
public abstract boolean isEditing(JTree tree)
如果正在编辑树,则返回true。 正在编辑的项目可以由getEditingPath()返回。- 参数
-
tree- aJTree对象 - 结果
-
如果正在编辑
tree则为true
-
stopEditing
public abstract boolean stopEditing(JTree tree)
停止当前编辑会话。 如果树未被编辑,则不起作用。 如果编辑器允许编辑会话停止,则返回true。- 参数
-
tree- aJTree对象 - 结果
- 如果编辑器允许编辑会话停止,则为true
-
cancelEditing
public abstract void cancelEditing(JTree tree)
取消当前编辑会话。 如果树未被编辑,则不起作用。- 参数
-
tree- 一个JTree对象
-
startEditingAtPath
public abstract void startEditingAtPath(JTree tree, TreePath path)
选择路径中的最后一个项目并尝试编辑它。 如果CellEditor不允许选择的项目,编辑将失败。- 参数
-
tree- 正在编辑的JTree -
path- 要编辑的TreePath
-
-