<commit_before>package edu.ucsb.cs56.projects.games.minesweeper;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/** StartMenu.java is a base that calls all GUI objects and handles tasks
    such as pausing the game, creating the GUI, making the escape key functional,
	and allowing for a new game.

     @author <NAME>
     @version CS56, Winter 2014, UCSB
*/

public class StartMenu {
	JButton newGame;
	JButton help;
	JButton newGamePause;
	JButton helpPause;
	JButton resume;
	JFrame frame;
	JPanel menu;
	JPanel game;
	JPanel pause;

	/** no-arg constructor which creates the GUI of the Main Menu for Minesweeper
	 *  This menu includes a start and help button
     */
	public StartMenu() {
		frame = new JFrame();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		createPausePanel();
		createMainMenu();

		frame.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
		frame.setSize(650, 600);
		frame.setVisible(true);
	}

	/** 
	 *  Starts a new Minesweeper game from the main menu
	 */
	public void newGame() {
		game = new JPanel(new BorderLayout());
		escapeListener();

		Interface grid = new GUIGrid();
		Messager m = new SOMessager();

		MineComponent mc = new MineComponent(grid, m);
		game.add(mc);
		menu.setVisible(false);
		pause.setVisible(false);
		frame.getContentPane().add(game);
	}

	/**
	 *  Pauses the game and brings up the pause menu
	 */
	public void pause() {
		frame.getContentPane().add(pause);
		game.setVisible(false);
		pause.setVisible(true);<commit_msg>added label explaining esc button<commit_after>package edu.ucsb.cs56.projects.games.minesweeper;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/** StartMenu.java is a base that calls all GUI objects and handles tasks
    such as pausing the game, creating the GUI, making the escape key functional,
	and allowing for a new game.

     @author <NAME>
     @version CS56, Winter 2014, UCSB
*/

public class StartMenu {
	JButton newGame;
	JButton help;
	JButton newGamePause;
	JButton helpPause;
	JButton resume;
	JFrame frame;
	JPanel menu;
	JPanel game;
	JPanel pause;

	/** no-arg constructor which creates the GUI of the Main Menu for Minesweeper
	 *  This menu includes a start and help button
     */
	public StartMenu() {
		frame = new JFrame();
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		createPausePanel();
		createMainMenu();

		frame.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
		frame.setSize(650, 600);
		frame.setVisible(true);
	}

	/** 
	 *  Starts a new Minesweeper game from the main menu
	 */
	public void newGame() {
		game = new JPanel(new BorderLayout());
		escapeListener();
		JLabel jl= new JLabel("Press esc to pause game");
		JPanel jp= new JPanel();
		jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
		Interface grid = new GUIGrid();
		Messager m = new SOMessager();
		
		MineComponent mc = new MineComponent(grid, m);
		jp.add(jl);
		jp.add(mc);
		game.add(jp);
		menu.setVisible(false);
		pause.setVisible(false);
		frame.getContentPane().add(game);
	}

	/**
	 *  Pauses the game and brings up the pause menu
	 */
	public void pause() {
		frame.getContentPane().add(pause);
		game.setVisible(false);
		pause.setVisible(true);
{'fraction_non_alphanumeric': 0.10874266295953043, 'fraction_numerical': 0.008649984553599012, 'mean_word_length': 3.989214175654854, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6200466', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1039, 'n_words': 316}