• 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
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Refresh Applet

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
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
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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Hot dog! An advertiser loves us THIS much:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic