• 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

Can anyone please help??

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to remove all the components from my frame(instance of jframe class) and then add everything to it again. what i used is removeAll() function(after that, i rerendered everyone back on my frame again). however, once i add this function, all my components would not show up, and even the frame was minimized when starting the program. does anyone have any idea why?
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I'm not up to par with Swing enough, but here's a stab at things using the AWT...
This does what you might be attempting to do (though using the AWT - not Swing):

If you were to post some code (in the simplest form necessary) to replicate what you're attempting to do...
Good Luck.
 
yue feng
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply, but for some reason, i have to use swing other than awt. Does anyone else have any suggestions?
Thanks a lot in advance
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Dirk Schreckmann:
If you were to post some code (in the simplest form necessary) to replicate what you're attempting to do...

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by yue feng:
I am trying to remove all the components from my frame(instance of jframe class) and then add everything to it again. what i used is removeAll() function(after that, i rerendered everyone back on my frame again). however, once i add this function, all my components would not show up, and even the frame was minimized when starting the program. does anyone have any idea why?


After you call removeAll, make sure you re-add each component to the frame:
frame.getContentPane().removeAll();
// need to add components back to frame:
frame.getContentPane().add(component1);
frame.getContentPane().add(component2);
frame.getContentPane().add(component3);
//...
 
reply
    Bookmark Topic Watch Topic
  • New Topic