void (TreePath treePath) { if (treePath == null) { return; } Object o = treePath.getLastPathComponent(); if (o instanceof MyToggleTreeNode node) { if (!node.isEnabled()) return; node.setSelected(!node.isSelected()); int row = myOptionsTree.getRowForPath(treePath); myOptionsTree.repaint(myOptionsTree.getRowBounds(row)); //updatePreview(); somethingChanged(); } }