int selected = tree.getLeadSelectionRow(); if (selected != -1 && isLeaf(selected)) { TreePath anchorPath = tree.getAnchorSelectionPath(); TreePath leadPath = tree.getLeadSelectionPath(); toggleExpandState(getPathForRow(tree, selected));   tree.setLeadSelectionPath(leadPath); tree.setAnchorSelectionPath(anchorPath); }
    public void actionPerformed(ActionEvent e)    throws NotImplementedException    {      // TODO: Implement this properly.    }