wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JOptionPane not repainting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JOptionPane not repainting" Watch "JOptionPane not repainting" New topic
Author

JOptionPane not repainting

Tim Clark
Greenhorn

Joined: Apr 22, 2004
Posts: 1
Hi there!
I am writing a GUI which has a JOptionPane (called from a JButton's action performed method) which doesnt repaint the background when i click ok.
Here is a code snippet inside the JButtonActionPerformed method:

After clicking OK on the OptionPane it closes and runs my method printWeeklyReport but the stuff behind the optionPane just remains greyed out until the printWeeklyReport method finishes.
I am new to threads...so I could be completely on the wrong track here.
Any help would be greatly appreciated!
Jeremy Maddera
Greenhorn

Joined: May 02, 2002
Posts: 16
first you are running your print weekly report on the Event Thread. The Event Thread is the thread that paints the UI. The UI will not repaint until the print weekly report is completed.....You need to run the print weekly report in a different thread. after it is completed then update the UI with a thread the runs in the Event Thread to update any UI Objects...
Look at the SwingWorker class on the Sun site
http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html
 
 
subject: JOptionPane not repainting
 
Similar Threads
JOptionPane behavior
Problem with keystrokes and JOptionPane
key listener not detected
setting bg in jDialog
Customise JOptionPane