• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

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

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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....!!
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic