Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

Refresh Applet  RSS feed

 
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.
 
Bartender
Posts: 9550
12
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.
 
A day job? In an office? My worst nightmare! Comfort me tiny ad!
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!