SWT/Jface TreeViewer、Tree如何实现双击事件

时间:2022-09-19 20:28:06

如以下代码所示:

TreeViewer的话 就 getTree() 就可以了

tree直接使用:

  tree.addListener (SWT.MouseDoubleClick, new Listener () {
   public void handleEvent (Event event) {
    Point point = new Point (event.x, event.y);
    TreeItem item = tree.getItem (point);
    if (item != null) {
     System.out.println ("~~~~~~~~~~~~~~~~~~·This is test: " + item);
    }
   }
  });