[英]Get index of selected node in a JTree
How can I get the index of a selected node in its parent. 如何获取其父节点中选定节点的索引。 For example D
should be index 3 in root
. 例如, D
应该是root
索引3。 I tried with jTree.getSelectionPath()
but it doesn't show the index 我尝试使用jTree.getSelectionPath()
,但未显示索引
root
A
B
C
a
D
a
b
c
E
JTree has the methods JTree有方法
public int[] getSelectionRows()
public int getMinSelectionRow()
public int getMaxSelectionRow()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.