• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet won't repaint properly

 
Debbie Figg
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • 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
 
Joe Ess
Bartender
Posts: 9337
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic