-1

When my program launches, a window (aka "StartWindow") opens that has 3 options: New Game/Load Game/Exit. When New Game or Load Game is clicked (and after some input), the game window (aka "GameWindow") will open so the user can play.

When the GameWindow opens, I would like to have the StartWindow close. And when the GameWindow closes, the StartWindow will open until the actual "EXIT" button is clicked.

Is there a way to do this? Right now, the only way I can achieve something similar to this is having a boolean called "gameRunning". When this is true, the buttons on StartWindow will have no action when clicked. Opposite when false.

For example purposes, suppose that each window has 3 buttons, a text field, and nothing else.

Aaron
  • 992
  • 3
  • 15
  • 33

1 Answers1

2

Use setVisible(false) method on parent before opening any child window. When child window closes call setVisible(true). It will solve your problem

Sudhir Dhumal
  • 902
  • 11
  • 22