Take the 2-minute tour ×  I've just started creating my very
first little Java Swing app. When the program opens, it brings
up a single, simple window with a label and a couple buttons.
Clicking one of those buttons is supposed to wipe out the
welcome screen and replace it with a totally different panel.
I'm not sure what the best way to create that functionality is.
One method would be to pass my JFrame as an argument into...
just about every other component, but that feels hacky to me.
Or, there's making each panel double as an action listener, but
that doesn't seem right, either.  Is there a design pattern I
should be applying here? "Replace the contents of the main — and
only — window" must be a reasonably common operation. A name for
the pattern would be enough; I can use Google on my own from
there. (I wouldn't say no to a longer explanation, though.)
share|improve this question This being a question about actual
programming techniques, you'll likely get a lot more answers on
Stack Overflow. –  Alex F