Good afternoon!
I am making a game in Java. My menu button includes a new game, HighScore, About and Quit. But before the user can go to the main game, he needs to first dial his name. I used this code as follows:
private void btnNewGameMouseClicked(java.awt.event.MouseEvent evt) {
Player p1 = new Player();
this.setVisible(false);
p1.setVisible(true);
}
My problem is that I do not want to hide the main menu. I want it to depend and cannot be accessed when prompted for a player name.
The frame of my main menu is larger than the frame of the player. Of course, I can simply delete the code this.setVisible(false), but the problem is that I can still access the main menu when pressed ... I want the main menu to freeze and cannot be accessed when the player frame appears. (See image below) Please help me. Thank.

source
share