Jump to content
  • Advertisement
Sign in to follow this  
Sfpiano

[java] Removing swing widgets from the panel

This topic is 4663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want my gui to dynamically change when certain buttons are pressed. My idea was to have a set of main menu buttons, and then when one of them was pressed the screen would change to show the corresponding action. However I can't seem to get rid of the buttons without the entire frame getting erased. I called JFrame.removeAll(), but that completely erased the entire frame so that when I try to add new widgets they don't appear; I had to recreate the frame in order for anything to work.

Share this post


Link to post
Share on other sites
Advertisement
well do you want to remove or hide the components? if i understand correctly you have different buttons, each of them leading to some different panes. Then maybe try using CardLayout - you can with this layout add many panels representing different areaswith only one showing up at a time and you may switch between cards.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!