954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

JPanel help!!!

i'd like to ask how one can get rid of all the components in a JPanel (buttons, labels,
comboboxes etc), so that you can add new components (at run time that is)

DDirectJ
Newbie Poster
5 posts since Feb 2011
Reputation Points: 10
Solved Threads: 1
 

welcome on this forum

can you be so little bit concrete, because there are areas or options or posibilities

mKorbel
Veteran Poster
1,141 posts since Feb 2011
Reputation Points: 480
Solved Threads: 224
 

You can iterate through all the children of the JPanel removing them one at a time... but it's probably easier to remove the old JPanel from your window and replace it with a new empty one.

JamesCherrill
Posting Genius
Moderator
6,370 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
 

its okay i've discovered a method jPanel.removeAll(), and it works fine. Thanks for your help.

DDirectJ
Newbie Poster
5 posts since Feb 2011
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: