• 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

Label not repainting inside method.

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trying to paint 2 diferent icons in succession with a pause in between, but it only seems to repaint the label on exiting the method.

i.e. in the following code it pauses 4 seconds then changes the label to show the WARRIOR icon, and if I swap the images around only the black is shown.

Any ideas?

Thanks in advance

Paul.

final void TowerShow {
ti.ShowImage(Tower.picLabel, ti.BLACK);
Tower.picLabel.repaint();
Pause(4); //Pauses 4 Seconds - def. works
ti.ShowImage(Tower.picLabel, ti.WARRIOR);
}
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, I guess you are doing this on the event dispatch thread, which is also responsible for redrawing the GUI. So as long as your method runs, the GUI cannot be redrawn.

If that's the case, you will need to execute that code on a different thread.

Moving to our Swing forum...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic