Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTree valueChanged() method calling problem  RSS feed

 
mahesh krishnan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i am using a JTree in my application.When i am selecting a tree node,
"public void valueChanged(TreeSelectionEvent r_objSelectionEvent)" method is getting called more than one time(approximatly 3 times).That makes my application perfomance slow since the method contains lot of operations...I am calling reload() method of DefaultTreeModel also inside valueChanged method for updation.That also makes valueChanged method calling more than one time...I want valueChanged() method get called only when user makes some selection changes in tree node.Please Help me for this issue......
[ March 15, 2006: Message edited by: mahesh krishnan ]
 
Anand Loni
Ranch Hand
Posts: 150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add following code in valueChanged() see if it works ...


if (e.getValueIsAdjusting())
{
return;
}
 
mahesh krishnan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi anand,
getValueIsAdjusting() method is not avail for TreeSelectionEvent object...Only for ListSelectionEvent that method can used......
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!