-2

I have a question.

I just started with Java and may have some small basic things. Now I wonder how a kind of pages (sections) in a program makes. I do not mean some kind of tabbed panel, or if you click on a button that a text is visible.

I mean that for example all over the screen a separate part of the program looks. As the main menu of a game. There is nothing else than the main menu visible at that time. If you for example a button from that menu click. The game is loading. (I'm using the building of a standard game as an example) If you for example the main menu click on another button (eg "Settings") Then wort settings "page" is visible, and there is nothing else that the program is really doing. I do not know how this type of navigation is called. But almost every program does have something. How can I do this too? What should I do for example, as a new file, import the classes of a particular page, or something?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • You will have to do this on yourself unless you find some kind of framework with this functionality – Stefan Jan 12 '13 at 12:57
  • Sorry, but your English is not perfect. That's hard to understand what you need. – Archer Jan 12 '13 at 12:58
  • How are you rendering the application? Is it a web application? Is it a traditional [gui](http://stackoverflow.com/questions/7358775/java-gui-frameworks-what-to-choose-swing-swt-awt-swingx-jgoodies-javafx)? – Quentin Jan 12 '13 at 13:02

3 Answers3

6

You seem to be searching for CardLayout. As shown here.

Game view High Scores view

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
1

I think you should look for "state machines", which is a way for structuring your code, and implement your menu changing swing components (like JPanel, for example) in a JFrame. If I understand what you want, I think this can be an option.

Laerte
  • 7,013
  • 3
  • 32
  • 50
0

There is no short answer, but based on your question, you need to read alot. I would suggest the swing tutorial It explains use of Panels, Frames, Layout managers and other containers.

You can also use the Matisse builder in netbeans (relevant plugin in eclipse)

Nasir
  • 2,984
  • 30
  • 34