views:

64

answers:

2

I am developing a Java application, well, it's actually a small game. I want to build up the application as follows: when it starts, a window should appear which has a menu with four choices: 'Start game', 'Options', 'Highscores' and 'Quit'. If you then click game, the game starts, preferrably in the same window, if you click options, well you know the drill.

How should I program this? At the moment, I'm considering using a CardLayout, but I'm not sure this is the right way to do this.

Do you guys maybe have another proposition?

A: 

Functionally you can do this with any LayoutManager you choose. The only difference is going to be aesthetics. This is a very open ended question and GUI programming is a complex area. The best way to get better is with practice. Try it out with CardLayout and when you run into specific problems make sure to ask them.

Pace
Thank you very much!
Javalicious
A: 

Basically you have four different views: the menu view, the game view, the options view and the highscores view. And you want only one to be displayed at any time. CardLayout fulfills that requirement - only one panel is visible at a time and you can switch between panels (like from menu to highscores, back to menu, then to game). Looks fine to me.

Andreas_D