• 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

Forcing pack in mouse click event

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a sqlj file that selects about 40 different counts on tables and views and calls several different stored procedures. I also have a JFrame that has a textField for each count I need to do. When I hit the go button, I call these different methods and assign the count to the proper text field.
My problem is that this can take several minutes and I would like to know where in the counts/procedure the program is. I have the textfields gray to start out with, and a status bar. I would like the textfields to turn white and show the number of counts as well as the label in the status bar to show which count/procedure it is currently doing.
I have all the method calls in the ButtonActionPerformed method. I have called pack(), repaint(), validate() on the JFrame and even on the JPanel that the textfields sit on and nothing makes them refresh until all the counts/procedures are called and the ButtonActionPerformed returns.
Is there any way to make the textfields and label refresh during the ButtonActionPerformed method?
 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
The problem is that you are doing it within the event dispatching thread. All refresh will happen only when the control is relinquished.
To solve your problem, you need to perform those tasks in a background thread.
This might be helpful:
http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html
Regards,
Raj
 
Janis Derby
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks! That's what I needed.
One more question..
If you have a method that takes a parameter and uses it in an anonymous class it must be declared as final. Why?


-jd
 
raj madhuram
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
A couple of pointers:
http://mindprod.com/jglossanonymousclasses.html
http://www.javaranch.com/campfire/StoryInner.jsp
Raj
 
First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic