Swing: Switching between components in application
The thing is I want to be able to switch from one inner panel to another with a keypress or some other action. For example, say I have two panels called title and work. When title is visible, I want it so that if I press a key, say ENTER, title is hidden and work is shown. I'd also want to switch from work to title, pressing ESCAPE for example. I might also have a third inner panel, say preferences, which I get to from work by pressing P, and returning to work from preferences with ESCAPE.
I'm sort of under the impression that I could use a CardLayout for my outer panel. The question is how to affect it from inside the inner panels. I've thought a little about making a subclass of Action which are generated by the inner panels and listened to by the outer panel; to tell the outer panel which inner panel to switch to. I don't know enough yet about Actions to figure out how to do that though.
If someone could give me a few pointers to how I might accomplish what I've described I'd be appreciative.
Thanks,
Aaron J. M.

