• 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

Applet won't repaint properly

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have an applet that displays two screens and a button is used to transfer between them. The way I need to do it (it's a course project) is to remove all the previous objects using removeAll, create the relevant objects for the new panel and then use repaint to display everything.
The trouble is, when I press the button, nothing seems to happen until I move my mouse, then everything disappears and the only way I can get the new panel to display is to click somewhere on the applet window's border. Then everything in the new panel displays perfectly.
So does anyone know of a way to make the applet display the new panel on it's own without any input from me?
The relevant code I'm using is:

Debbie-Leigh
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try looking at CardLayout. You can populate a number of panels and easily switch between them. It's much easier to work with than using remove and add over and over.
 
reply
    Bookmark Topic Watch Topic
  • New Topic