• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Refresh Applet

 
Joe Pawlak
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an applet that contains JTextFields, JButtons, JLabels, etc. When one of the buttons is pressed I use removeAll() to clear the applet so I can add different components to the screen. The problem is that the applet does not refresh. Everything clears, but the new components do not show up until the appletviewer screen is resized, or the an event happens in the browser window. For example, if I were to print the page, then it would refreh.
Is there a way to refresh this without resizing the window?
Thanks.
 
Joe Ess
Bartender
Posts: 9340
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think invoking validate() on the container will check if the layout is valid and cause everything to be laid out and repainted if necessary. If you are presenting several screens to the user it will be easier to use java.awt.CardLayout to set up the screens ahead of time and flip through them.
 
Joe Pawlak
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Joe.
validate() worked and I've never heard of CardLayout. I'll have to give that a try.
Thanks again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic