1 Replies - 538 Views - Last Post: 03 April 2013 - 01:42 AM Rate Topic: -----

#1 steph_malcampo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 29-March 13

removing the horizontal scroll bar from my GUI program

Posted 01 April 2013 - 09:51 PM

Hi! My program is a memory game similar to a Nintendo DS game named Brain Age. My program flashes 30 words and gives the user 2 minutes to memorize all of them. Then the user is given 3 minutes to type as many words from the shown list. The 30 words are contained in a text file called 4 letter words.txt which is attached in this post.

What I need: The shuffled words should appear on the whole wordsTextArea only (without the need of any scroll bar). However, when I tried running my program, a horizontal scroll bar appeared. How do I remove the horizontal scroll bar? What modifications should I do to my code? Thank you in advance!


import java.awt.Component;
import java.awt.event.KeyEvent;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JOptionPane;
import javax.swing.JOptionPane;
import javax.swing.JOptionPane;
import javax.swing.KeyStroke;
import javax.swing.WindowConstants;
import java.io.*;
import java.util.Collections;
import java.util.ArrayList;


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * gameMenudraft1.java
 *
 * Created on 25-Mar-2013, 1:17:40 PM
 */
/**
 *
 * @author hp
 */
public class gameMenudraft1 extends javax.swing.JFrame {
   
