This content has been marked as final. Show 1 reply
At Swing level, having 10 panels "alive" in memory will cause zero CPU and memory problem. Period.
So I suggest you look at the Swing tutorial lesson for CardLayout , whose job is exactly to display one panel at a time within a group of several: http://docs.oracle.com/javase/tutorial/uiswing/layout/card.html
Now, maybe having one of your panels, with all the non-graphical object graph it represents, implies some memory/CPU hog. Then I suggest to investigate that in your applicative object code. This will probably be investigated more simply on a sketch frame with only one panel; when you're done, try adding a second panel, switching with CardLayout, and investigate whether anything odd occurs; then you can light-heartedly go to 10 panels, and do validation and profiling.
If you can already foresee, given your application's functionality (maybe each panel has to display a huge dataset fetched from DB), then you can start thinking about asynchronously load/discard data in your panel(s). That may or may not be quite involved if you're new with Swing, and you will certainly have to read the tutorial chapter on Swing and threads http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html (you will have to read it anyway if you do almost anything non-trivial in Swing).