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

JOptionPane not repainting

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Time flies like an arrow. Fruit flies like a banana. Steve flies like a tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic