• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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 ]
 
You don't like waffles? Well, do you like this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic