Prevent JTree collapsingTag(s): Swing


myJTree.addTreeWillExpandListener
  (new TreeWillExpandListener() {
    public void treeWillExpand(TreeExpansionEvent e) { }
    public void treeWillCollapse(TreeExpansionEvent e)
         throws ExpandVetoException {
     throw new ExpandVetoException(e, "you can't collapse this JTree");
     }
    });


blog comments powered by Disqus