Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help needed in selecting multiple nodes in Jtree

 
Swetha Krish
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20606
60
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic