This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Highlight multiple nodes in jtree

 
Swetha Krish
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a search box, on entering the text fireDocumentChangeEvent is done to search the jtree and the matched nodes are selected.
Here only one node is selected and also I have a tree listener which downloads data for the selected node.

My need is If I give the string as "flo" then all the nodes that contains char "flo" should be highlighted.


 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So which do you have a problem with?
  • Identifying the nodes that contain "flo"?
  • Selecting multiple nodes?
  •  
    Rob Spoor
    Sheriff
    Pie
    Posts: 20495
    54
    Chrome Eclipse IDE Java Windows
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    If selecting multiple nodes is not possible (because you allow only single selection), use a custom TreeCellRenderer to do the highlighting for you.
     
    Darryl Burke
    Bartender
    Posts: 5125
    11
    Java Netbeans IDE Opera
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Selecting multiple nodes (TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION) is the defaule selectionMode.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic