boolean (MouseEvent event) { if (!super.isToggleEvent(event)) return false; JTree tree = getTree(); return tree != null // BasicTreeUI uses clickCount % toggleClickCount == 0, which works terrible for single-click, so we double-check here: && tree.getToggleClickCount() == event.getClickCount() && isExpandPreferable(tree, tree.getSelectionPath()); }