wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Help needed in selecting multiple nodes in Jtree Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Help needed in selecting multiple nodes in Jtree" Watch "Help needed in selecting multiple nodes in Jtree" New topic
Author

Help needed in selecting multiple nodes in Jtree

Swetha Krish
Greenhorn

Joined: Jun 27, 2011
Posts: 6
on typing the string in the text box, event must be triggered to search the Jtree for the string and make them selected .
Also when the string is deleted, the nodes in the tree must be deselected


Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

If you check the JTree API, you'll see three methods that you'll find useful: expandRow / expandPath, and getSelectionModel. The latter returns the TreeSelectionModel which has methods to clear the selection, and to add a TreePath to the selection. To convert from row number to TreePath you can use JTree's getPathForRow method.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help needed in selecting multiple nodes in Jtree
 
Similar Threads
JTree leaf contents update - problem :(
Subtree in JTree
JTree help
Dynamic JTree Components
JTree