Is it possible to create something like a loading phase (contains progressbar and label etc.) then after loading is done switch to next phase with different controls like button etc. without creating a new Window for each of the phases? I know I could probably do this using panels and changing their visibility but if they all overlaped it would be really hard to add or edit the controls. I want to create a game and it would be really annoying if a new window opened almost everytime user did something. (example Main menu -> Shop -> Back to main menu etc.)
Asked
Active
Viewed 71 times
1
-
1Please have a look at [CardLayout](https://docs.oracle.com/javase/tutorial/uiswing/layout/card.html) :-) One small [example](http://stackoverflow.com/a/12284563/1057230) and another [example](http://stackoverflow.com/a/17876938/1057230) and another [example](http://stackoverflow.com/a/9425769/1057230) – nIcE cOw Jul 17 '15 at 15:05
-
1Thanks, exactly what I was looking for :) – Ladas125 Jul 17 '15 at 15:07
1 Answers
2
There are two ways to do this: Static and dynamic
The static way is easier, and you can accomplish it using a CardLayout. The dynamic way would require you to create methods for each screen change, which would clear all previous content and insert the appropriate controls.
http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html

ControlAltDel
- 33,923
- 10
- 53
- 80