• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems with updating the text of a JButton...!!

 
Parth Bhatt
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys,
i am on a project that involves updating the text of a JButton while the application is running...!! Here's my code snippet that has an actionPerformed method where this is to be done.

In the following code snippet
SearchButton is the instance of JButton, which when clicked should start searching.



The problem is that the text of SearchButton is not getting updated till all the statements in the if(s.equals("Search")) block get executed

Please comment...
 
Dan Patterson
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Someone may have a better idea, but you could try this. Put a yield() after the text change.


 
Parth Bhatt
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hii dan !!
The yield() method makes no difference...!! i've tried using it as



as yield() is a static method... but this makes absolutely no difference...!!

Any more comments plz....!!
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For information about the event dispatch thread and using threads in Swing see How to Use Threads.
 
Parth Bhatt
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey !!

Thanks a lot Craig, you're a "rock star" !! got my solution...!!

Thanks Dan 4 de help...!!
[ March 16, 2006: Message edited by: Parth Bhatt ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!