    /** Creates new form gameMenudraft1 */
    public gameMenudraft1() {
        initComponents();
       
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        instructionsDialog = new javax.swing.JDialog();
        backToMenuInstructionsDialog = new javax.swing.JButton();
        instructionsLabel = new javax.swing.JLabel();
        backButtonInstructions = new javax.swing.JButton();
        nextButtonInstructions = new javax.swing.JButton();
        backNextSeparatorInstructions = new javax.swing.JSeparator();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        aboutTheGameDialog = new javax.swing.JDialog();
        backToMenuGameButton = new javax.swing.JButton();
        aboutTheGameLabel = new javax.swing.JLabel();
        aboutTheGameScrollPane = new javax.swing.JScrollPane();
        jTextArea2 = new javax.swing.JTextArea();
        aboutTheDevelopersDialog = new javax.swing.JDialog();
        aboutTheDevelopersLabel = new javax.swing.JLabel();
        backToMenuDevelopersDialog = new javax.swing.JButton();
        developersTab = new javax.swing.JTabbedPane();
        triciaTab = new javax.swing.JTabbedPane();
        patrickTab = new javax.swing.JTabbedPane();
        stephTab = new javax.swing.JTabbedPane();
        logInNewGameFrame = new javax.swing.JFrame();
        playersDetailsPanel = new javax.swing.JPanel();
        nameLabel = new javax.swing.JLabel();
        nameTextField = new javax.swing.JTextField();
        startGameButton = new javax.swing.JButton();
        backToMenuLogIn = new javax.swing.JButton();
        wordsFrame = new javax.swing.JFrame();
        wordsScrollPane = new javax.swing.JScrollPane();
        try{
            ArrayList<String> words30 = new ArrayList<String>();
            String line;
            BufferedReader fileIn1 = new BufferedReader(new FileReader("4 letter words.txt"));
            line = fileIn1.readLine();
            while ( line != null)
            {
                words30.add(line);
                line = fileIn1.readLine();
            }
            Collections.shuffle(words30);
            wordsTextArea = new javax.swing.JTextArea(50, words30.size());
            testButton = new javax.swing.JButton();
            wordsFrameLabel = new javax.swing.JLabel();
            hallOfFameFrame = new javax.swing.JFrame();
            hallOfFameLabel = new javax.swing.JLabel();
            hallOfFameScroll = new javax.swing.JScrollPane();
            BufferedReader fileIn = new BufferedReader(new FileReader("names.txt"));
            String fileName = fileIn.readLine();
            hallOfFameTextArea = new javax.swing.JTextArea(fileName);
            backToMenuHallButton = new javax.swing.JButton();
            userInputFrame = new javax.swing.JFrame();
            userInputTextField = new javax.swing.JTextField();
            jScrollPane3 = new javax.swing.JScrollPane();
            userInputTextArea = new javax.swing.JTextArea();
            submitButton = new javax.swing.JButton();
            userInputLabel = new javax.swing.JLabel();
            MenuBargameMenu1 = new javax.swing.JMenuBar();
            fileMenu1 = new javax.swing.JMenu();
            newGameMenuItem1 = new javax.swing.JMenuItem();
            exitGameMenuItem1 = new javax.swing.JMenuItem();
            helpMenu1 = new javax.swing.JMenu();
            instructionsMenuItem1 = new javax.swing.JMenuItem();
            helpMenuSeparator1 = new javax.swing.JPopupMenu.Separator();
            aboutTheGameMenuItem1 = new javax.swing.JMenuItem();
            aboutTheDevelopersMenuItem1 = new javax.swing.JMenuItem();
            MemoryGameLabel = new javax.swing.JLabel();
            newGameButton = new javax.swing.JButton();
            instructionsButton = new javax.swing.JButton();
            hallOfFameButton = new javax.swing.JButton();
            quitButton = new javax.swing.JButton();
            MenuBargameMenu = new javax.swing.JMenuBar();
            fileMenu = new javax.swing.JMenu();
            newGameMenuItem = new javax.swing.JMenuItem();
            exitGameMenuItem = new javax.swing.JMenuItem();
            helpMenu = new javax.swing.JMenu();
            instructionsMenuItem = new javax.swing.JMenuItem();
            helpMenuSeparator = new javax.swing.JPopupMenu.Separator();
            aboutTheGameMenuItem = new javax.swing.JMenuItem();
            aboutTheDevelopersMenuItem = new javax.swing.JMenuItem();

            instructionsDialog.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
            instructionsDialog.setTitle("How to play the Memory Game");
            instructionsDialog.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
            instructionsDialog.setMinimumSize(new java.awt.Dimension(570, 450));
            instructionsDialog.setLocationRelativeTo(null);
            instructionsDialog.getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

            backToMenuInstructionsDialog.setFont(new java.awt.Font("AR BONNIE", 0, 24));
            backToMenuInstructionsDialog.setMnemonic(KeyEvent.VK_M);
            backToMenuInstructionsDialog.setText("Back to Menu");
            backToMenuInstructionsDialog.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    backToMenuInstructionsDialogActionPerformed(evt);
                }
            });
            instructionsDialog.getContentPane().add(backToMenuInstructionsDialog, new org.netbeans.lib.awtextra.AbsoluteConstraints(190, 340, 180, 40));

            instructionsLabel.setFont(new java.awt.Font("Anticlimax", 0, 42));
            instructionsLabel.setText("How to play the game");
            instructionsDialog.getContentPane().add(instructionsLabel, new org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, -1, -1));

            backButtonInstructions.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Back.gif"))); // NOI18N
            backButtonInstructions.setMnemonic(KeyEvent.VK_LEFT);
            backButtonInstructions.setToolTipText("Back (ALT + LEFT ARROW KEY)");
            instructionsDialog.getContentPane().add(backButtonInstructions, new org.netbeans.lib.awtextra.AbsoluteConstraints(220, 300, -1, -1));

            nextButtonInstructions.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Forward.gif"))); // NOI18N
            nextButtonInstructions.setMnemonic(KeyEvent.VK_RIGHT);
            nextButtonInstructions.setToolTipText("Next (ALT + RIGHT ARROW KEY)");
            nextButtonInstructions.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    nextButtonInstructionsActionPerformed(evt);
                }
            });
            instructionsDialog.getContentPane().add(nextButtonInstructions, new org.netbeans.lib.awtextra.AbsoluteConstraints(280, 300, -1, -1));
            instructionsDialog.getContentPane().add(backNextSeparatorInstructions, new org.netbeans.lib.awtextra.AbsoluteConstraints(210, 290, 140, 40));

            jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);

            jTextArea1.setColumns(20);
            jTextArea1.setEditable(false);
            jTextArea1.setFont(new java.awt.Font("Monospaced", 0, 16));
            jTextArea1.setLineWrap(true);
            jTextArea1.setRows(5);
            jTextArea1.setText("1. \tThe player will be given a list of  \t30 4 letter words.\n\n\n2.\tThe player needs to study and  \n\tmemorize as many as possible. \n\n\n3.\tAfter 2 minutes, the player will \n\tbe given 3 minutes to type down\n\tall the words that he/she can \n\tremember from the list. \t");
            jTextArea1.setWrapStyleWord(true);
            jScrollPane1.setViewportView(jTextArea1);

            instructionsDialog.getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(70, 100, 450, 180));

            instructionsDialog.getAccessibleContext().setAccessibleDescription("");

            aboutTheGameDialog.setTitle("About Memory Game");
            aboutTheGameDialog.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
            aboutTheGameDialog.setMinimumSize(new java.awt.Dimension(450, 390));
            aboutTheGameDialog.setLocationRelativeTo(null);

            backToMenuGameButton.setFont(new java.awt.Font("AR BONNIE", 0, 24));
            backToMenuGameButton.setMnemonic(KeyEvent.VK_M);
            backToMenuGameButton.setText("Back to Menu");
            backToMenuGameButton.setToolTipText("About the game");
            backToMenuGameButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    backToMenuGameButtonActionPerformed(evt);
                }
            });

            aboutTheGameLabel.setFont(new java.awt.Font("Anticlimax", 0, 42));
            aboutTheGameLabel.setText("About the game");

            jTextArea2.setColumns(20);
            jTextArea2.setRows(5);
            aboutTheGameScrollPane.setViewportView(jTextArea2);

            javax.swing.GroupLayout aboutTheGameDialogLayout = new javax.swing.GroupLayout(aboutTheGameDialog.getContentPane());
            aboutTheGameDialog.getContentPane().setLayout(aboutTheGameDialogLayout);
            aboutTheGameDialogLayout.setHorizontalGroup(
                aboutTheGameDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(aboutTheGameDialogLayout.createSequentialGroup()
                    .addContainerGap(33, Short.MAX_VALUE)
                    .addGroup(aboutTheGameDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, aboutTheGameDialogLayout.createSequentialGroup()
                            .addComponent(backToMenuGameButton, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(128, 128, 128))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, aboutTheGameDialogLayout.createSequentialGroup()
                            .addGroup(aboutTheGameDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                .addComponent(aboutTheGameScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE)
                                .addComponent(aboutTheGameLabel))
                            .addGap(32, 32, 32))))
            );
            aboutTheGameDialogLayout.setVerticalGroup(
                aboutTheGameDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(aboutTheGameDialogLayout.createSequentialGroup()
                    .addGap(20, 20, 20)
                    .addComponent(aboutTheGameLabel)
                    .addGap(18, 18, 18)
                    .addComponent(aboutTheGameScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(backToMenuGameButton)
                    .addContainerGap(28, Short.MAX_VALUE))
            );

            aboutTheDevelopersDialog.setTitle("Developers of this game");
            aboutTheDevelopersDialog.setMinimumSize(new java.awt.Dimension(590, 450));
            aboutTheDevelopersDialog.setLocationRelativeTo(null);

            aboutTheDevelopersLabel.setFont(new java.awt.Font("Anticlimax", 0, 42));
            aboutTheDevelopersLabel.setText("About the developers");

            backToMenuDevelopersDialog.setFont(new java.awt.Font("AR BONNIE", 0, 24));
            backToMenuDevelopersDialog.setMnemonic(KeyEvent.VK_M);
            backToMenuDevelopersDialog.setText("Back to Menu");
            backToMenuDevelopersDialog.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    backToMenuDevelopersDialogActionPerformed(evt);
                }
            });

            developersTab.setToolTipText("");
            developersTab.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
            developersTab.setFont(new java.awt.Font("Batang", 0, 18));
            developersTab.setMinimumSize(new java.awt.Dimension(50, 100));

            triciaTab.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
            triciaTab.setToolTipText("Details about Tricia the developer");
            triciaTab.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
            triciaTab.setDebugGraphicsOptions(javax.swing.DebugGraphics.FLASH_OPTION);
            triciaTab.setMinimumSize(new java.awt.Dimension(200, 150));
            developersTab.addTab("Tricia Casiquin", triciaTab);

            patrickTab.setToolTipText("Details about Patrick the developer");
            developersTab.addTab("Patrick Gonzales", patrickTab);

            stephTab.setToolTipText("Details about Steph the developer");
            developersTab.addTab("Stephanie Malcampo", stephTab);

            javax.swing.GroupLayout aboutTheDevelopersDialogLayout = new javax.swing.GroupLayout(aboutTheDevelopersDialog.getContentPane());
            aboutTheDevelopersDialog.getContentPane().setLayout(aboutTheDevelopersDialogLayout);
            aboutTheDevelopersDialogLayout.setHorizontalGroup(
                aboutTheDevelopersDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(aboutTheDevelopersDialogLayout.createSequentialGroup()
                    .addGroup(aboutTheDevelopersDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(aboutTheDevelopersDialogLayout.createSequentialGroup()
                            .addGap(29, 29, 29)
                            .addGroup(aboutTheDevelopersDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(developersTab, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(aboutTheDevelopersLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addGroup(aboutTheDevelopersDialogLayout.createSequentialGroup()
                            .addGap(224, 224, 224)
                            .addComponent(backToMenuDevelopersDialog)))
                    .addContainerGap(39, Short.MAX_VALUE))
            );
            aboutTheDevelopersDialogLayout.setVerticalGroup(
                aboutTheDevelopersDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, aboutTheDevelopersDialogLayout.createSequentialGroup()
                    .addGap(23, 23, 23)
                    .addComponent(aboutTheDevelopersLabel)
                    .addGap(19, 19, 19)
                    .addComponent(developersTab, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(backToMenuDevelopersDialog)
                    .addContainerGap())
            );

            logInNewGameFrame.setTitle("Start Game");
            logInNewGameFrame.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
            logInNewGameFrame.setMinimumSize(new java.awt.Dimension(380, 280));
            logInNewGameFrame.setLocationRelativeTo(null);

            playersDetailsPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Player's name"));
            playersDetailsPanel.setMinimumSize(new java.awt.Dimension(400, 400));

            nameLabel.setFont(new java.awt.Font("Tahoma", 0, 14));
            nameLabel.setText("Name:");

            nameTextField.setToolTipText("Type in your name");

            startGameButton.setFont(new java.awt.Font("AR BONNIE", 0, 28));
            startGameButton.setText("Start Game!");
            startGameButton.setToolTipText("To start game");
            startGameButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
            startGameButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    startGameButtonActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout playersDetailsPanelLayout = new javax.swing.GroupLayout(playersDetailsPanel);
            playersDetailsPanel.setLayout(playersDetailsPanelLayout);
            playersDetailsPanelLayout.setHorizontalGroup(
                playersDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(playersDetailsPanelLayout.createSequentialGroup()
                    .addGroup(playersDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(playersDetailsPanelLayout.createSequentialGroup()
                            .addGap(97, 97, 97)
                            .addComponent(startGameButton))
                        .addGroup(playersDetailsPanelLayout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(nameLabel)
                            .addGap(27, 27, 27)
                            .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(39, Short.MAX_VALUE))
            );
            playersDetailsPanelLayout.setVerticalGroup(
                playersDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, playersDetailsPanelLayout.createSequentialGroup()
                    .addContainerGap(39, Short.MAX_VALUE)
                    .addGroup(playersDetailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(nameLabel))
                    .addGap(18, 18, 18)
                    .addComponent(startGameButton)
                    .addContainerGap())
            );

            backToMenuLogIn.setFont(new java.awt.Font("AR BONNIE", 0, 24));
            backToMenuLogIn.setMnemonic(KeyEvent.VK_M);
            backToMenuLogIn.setText("Back to Menu");
            backToMenuLogIn.setToolTipText("Back to Menu");
            backToMenuLogIn.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
            backToMenuLogIn.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    backToMenuLogInActionPerformed(evt);
                }
            });

            javax.swing.GroupLayout logInNewGameFrameLayout = new javax.swing.GroupLayout(logInNewGameFrame.getContentPane());
            logInNewGameFrame.getContentPane().setLayout(logInNewGameFrameLayout);
            logInNewGameFrameLayout.setHorizontalGroup(
                logInNewGameFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(logInNewGameFrameLayout.createSequentialGroup()
                    .addGroup(logInNewGameFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(logInNewGameFrameLayout.createSequentialGroup()
                            .addGap(18, 18, 18)
                            .addComponent(playersDetailsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGroup(logInNewGameFrameLayout.createSequentialGroup()
                            .addGap(102, 102, 102)
                            .addComponent(backToMenuLogIn, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(25, Short.MAX_VALUE))
            );
            logInNewGameFrameLayout.setVerticalGroup(
                logInNewGameFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(logInNewGameFrameLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(playersDetailsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(backToMenuLogIn)
                    .addContainerGap(20, Short.MAX_VALUE))
            );

            wordsFrame.setTitle("Memory Game");
            wordsFrame.setMinimumSize(new java.awt.Dimension(500, 450));
            wordsFrame.setLocationRelativeTo(null);

            for (String s : words30) {
                wordsTextArea.append(s);
            }
        } catch (Exception e) { }
        wordsTextArea.setColumns(20);
        wordsTextArea.setEditable(false);
        wordsTextArea.setRows(5);
        wordsScrollPane.setViewportView(wordsTextArea);

        testButton.setText("this leads to the user input frame");
        testButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                testButtonActionPerformed(evt);
            }
        });

        wordsFrameLabel.setFont(new java.awt.Font("AR BONNIE", 0, 36));
        wordsFrameLabel.setText("Memorize as many words as you can");

        javax.swing.GroupLayout wordsFrameLayout = new javax.swing.GroupLayout(wordsFrame.getContentPane());
        wordsFrame.getContentPane().setLayout(wordsFrameLayout);
        wordsFrameLayout.setHorizontalGroup(
            wordsFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(wordsFrameLayout.createSequentialGroup()
                .addGroup(wordsFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(wordsFrameLayout.createSequentialGroup()
                        .addGap(139, 139, 139)
                        .addComponent(testButton))
                    .addGroup(wordsFrameLayout.createSequentialGroup()
                        .addGap(36, 36, 36)
                        .addComponent(wordsFrameLabel))
                    .addGroup(wordsFrameLayout.createSequentialGroup()
                        .addGap(48, 48, 48)
                        .addComponent(wordsScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 376, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(48, Short.MAX_VALUE))
        );
        wordsFrameLayout.setVerticalGroup(
            wordsFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, wordsFrameLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(wordsFrameLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(wordsScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 230, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(testButton)
                .addGap(57, 57, 57))
        );

        hallOfFameFrame.setTitle("Hall of Fame");
        hallOfFameFrame.setMinimumSize(new java.awt.Dimension(380, 350));
        hallOfFameFrame.setLocationRelativeTo(null);

        hallOfFameLabel.setFont(new java.awt.Font("Anticlimax", 0, 42));
        hallOfFameLabel.setText("Hall of Fame");

        hallOfFameTextArea.setColumns(20);
        hallOfFameTextArea.setEditable(false);
        hallOfFameTextArea.setRows(5);
        hallOfFameScroll.setViewportView(hallOfFameTextArea);

        backToMenuHallButton.setFont(new java.awt.Font("AR BONNIE", 0, 24));
        backToMenuHallButton.setMnemonic(KeyEvent.VK_M);
        backToMenuHallButton.setText("Back to Menu");
        backToMenuHallButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                backToMenuHallButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout hallOfFameFrameLayout = new javax.swing.GroupLayout(hallOfFameFrame.getContentPane());
        hallOfFameFrame.getContentPane().setLayout(hallOfFameFrameLayout);
        hallOfFameFrameLayout.setHorizontalGroup(
            hallOfFameFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, hallOfFameFrameLayout.createSequentialGroup()
                .addContainerGap(25, Short.MAX_VALUE)
                .addGroup(hallOfFameFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(hallOfFameLabel, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(hallOfFameFrameLayout.createSequentialGroup()
                        .addGap(85, 85, 85)
                        .addComponent(backToMenuHallButton)
                        .addGap(96, 96, 96))
                    .addGroup(hallOfFameFrameLayout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addComponent(hallOfFameScroll, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(24, 24, 24))
        );
        hallOfFameFrameLayout.setVerticalGroup(
            hallOfFameFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(hallOfFameFrameLayout.createSequentialGroup()
                .addGap(19, 19, 19)
                .addComponent(hallOfFameLabel)
                .addGap(11, 11, 11)
                .addComponent(hallOfFameScroll, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(backToMenuHallButton)
                .addContainerGap(19, Short.MAX_VALUE))
        );

        userInputFrame.setTitle("Memory Game");
        userInputFrame.setMinimumSize(new java.awt.Dimension(600, 500));
        userInputFrame.setLocationRelativeTo(null);

        userInputTextField.setColumns(2);
        userInputTextField.setFont(new java.awt.Font("Tahoma", 0, 14));
        userInputTextField.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        userInputTextField.setToolTipText("Enter word here");
        userInputTextField.setBorder(null);
        userInputTextField.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));

        userInputTextArea.setColumns(3);
        userInputTextArea.setEditable(false);
        userInputTextArea.setForeground(new java.awt.Color(255, 0, 0));
        userInputTextArea.setLineWrap(true);
        userInputTextArea.setRows(5);
        userInputTextArea.setWrapStyleWord(true);
        userInputTextArea.setBorder(null);
        jScrollPane3.setViewportView(userInputTextArea);
        userInputTextArea.getAccessibleContext().setAccessibleDescription("Correct words you entered");

        submitButton.setFont(new java.awt.Font("AR BONNIE", 0, 24));
        submitButton.setMnemonic(KeyEvent.VK_ENTER);
        submitButton.setText("Submit");
        submitButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                submitButtonActionPerformed(evt);
            }
        });

        userInputLabel.setFont(new java.awt.Font("AR BONNIE", 0, 36));
        userInputLabel.setText("List as many words that you can remember");

        MenuBargameMenu1.setToolTipText("Menu Bar");
        MenuBargameMenu1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        MenuBargameMenu1.setFont(new java.awt.Font("Segoe UI", 0, 14));
        MenuBargameMenu1.setInheritsPopupMenu(true);

        fileMenu1.setMnemonic(KeyEvent.VK_F);
        fileMenu1.setText("File");
        fileMenu1.setToolTipText("File");
        fileMenu1.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        fileMenu1.setIconTextGap(5);
        fileMenu1.setName("File"); // NOI18N

        newGameMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK));
        newGameMenuItem1.setText("New Game");
        newGameMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                newGameMenuItem1ActionPerformed(evt);
            }
        });
        fileMenu1.add(newGameMenuItem1);

        exitGameMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.ALT_MASK));
        exitGameMenuItem1.setText("Exit Game");
        exitGameMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitGameMenuItem1ActionPerformed(evt);
            }
        });
        fileMenu1.add(exitGameMenuItem1);

        MenuBargameMenu1.add(fileMenu1);

        helpMenu1.setMnemonic(KeyEvent.VK_H);
        helpMenu1.setText("Help");
        helpMenu1.setToolTipText("Help");

        instructionsMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.ALT_MASK));
        instructionsMenuItem1.setText("How to Play");
        instructionsMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                instructionsMenuItem1ActionPerformed(evt);
            }
        });
        helpMenu1.add(instructionsMenuItem1);
        helpMenu1.add(helpMenuSeparator1);

        aboutTheGameMenuItem1.setText("About the Game");
        aboutTheGameMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aboutTheGameMenuItem1ActionPerformed(evt);
            }
        });
        helpMenu1.add(aboutTheGameMenuItem1);

        aboutTheDevelopersMenuItem1.setText("About the Developers");
        aboutTheDevelopersMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aboutTheDevelopersMenuItem1ActionPerformed(evt);
            }
        });
        helpMenu1.add(aboutTheDevelopersMenuItem1);

        MenuBargameMenu1.add(helpMenu1);

        userInputFrame.setJMenuBar(MenuBargameMenu1);

        javax.swing.GroupLayout userInputFrameLayout = new javax.swing.GroupLayout(userInputFrame.getContentPane());
        userInputFrame.getContentPane().setLayout(userInputFrameLayout);
        userInputFrameLayout.setHorizontalGroup(
            userInputFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(userInputFrameLayout.createSequentialGroup()
                .addContainerGap(87, Short.MAX_VALUE)
                .addGroup(userInputFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, userInputFrameLayout.createSequentialGroup()
                        .addGroup(userInputFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 318, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(userInputFrameLayout.createSequentialGroup()
                                .addGap(51, 51, 51)
                                .addComponent(userInputTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(userInputFrameLayout.createSequentialGroup()
                                .addGap(82, 82, 82)
                                .addComponent(submitButton, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(139, 139, 139))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, userInputFrameLayout.createSequentialGroup()
                        .addComponent(userInputLabel)
                        .addGap(70, 70, 70))))
        );
        userInputFrameLayout.setVerticalGroup(
            userInputFrameLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(userInputFrameLayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addComponent(userInputLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(userInputTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(submitButton)
                .addContainerGap(31, Short.MAX_VALUE))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Memory Game");
        setBackground(new java.awt.Color(153, 255, 153));
        setBounds(new java.awt.Rectangle(0, 0, 0, 0));
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        setMinimumSize(new java.awt.Dimension(470, 350));
        setResizable(false);

        MemoryGameLabel.setFont(new java.awt.Font("Anticlimax", 0, 53));
        MemoryGameLabel.setText("Memory Game");

        newGameButton.setFont(new java.awt.Font("AR BONNIE", 0, 30));
        newGameButton.setMnemonic(KeyEvent.VK_N);
        newGameButton.setText("New Game");
        newGameButton.setToolTipText("To start new game");
        newGameButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        newGameButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                newGameButtonActionPerformed(evt);
            }
        });

        instructionsButton.setFont(new java.awt.Font("AR BONNIE", 0, 30));
        instructionsButton.setMnemonic(KeyEvent.VK_I);
        instructionsButton.setText("Instructions");
        instructionsButton.setToolTipText("To know how to play the game");
        instructionsButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        instructionsButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                instructionsButtonActionPerformed(evt);
            }
        });

        hallOfFameButton.setFont(new java.awt.Font("AR BONNIE", 0, 30));
        hallOfFameButton.setMnemonic(KeyEvent.VK_P);
        hallOfFameButton.setText("Hall of Fame");
        hallOfFameButton.setToolTipText("To see rank of players ");
        hallOfFameButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        hallOfFameButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                hallOfFameButtonActionPerformed(evt);
            }
        });

        quitButton.setFont(new java.awt.Font("AR BONNIE", 0, 30));
        quitButton.setMnemonic(KeyEvent.VK_Q);
        quitButton.setText("Quit");
        quitButton.setToolTipText("To exit game");
        quitButton.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        quitButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                quitButtonActionPerformed(evt);
            }
        });

        MenuBargameMenu.setToolTipText("Menu Bar");
        MenuBargameMenu.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        MenuBargameMenu.setFont(new java.awt.Font("Segoe UI", 0, 14));
        MenuBargameMenu.setInheritsPopupMenu(true);

        fileMenu.setMnemonic(KeyEvent.VK_F);
        fileMenu.setText("File");
        fileMenu.setToolTipText("File");
        fileMenu.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        fileMenu.setIconTextGap(5);
        fileMenu.setName("File"); // NOI18N

        newGameMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N, java.awt.event.InputEvent.ALT_MASK));
        newGameMenuItem.setText("New Game");
        newGameMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                newGameMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(newGameMenuItem);

        exitGameMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_Q, java.awt.event.InputEvent.ALT_MASK));
        exitGameMenuItem.setText("Exit Game");
        exitGameMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitGameMenuItemActionPerformed(evt);
            }
        });
        fileMenu.add(exitGameMenuItem);

        MenuBargameMenu.add(fileMenu);

        helpMenu.setMnemonic(KeyEvent.VK_H);
        helpMenu.setText("Help");

        instructionsMenuItem.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_I, java.awt.event.InputEvent.ALT_MASK));
        instructionsMenuItem.setText("How to Play");
        instructionsMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                instructionsMenuItemActionPerformed(evt);
            }
        });
        helpMenu.add(instructionsMenuItem);
        helpMenu.add(helpMenuSeparator);

        aboutTheGameMenuItem.setText("About the Game");
        aboutTheGameMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aboutTheGameMenuItemActionPerformed(evt);
            }
        });
        helpMenu.add(aboutTheGameMenuItem);

        aboutTheDevelopersMenuItem.setText("About the Developers");
        aboutTheDevelopersMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aboutTheDevelopersMenuItemActionPerformed(evt);
            }
        });
        helpMenu.add(aboutTheDevelopersMenuItem);

        MenuBargameMenu.add(helpMenu);

        setJMenuBar(MenuBargameMenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(42, 42, 42)
                .addComponent(MemoryGameLabel)
                .addGap(28, 28, 28))
            .addGroup(layout.createSequentialGroup()
                .addGap(106, 106, 106)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(quitButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 224, Short.MAX_VALUE)
                    .addComponent(instructionsButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 224, Short.MAX_VALUE)
                    .addComponent(newGameButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 224, Short.MAX_VALUE)
                    .addComponent(hallOfFameButton, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 224, Short.MAX_VALUE))
                .addGap(127, 127, 127))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(MemoryGameLabel)
                .addGap(18, 18, 18)
                .addComponent(newGameButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(instructionsButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(hallOfFameButton)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(quitButton)
                .addContainerGap(15, Short.MAX_VALUE))
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-473)/2, (screenSize.height-355)/2, 473, 355);
    }// </editor-fold>//GEN-END:initComponents

    private void quitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quitButtonActionPerformed
            
       // System.exit(0);
        
        int exitAns = JOptionPane.showConfirmDialog(null, "Are you sure you want to exit?", "Exit?", JOptionPane.YES_NO_OPTION);  
    
        switch(exitAns)
        {
            case JOptionPane.YES_OPTION: System.exit(0);
                
            case JOptionPane.NO_OPTION: ;
        }
        
    }//GEN-LAST:event_quitButtonActionPerformed

    private void instructionsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_instructionsButtonActionPerformed
        
        instructionsDialog.setVisible(true);
        
    }//GEN-LAST:event_instructionsButtonActionPerformed

    private void backToMenuInstructionsDialogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backToMenuInstructionsDialogActionPerformed
        
        instructionsDialog.dispose();
        
    }//GEN-LAST:event_backToMenuInstructionsDialogActionPerformed

    private void exitGameMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitGameMenuItemActionPerformed
      
         int exitAns = JOptionPane.showConfirmDialog(null, "Are you sure you want to exit?", "Exit?", JOptionPane.YES_NO_OPTION);  
    
        switch(exitAns)
        {
            case JOptionPane.YES_OPTION: System.exit(0);
                
            case JOptionPane.NO_OPTION: ;
        }
        
    }//GEN-LAST:event_exitGameMenuItemActionPerformed

    private void instructionsMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_instructionsMenuItemActionPerformed
     
        instructionsDialog.setVisible(true);
    }//GEN-LAST:event_instructionsMenuItemActionPerformed

    private void aboutTheGameMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutTheGameMenuItemActionPerformed
        
        aboutTheGameDialog.setVisible(true);
        
    }//GEN-LAST:event_aboutTheGameMenuItemActionPerformed

    private void backToMenuGameButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backToMenuGameButtonActionPerformed
        
        aboutTheGameDialog.dispose();
    }//GEN-LAST:event_backToMenuGameButtonActionPerformed

    private void aboutTheDevelopersMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutTheDevelopersMenuItemActionPerformed
        
        aboutTheDevelopersDialog.setVisible(true);
    }//GEN-LAST:event_aboutTheDevelopersMenuItemActionPerformed

    private void backToMenuDevelopersDialogActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backToMenuDevelopersDialogActionPerformed
       
        aboutTheDevelopersDialog.dispose();
    }//GEN-LAST:event_backToMenuDevelopersDialogActionPerformed

    private void newGameButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newGameButtonActionPerformed
        
        logInNewGameFrame.setVisible(true);
        //logInNewGameFrame.isAncestorOf(JFrame);
       
       
    }//GEN-LAST:event_newGameButtonActionPerformed

    private void backToMenuLogInActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backToMenuLogInActionPerformed
        
        logInNewGameFrame.dispose();
    }//GEN-LAST:event_backToMenuLogInActionPerformed

    private void newGameMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newGameMenuItemActionPerformed
        
        logInNewGameFrame.setVisible(true);
        
    }//GEN-LAST:event_newGameMenuItemActionPerformed

    private void startGameButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_startGameButtonActionPerformed

       try{
        String name = nameTextField.getText();
        nameTextField.selectAll();
       // boolean append = true;
 
        if (name.equals(""))
        {
            JOptionPane.showMessageDialog(logInNewGameFrame, "You did not enter your name. Try again.", "Oops..", JOptionPane.ERROR_MESSAGE);  
        }
        else
        {
              PrintWriter fileWrite = new PrintWriter("names.txt");
              //  BufferedReader fileIn = new BufferedReader(new FileReader("name.txt"));
               // FileWriter outFile = new FileWriter("name.txt");
                
                fileWrite.write("\t" + name);
                //outFile.write("\t" + name);
                
                fileWrite.close();
                 //outFile.close();
                
            wordsFrame.setVisible(true);
            logInNewGameFrame.dispose();
            
        }
      } catch(Exception e) { }
       
    }//GEN-LAST:event_startGameButtonActionPerformed

    private void newGameMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newGameMenuItem1ActionPerformed
        
          int exitAns = JOptionPane.showConfirmDialog(null, "Are you sure you want to start another game?", "Start new?", JOptionPane.YES_NO_OPTION);  
    
        switch(exitAns)
        {
            case JOptionPane.YES_OPTION:  logInNewGameFrame.setVisible(true);
                                            userInputFrame.dispose();
                                               //pause timer
                
            case JOptionPane.NO_OPTION: ;
        }
       
    }//GEN-LAST:event_newGameMenuItem1ActionPerformed

    private void exitGameMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitGameMenuItem1ActionPerformed
           
        int exitAns = JOptionPane.showConfirmDialog(null, "Are you sure you want to exit?", "Exit?", JOptionPane.YES_NO_OPTION);  
    
        switch(exitAns)
        {
            case JOptionPane.YES_OPTION: System.exit(0);
                
            case JOptionPane.NO_OPTION: ;
        }
        
    }//GEN-LAST:event_exitGameMenuItem1ActionPerformed

    private void instructionsMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_instructionsMenuItem1ActionPerformed
        
        //pause timer
        
        instructionsDialog.setVisible(true);
    }//GEN-LAST:event_instructionsMenuItem1ActionPerformed

    private void aboutTheGameMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutTheGameMenuItem1ActionPerformed
      
        //pause timer
        
        aboutTheGameDialog.setVisible(true);
    }//GEN-LAST:event_aboutTheGameMenuItem1ActionPerformed

    private void aboutTheDevelopersMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aboutTheDevelopersMenuItem1ActionPerformed
       
        //pause timer
        
        aboutTheDevelopersDialog.setVisible(true);
    }//GEN-LAST:event_aboutTheDevelopersMenuItem1ActionPerformed

    private void backToMenuHallButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_backToMenuHallButtonActionPerformed
        
        hallOfFameFrame.dispose();
        
    }//GEN-LAST:event_backToMenuHallButtonActionPerformed

    private void hallOfFameButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_hallOfFameButtonActionPerformed
       
        hallOfFameFrame.setVisible(true);
    }//GEN-LAST:event_hallOfFameButtonActionPerformed

    private void submitButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_submitButtonActionPerformed
      try{ 

          String input = userInputTextField.getText();	          
        
        if (input.equals(""))
        {
               JOptionPane.showMessageDialog(userInputFrame, "You didn't enter any word. Try again.", "Oops..", JOptionPane.ERROR_MESSAGE);  
        }
     /*   if (input.equals(userInputTextArea.isShowing()))        //PROBLEM
        {
            JOptionPane.showMessageDialog(userInputFrame, "You already entered that word. Try again.", "Oops..", JOptionPane.PLAIN_MESSAGE);  
        }*/
        else
        {
            userInputTextField.selectAll();
            userInputTextArea.append(input.toUpperCase() + "\n");
            //userInputTextArea.setCaretPosition(userInputTextArea.getDocument().getLength());
            userInputTextField.setText("");
        }
        
      } catch (Exception e) { }
        
    }//GEN-LAST:event_submitButtonActionPerformed

    private void testButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_testButtonActionPerformed
      
        userInputFrame.setVisible(true);
        wordsFrame.dispose();
        
    }//GEN-LAST:event_testButtonActionPerformed

    private void nextButtonInstructionsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextButtonInstructionsActionPerformed
       
        //instructionsLabel1.disable();
    }//GEN-LAST:event_nextButtonInstructionsActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(gameMenudraft1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(gameMenudraft1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(gameMenudraft1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(gameMenudraft1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new gameMenudraft1().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel MemoryGameLabel;
    private javax.swing.JMenuBar MenuBargameMenu;
    private javax.swing.JMenuBar MenuBargameMenu1;
    private javax.swing.JDialog aboutTheDevelopersDialog;
    private javax.swing.JLabel aboutTheDevelopersLabel;
    private javax.swing.JMenuItem aboutTheDevelopersMenuItem;
    private javax.swing.JMenuItem aboutTheDevelopersMenuItem1;
    private javax.swing.JDialog aboutTheGameDialog;
    private javax.swing.JLabel aboutTheGameLabel;
    private javax.swing.JMenuItem aboutTheGameMenuItem;
    private javax.swing.JMenuItem aboutTheGameMenuItem1;
    private javax.swing.JScrollPane aboutTheGameScrollPane;
    private javax.swing.JButton backButtonInstructions;
    private javax.swing.JSeparator backNextSeparatorInstructions;
    private javax.swing.JButton backToMenuDevelopersDialog;
    private javax.swing.JButton backToMenuGameButton;
    private javax.swing.JButton backToMenuHallButton;
    private javax.swing.JButton backToMenuInstructionsDialog;
    private javax.swing.JButton backToMenuLogIn;
    private javax.swing.JTabbedPane developersTab;
    private javax.swing.JMenuItem exitGameMenuItem;
    private javax.swing.JMenuItem exitGameMenuItem1;
    private javax.swing.JMenu fileMenu;
    private javax.swing.JMenu fileMenu1;
    private javax.swing.JButton hallOfFameButton;
    private javax.swing.JFrame hallOfFameFrame;
    private javax.swing.JLabel hallOfFameLabel;
    private javax.swing.JScrollPane hallOfFameScroll;
    private javax.swing.JTextArea hallOfFameTextArea;
    private javax.swing.JMenu helpMenu;
    private javax.swing.JMenu helpMenu1;
    private javax.swing.JPopupMenu.Separator helpMenuSeparator;
    private javax.swing.JPopupMenu.Separator helpMenuSeparator1;
    private javax.swing.JButton instructionsButton;
    private javax.swing.JDialog instructionsDialog;
    private javax.swing.JLabel instructionsLabel;
    private javax.swing.JMenuItem instructionsMenuItem;
    private javax.swing.JMenuItem instructionsMenuItem1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextArea jTextArea2;
    private javax.swing.JFrame logInNewGameFrame;
    private javax.swing.JLabel nameLabel;
    private javax.swing.JTextField nameTextField;
    private javax.swing.JButton newGameButton;
    private javax.swing.JMenuItem newGameMenuItem;
    private javax.swing.JMenuItem newGameMenuItem1;
    private javax.swing.JButton nextButtonInstructions;
    private javax.swing.JTabbedPane patrickTab;
    private javax.swing.JPanel playersDetailsPanel;
    private javax.swing.JButton quitButton;
    private javax.swing.JButton startGameButton;
    private javax.swing.JTabbedPane stephTab;
    private javax.swing.JButton submitButton;
    private javax.swing.JButton testButton;
    private javax.swing.JTabbedPane triciaTab;
    private javax.swing.JFrame userInputFrame;
    private javax.swing.JLabel userInputLabel;
    private javax.swing.JTextArea userInputTextArea;
    private javax.swing.JTextField userInputTextField;
    private javax.swing.JFrame wordsFrame;
    private javax.swing.JLabel wordsFrameLabel;
    private javax.swing.JScrollPane wordsScrollPane;
    private javax.swing.JTextArea wordsTextArea;
    // End of variables declaration//GEN-END:variables

}




Is This A Good Question/Topic? 0
  • +

Replies To: removing the horizontal scroll bar from my GUI program

#2 steph_malcampo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 29-March 13

Re: removing the horizontal scroll bar from my GUI program

Posted 03 April 2013 - 01:42 AM

I was already able to figure this out. Thanks anyway
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1