当前位置: 技术问答>java相关
请教Swing高手,如何在JTree中如何通过一个TreePath判断它代表的节点是不是叶节点?
来源: 互联网 发布时间:2015-07-01
本文导语: 谢谢 | tree.addTreeSelectionListener(new TreeSelectListener() { public void valueChanged(TreeSelectionEvent e){ DefaultMutableTreeNode node = (DefualtMutableTreeNode)tree.getLastSelectedPathComponent(); if(node == null)return; if(node.isLea...
谢谢
|
tree.addTreeSelectionListener(new TreeSelectListener() {
public void valueChanged(TreeSelectionEvent e){
DefaultMutableTreeNode node = (DefualtMutableTreeNode)tree.getLastSelectedPathComponent();
if(node == null)return;
if(node.isLeaf())
...
else
...
});
public void valueChanged(TreeSelectionEvent e){
DefaultMutableTreeNode node = (DefualtMutableTreeNode)tree.getLastSelectedPathComponent();
if(node == null)return;
if(node.isLeaf())
...
else
...
});