MouseListener ml = new MouseAdapter() {
public void mousePressed(MouseEvent e) {
int selRow = tree.getRowForLocation(e.getX(), e.getY());
TreePath selPath = tree.getPathForLocation(e.getX(), e.getY());
if(selRow != -1) {
if(e.getClickCount() == 1) {
System.out.println(111);
}
else if(e.getClickCount() == 2) {
System.out.println(222);
}
}
}
};
tree.addMouseListener(ml);
JTree监听鼠标双击事件
猜你喜欢
转载自blog.csdn.net/weixin_43889841/article/details/103401549
今日推荐
周排行