How to move from one Panel to another in a single frame without using CardLayout?
问题 I have three Panels and a single Frame in my program. I want to close/hide the current panel and show/activate the next panel. I am designing a game, hence I do not want to use CardLayout . private void select() { if (currentChoice == 0) { f.remove(gpanel1); gpanel = new GamePanel(); f.add(gpanel); } } Here f is the frame object. gpanel1 and gpanel are the initialized panel objects (constructors have already been called from the frame class). How do I hide the old panel and move to the next