Reputation: 1090
I have drawn some buttons on a JFrame, however when the user clicks the "Shop" button, I would like to wipe what is currently drawn and draw some new stuff.
When the user clicks the "Shop" button again, I would like to close the shop and for the old stuff to re-appear again and the shop menu to dispensary.
How can I do this without creating an entire new JFrame?
Upvotes: 0
Views: 144
Reputation: 1750
To "undraw" something you can call setVisible(false) on Components. For multiple windows I would use a JPanel and add or remove other panels, which hold your controlls. Maybe you want to have a look at JTabbedPane it seems like that is what you are looking for.
Upvotes: 2