Java Swing architecture for flipping through JPane based views

Posted by imhotep on Stack Overflow See other posts from Stack Overflow or by imhotep
Published on 2010-05-05T11:20:00Z Indexed on 2010/05/05 11:48 UTC
Read the original article Hit count: 201

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about swing