java - how to remove selected jtree from several jtrees by right clicking on -


in gui have load several xml files according jtree structure 1 one, if want edit or remove complete jtree or value right clicking on, how can efficiently? clue?

i process xml file jtree below,

        /* tree implementation. */     xmltree = new jtree();     xmltree.setrootvisible(false);           xmltree.seteditable(true);      scrollpane.setviewportview(xmltree);             frame.getcontentpane().add("center", scrollpane); 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

             tn = processelement(xmldoc.getrootelement());          ((defaulttreemodel) xmltree.getmodel()).setroot(tn); 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

// open xml file gui. private defaultmutabletreenode processelement(element el) {     defaultmutabletreenode node = new defaultmutabletreenode(el.getname());     string text = el.gettextnormalize();     if ((text != null) && (!text.equals(""))) {         node.add(new defaultmutabletreenode(text));     }     processattributes(el, node);     iterator<element> children = el.getchildren().iterator();     while (children.hasnext()) {         element next = (element) children.next();         node.add(processelement(next));     } // end of while loop.     return node; } // end of method.   // processing element attributes. private void processattributes(element el, defaultmutabletreenode dmtn) {     iterator<attribute> atts = el.getattributes().iterator();     while (atts.hasnext()) {         attribute att = (attribute) atts.next();         defaultmutabletreenode attnode = new defaultmutabletreenode("@" + att.getname());         attnode.add(new defaultmutabletreenode(att.getvalue()));         dmtn.add(attnode);     } // end of while loop. } // end of method. 


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -