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.ArrayList;
import java.util.Collections;
/*
* 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();
instructionsScrollPane = new javax.swing.JScrollPane();
instructionsTextArea = new javax.swing.JTextArea();
instructionsLabel = new javax.swing.JLabel();
aboutTheGameDialog = new javax.swing.JDialog();
backToMenuGameButton = new javax.swing.JButton();
aboutTheGameScrollPane = new javax.swing.JScrollPane();
aboutTheGameLabel = new javax.swing.JLabel();
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{
/* BufferedReader fileIn1 = new BufferedReader(new FileReader("4 letter words.txt"));
String line = fileIn1.readLine();
String words30 = "";
for (int i = 0; i < 31 ; i++)
{
words30 = fileIn1.readLine();
}
*/
ArrayList words30 = new ArrayList();
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());
for (String s : words30) {
wordsTextArea.append(s);
}
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, 370));
instructionsDialog.setLocationRelativeTo(null);
instructionsDialog.getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
backToMenuInstructionsDialog.setFont(new java.awt.Font("AR BONNIE", 0, 24)); // NOI18N
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(180, 270, 180, 40));
instructionsTextArea.setBackground(new java.awt.Color(0, 0, 0));
instructionsTextArea.setColumns(20);
instructionsTextArea.setEditable(false);
instructionsTextArea.setFont(new java.awt.Font("Candara", 1, 14));
instructionsTextArea.setForeground(new java.awt.Color(255, 255, 255));
instructionsTextArea.setRows(5);
instructionsTextArea.setTabSize(4);
instructionsTextArea.setText("\t\t\n\t The player will be given a list of 30 4-letter words.\n\n\n\tThe player needs to study and memorize as many as possible. \n\n\n\tAfter 2 minutes, the player will be given 3 minutes to type down \n\t all the words that he/she can remember from the list.\n\n\n\t\t \t\tENJOY!\t\t");
instructionsTextArea.setToolTipText("Instructions\n");
instructionsTextArea.setWrapStyleWord(true);
instructionsTextArea.setAlignmentX(5.0F);
instructionsTextArea.setBorder(null);
instructionsScrollPane.setViewportView(instructionsTextArea);
instructionsTextArea.getAccessibleContext().setAccessibleName("Instructions");
instructionsDialog.getContentPane().add(instructionsScrollPane, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 80, 470, 180));
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));
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)); // NOI18N
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);
}
});
aboutTheGameScrollPane.setToolTipText("About the game");
aboutTheGameLabel.setFont(new java.awt.Font("Anticlimax", 0, 42)); // NOI18N
aboutTheGameLabel.setText("About the game");
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()
.addGroup(aboutTheGameDialogLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(aboutTheGameScrollPane)
.addComponent(aboutTheGameLabel))
.addGap(32, 32, 32))
.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))))
);
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, 206, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.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)); // NOI18N
aboutTheDevelopersLabel.setText("About the developers");
backToMenuDevelopersDialog.setFont(new java.awt.Font("AR BONNIE", 0, 24)); // NOI18N
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);
} 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)); // NOI18N
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)); // NOI18N
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)); // NOI18N
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)); // NOI18N
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)); // NOI18N
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)); // NOI18N
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)); // NOI18N
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
/**
* @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 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 instructionsScrollPane;
private javax.swing.JTextArea instructionsTextArea;
private javax.swing.JScrollPane jScrollPane3;
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.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
}