Java Swing architecture for flipping through JPane based views
- by imhotep
Hi all,
I have done a couple of simple swing based apps with static layout, but now I've run into a problem while trying to create an app containing multiple views which are changed by pressing appropriate navigational button.
You could compare the idea to a website so that every view has buttons to access certain other views but this would work inside a single JFrame.
I've found that maybe CardLayout (Cardlayout example) might be appropriate solution for this kind of structure, but I'm unable to figure out a way to switch the views from the buttons which are inside of the JPanes that I've implemented in their separate classes,
Of course one way would be to instantiate everything in the parent class like in the small java tutorial example, but this isn't quite clean nor modular for multiple views, isn't it.
How can this be implemented so that I can access the view switching method?