您能告诉我如何在叶子的父节点上进行活动处理。
在这里,我想在rritg04节点上进行活动处理。
mobileEnablerTxnListTree.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent p_evt) {
if (p_evt.getButton() == MouseEvent.BUTTON3) {
DefaultMutableTreeNode l_selected_node = (DefaultMutableTreeNode) mobileEnablerTxnListTree
.getLastSelectedPathComponent();
if (l_selected_node != null && l_selected_node.isRoot())
meTxnListTreeRightClickNewEntity(p_evt);
if (l_selected_node != null && l_selected_node.isLeaf())
meTxnListTreeRightClick(p_evt);
}
}
});
谢谢
public void mouseClicked(MouseEvent p_evt) {
DefaultMutableTreeNode l_selected_node = (DefaultMutableTreeNode) returnMobileEnablerFieldMapTree
.getLastSelectedPathComponent();
if (p_evt.getButton() == MouseEvent.BUTTON3) {
if (l_selected_node != null
& l_selected_node.equals(l_selected_node
.getLastLeaf().getParent())) {
Do whatever you want ...........
}
}
我通过这样做解决了我的问题。
谢谢