void (final JTree tree) { new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent e, int clickCount) { if (clickCount > 1) return false; TreePath location = tree.getPathForLocation(e.getPoint().x, e.getPoint().y); if (location != null) { onMouseClicked(tree); // return isAutoScrollMode(); // do not consume event to allow processing by a tree } return false; } }.installOn(tree); tree.addMouseMotionListener(new MouseMotionAdapter() { @Override public void mouseDragged(final MouseEvent e) { onSelectionChanged(tree); } }); tree.addTreeSelectionListener( new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { onSelectionChanged(tree); } } ); }