Collapse a Jtreenode?


hi, i use this code to collapse a single node from a jtree.

hallo, ich habe hier eine methode, die einen bestimmten knoten komplett aufklappt. //expand a single node private static void expandSingleNode(JTree tree, TreeModel data, TreePath path){ Object node = path.getLastPathComponent(); int count = data.getChildCount(node); if (count == 0){ if (data.isLeaf(node)) tree.expandPath(path.getParentPath()); else tree.expandPath(path); }else for (int i = 0; i < count; i++) expandSingleNode(tree, data, path.pathByAddingChild(data.getChild(node, i))); }
Posted On: Tuesday 23rd of October 2012 11:30:05 PM Total Views:  233
View Complete with Replies

RELATED TOPICS OF Swing / AWT / SWT PROGRAMMING LANGUAGE




How to implement collapse on select in JMenu with JRadioButton as items?

As for a common JMenuItem, it seems to be defaulted to collapse on select. Now I added two jRadioButtons in a menu, when I click on one, the command finishes but the radio menu is still there seemingly requests another select. I need to make it a collapse on select mode for user friendliness. How can that be done Thank you .
VIEWS ON THIS POST

138

Posted on:

Wednesday 26th September 2012
View Replies!