I have a question regarding coding a Swing UI. If I want to make a software with some option e.g. on the first Frame I have three buttons (New, Option, Exit).
Now if a user clicks the new button, I want to change the entire content in the Frame to something else. I know I have to use addActionListener to that button. But my question is how to change the contents in the frame. Creating new Frames and then use setVisible() isn't an option for me.
And to use frame.remove() all the objects seems awkward if it is several things that needs to be removed. Or is it the right way?
Look into the Card Layout. I would also probably use menu items instead of buttons.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With