Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can anyone please help??

 
yue feng
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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...
 
Brent Worden
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • 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);
//...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic