public void mousePressed(MouseEvent e) {doPopup(e);} public void mouseReleased(MouseEvent e) {doPopup(e);}
this.tree = new JTree(model); tree.setCellRenderer(new AsyncTreeCellRenderer()); tree.addMouseListener(new TreePopupListener()); tree.setShowsRootHandles(true); tree.setToggleClickCount(0);
tree.addMouseListener(new TreePopupListener()); tree.setShowsRootHandles(true); tree.setToggleClickCount(0);
public void mouseReleased(MouseEvent e) {doPopup(e);} public void mouseClicked(MouseEvent e)
public void mouseClicked(MouseEvent e) { if(!doPopup(e) && e.getClickCount()==2) { JTree tree = (JTree)e.getSource(); TreePath[] paths = tree.getSelectionPaths(); if(paths!=null) { AsyncSwingTreeModel model = (AsyncSwingTreeModel)tree.getModel(); INodeHandler[] handlers = model.getNodeHandlers(); if(handlers!=null) { for(int i=0; paths!=null && i<paths.length; i++) { Action a = null; for(int j=handlers.length-1; a==null && j>=0; j--) { a = ((ISwingNodeHandler) handlers[j]).getDefaultAction((ISwingTreeNode)paths[i].getLastPathComponent()); } if(a!=null) { a.actionPerformed(new ActionEvent(tree, 0, null)); } } } } } }