void (MouseEvent e) { int row = tree.getRowForLocation(e.getX(), e.getY()); if (row >= 0) { TreePath path = tree.getPathForRow(row); if (!isCheckboxEnabledFor(path, handler)) return; Rectangle checkBounds = checkbox.getBounds(); checkBounds.setLocation(tree.getRowBounds(row).getLocation()); if (checkBounds.contains(e.getPoint())) { tree.setSelectionRow(row); handler.toggle(path, e); e.consume(); } } }