librejack

Blackjack clone written in java
git clone https://github.com/michaelneuper/librejack.git
README | Files | Log | Refs | LICENSE

commit 15712c652182bf8ee1a1d6c5a6dfb909eb39c1c5
parent 19fb50c232b0436dbb2eccd7fc16a7b82e024527
Author: Michael Neuper <michael@michaelneuper.com>
Date:   Thu, 11 May 2023 20:41:34 +0200

Remove old GUI classes

Diffstat:
Dsrc/view/LoginGUI.form | 313-------------------------------------------------------------------------------
Dsrc/view/LoginGUI.java | 322-------------------------------------------------------------------------------
Dsrc/view/MainGUI.form | 335-------------------------------------------------------------------------------
Dsrc/view/MainGUI.java | 374-------------------------------------------------------------------------------
4 files changed, 0 insertions(+), 1344 deletions(-)

diff --git a/src/view/LoginGUI.form b/src/view/LoginGUI.form @@ -1,313 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> - -<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> - <NonVisualComponents> - <Container class="javax.swing.JPanel" name="jPanel3"> - <Properties> - <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> - <Color blue="0" green="cc" red="33" type="rgb"/> - </Property> - </Properties> - - <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/> - </Container> - </NonVisualComponents> - <Properties> - <Property name="defaultCloseOperation" type="int" value="3"/> - <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> - <Color blue="99" green="99" red="99" type="rgb"/> - </Property> - <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> - <Dimension value="[829, 786]"/> - </Property> - </Properties> - <SyntheticProperties> - <SyntheticProperty name="formSizePolicy" type="int" value="1"/> - <SyntheticProperty name="generateCenter" type="boolean" value="false"/> - </SyntheticProperties> - <AuxValues> - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> - </AuxValues> - - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace min="43" pref="43" max="-2" attributes="0"/> - <Component id="jPanel1" min="-2" max="-2" attributes="0"/> - </Group> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="60" pref="60" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jLabelLogin" min="-2" max="-2" attributes="0"/> - <Component id="jLabelUsername" min="-2" max="-2" attributes="0"/> - <Component id="jLabelEmail" min="-2" max="-2" attributes="0"/> - <Component id="jLabelMobileNumber" min="-2" max="-2" attributes="0"/> - <Component id="jLabel5" min="-2" max="-2" attributes="0"/> - <Component id="jLabelDateOfBirth" min="-2" max="-2" attributes="0"/> - <Component id="jLabelPassword" min="-2" max="-2" attributes="0"/> - <Component id="jLabelPasswordRequirements" min="-2" pref="205" max="-2" attributes="0"/> - <Component id="jLabel1" min="-2" pref="137" max="-2" attributes="0"/> - <Component id="jLabel2" min="-2" max="-2" attributes="0"/> - <Component id="jLabel3" min="-2" max="-2" attributes="0"/> - <Component id="jLabel4" alignment="0" min="-2" max="-2" attributes="0"/> - <Component id="jLabel6" min="-2" max="-2" attributes="0"/> - <Component id="jButtonVerify" alignment="0" min="-2" pref="204" max="-2" attributes="0"/> - </Group> - <EmptySpace min="-2" pref="11" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jLabelWelcome" alignment="0" min="-2" max="-2" attributes="0"/> - <Group type="102" alignment="0" attributes="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jTextFieldUsername" alignment="0" min="-2" pref="215" max="-2" attributes="0"/> - <Component id="jTextFieldEmail" alignment="0" min="-2" pref="215" max="-2" attributes="0"/> - <Component id="jTextFieldMobileNumber" alignment="0" min="-2" pref="215" max="-2" attributes="0"/> - <Component id="jDateChooser1" min="-2" pref="210" max="-2" attributes="0"/> - <Component id="jPasswordField" min="-2" pref="215" max="-2" attributes="0"/> - </Group> - <EmptySpace max="-2" attributes="0"/> - <Component id="jLabelCardsImage" min="-2" pref="680" max="-2" attributes="0"/> - </Group> - </Group> - </Group> - </Group> - <EmptySpace max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace min="15" pref="15" max="-2" attributes="0"/> - <Component id="jPanel1" min="-2" max="-2" attributes="0"/> - <EmptySpace min="-2" pref="8" max="-2" attributes="0"/> - <Component id="jLabelWelcome" min="-2" pref="105" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace min="-2" pref="17" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace min="-2" pref="71" max="-2" attributes="0"/> - <Component id="jTextFieldUsername" min="-2" pref="26" max="-2" attributes="0"/> - <EmptySpace min="21" pref="21" max="-2" attributes="0"/> - <Component id="jTextFieldEmail" min="-2" max="-2" attributes="0"/> - <EmptySpace min="18" pref="18" max="-2" attributes="0"/> - <Component id="jTextFieldMobileNumber" min="-2" max="-2" attributes="0"/> - <EmptySpace min="-2" pref="68" max="-2" attributes="0"/> - <Component id="jDateChooser1" min="-2" max="-2" attributes="0"/> - </Group> - <Group type="102" alignment="0" attributes="0"> - <Component id="jLabelLogin" min="-2" max="-2" attributes="0"/> - <EmptySpace min="18" pref="18" max="-2" attributes="0"/> - <Component id="jLabelUsername" min="-2" max="-2" attributes="0"/> - <EmptySpace min="21" pref="21" max="-2" attributes="0"/> - <Component id="jLabelEmail" min="-2" max="-2" attributes="0"/> - <EmptySpace min="20" pref="20" max="-2" attributes="0"/> - <Component id="jLabelMobileNumber" min="-2" max="-2" attributes="0"/> - <EmptySpace min="20" pref="20" max="-2" attributes="0"/> - <Component id="jLabel5" min="-2" max="-2" attributes="0"/> - <EmptySpace min="29" pref="29" max="-2" attributes="0"/> - <Component id="jLabelDateOfBirth" min="-2" max="-2" attributes="0"/> - <EmptySpace min="-2" pref="13" max="-2" attributes="0"/> - <Component id="jLabel6" min="-2" max="-2" attributes="0"/> - <EmptySpace type="separate" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jPasswordField" min="-2" max="-2" attributes="0"/> - <Group type="102" attributes="0"> - <Component id="jLabelPassword" min="-2" max="-2" attributes="0"/> - <EmptySpace type="unrelated" max="-2" attributes="0"/> - <Component id="jLabelPasswordRequirements" min="-2" max="-2" attributes="0"/> - <EmptySpace type="separate" max="-2" attributes="0"/> - <Component id="jLabel1" min="-2" max="-2" attributes="0"/> - <EmptySpace type="separate" max="-2" attributes="0"/> - <Component id="jLabel2" min="-2" max="-2" attributes="0"/> - <EmptySpace type="separate" max="-2" attributes="0"/> - <Component id="jLabel3" min="-2" max="-2" attributes="0"/> - <EmptySpace type="separate" max="-2" attributes="0"/> - <Component id="jLabel4" min="-2" max="-2" attributes="0"/> - </Group> - </Group> - </Group> - </Group> - </Group> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="-2" pref="35" max="-2" attributes="0"/> - <Component id="jLabelCardsImage" min="-2" pref="520" max="-2" attributes="0"/> - </Group> - </Group> - <EmptySpace min="-2" pref="25" max="-2" attributes="0"/> - <Component id="jButtonVerify" min="-2" pref="86" max="-2" attributes="0"/> - <EmptySpace pref="46" max="32767" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - </Layout> - <SubComponents> - <Component class="javax.swing.JLabel" name="jLabelWelcome"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="48" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="WELCOME TO LIBREJACK!"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabelLogin"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="36" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="Login"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabelEmail"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="18" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="Email:"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabelMobileNumber"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="18" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="Mobile number:"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabelUsername"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="18" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="Username:"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabelPassword"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="18" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="Password:"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="jTextFieldUsername"> - <Properties> - <Property name="text" type="java.lang.String" value="PenguinPancakes69"/> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextFieldUsernameActionPerformed"/> - </Events> - </Component> - <Component class="javax.swing.JPasswordField" name="jPasswordField"> - <Properties> - <Property name="text" type="java.lang.String" value="password123"/> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jPasswordFieldActionPerformed"/> - </Events> - </Component> - <Component class="javax.swing.JLabel" name="jLabelPasswordRequirements"> - <Properties> - <Property name="text" type="java.lang.String" value="Password requires at least:"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabel1"> - <Properties> - <Property name="text" type="java.lang.String" value="- 10 characters"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabel2"> - <Properties> - <Property name="text" type="java.lang.String" value="- 1 uppercase and lowercase letter"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabel3"> - <Properties> - <Property name="text" type="java.lang.String" value="- 1 number"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabel4"> - <Properties> - <Property name="text" type="java.lang.String" value="- 1 special character"/> - </Properties> - </Component> - <Component class="javax.swing.JButton" name="jButtonVerify"> - <Properties> - <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> - <Color blue="cc" green="cc" red="cc" type="rgb"/> - </Property> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="48" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="PLAY"/> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonVerifyActionPerformed"/> - </Events> - </Component> - <Component class="javax.swing.JTextField" name="jTextFieldEmail"> - <Properties> - <Property name="text" type="java.lang.String" value="john.doe@example.com"/> - </Properties> - </Component> - <Component class="javax.swing.JTextField" name="jTextFieldMobileNumber"> - <Properties> - <Property name="text" type="java.lang.String" value="082 738 9016"/> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jTextFieldMobileNumberActionPerformed"/> - </Events> - </Component> - <Component class="javax.swing.JLabel" name="jLabel5"> - <Properties> - <Property name="text" type="java.lang.String" value="Must be a valid South African number"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabelDateOfBirth"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="18" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="Date of birth:"/> - </Properties> - </Component> - <Container class="javax.swing.JPanel" name="jPanel1"> - - <Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout"> - <Property name="useNullLayout" type="boolean" value="false"/> - </Layout> - </Container> - <Container class="javax.swing.JPanel" name="jPanel2"> - - <Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout"> - <Property name="useNullLayout" type="boolean" value="false"/> - </Layout> - </Container> - <Component class="javax.swing.JLabel" name="jLabelCardsImage"> - <Properties> - <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> - <Image iconType="3" name="/assets/cards_icon.png"/> - </Property> - <Property name="text" type="java.lang.String" value="jLabel6"/> - </Properties> - </Component> - <Component class="com.toedter.calendar.JDateChooser" name="jDateChooser1"> - </Component> - <Component class="javax.swing.JLabel" name="jLabel6"> - <Properties> - <Property name="text" type="java.lang.String" value="You need to be at least 18 to gamble"/> - </Properties> - </Component> - </SubComponents> -</Form> diff --git a/src/view/LoginGUI.java b/src/view/LoginGUI.java @@ -1,322 +0,0 @@ -package view; - -import controller.LoginController; -import java.util.Date; - -/** - * GUI for login screen. - * - * @author Michael Neuper - * <a href="mailto:michael@michaelneuper.com">michael@michaelneuper.com</a> - */ -public class LoginGUI extends javax.swing.JFrame { - - /** - * Creates new form LoginGUI - */ - public LoginGUI() { - initComponents(); - } - - LoginController controller = new LoginController(); - - /** - * 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() { - - jPanel3 = new javax.swing.JPanel(); - jLabelWelcome = new javax.swing.JLabel(); - jLabelLogin = new javax.swing.JLabel(); - jLabelEmail = new javax.swing.JLabel(); - jLabelMobileNumber = new javax.swing.JLabel(); - jLabelUsername = new javax.swing.JLabel(); - jLabelPassword = new javax.swing.JLabel(); - jTextFieldUsername = new javax.swing.JTextField(); - jPasswordField = new javax.swing.JPasswordField(); - jLabelPasswordRequirements = new javax.swing.JLabel(); - jLabel1 = new javax.swing.JLabel(); - jLabel2 = new javax.swing.JLabel(); - jLabel3 = new javax.swing.JLabel(); - jLabel4 = new javax.swing.JLabel(); - jButtonVerify = new javax.swing.JButton(); - jTextFieldEmail = new javax.swing.JTextField(); - jTextFieldMobileNumber = new javax.swing.JTextField(); - jLabel5 = new javax.swing.JLabel(); - jLabelDateOfBirth = new javax.swing.JLabel(); - jPanel1 = new javax.swing.JPanel(); - jPanel2 = new javax.swing.JPanel(); - jLabelCardsImage = new javax.swing.JLabel(); - jDateChooser1 = new com.toedter.calendar.JDateChooser(); - jLabel6 = new javax.swing.JLabel(); - - jPanel3.setBackground(new java.awt.Color(51, 204, 0)); - - setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - setBackground(new java.awt.Color(153, 153, 153)); - setMinimumSize(new java.awt.Dimension(829, 786)); - - jLabelWelcome.setFont(new java.awt.Font("Dialog", 1, 48)); // NOI18N - jLabelWelcome.setText("WELCOME TO LIBREJACK!"); - - jLabelLogin.setFont(new java.awt.Font("Dialog", 1, 36)); // NOI18N - jLabelLogin.setText("Login"); - - jLabelEmail.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N - jLabelEmail.setText("Email:"); - - jLabelMobileNumber.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N - jLabelMobileNumber.setText("Mobile number:"); - - jLabelUsername.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N - jLabelUsername.setText("Username:"); - - jLabelPassword.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N - jLabelPassword.setText("Password:"); - - jTextFieldUsername.setText("PenguinPancakes69"); - jTextFieldUsername.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jTextFieldUsernameActionPerformed(evt); - } - }); - - jPasswordField.setText("password123"); - jPasswordField.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jPasswordFieldActionPerformed(evt); - } - }); - - jLabelPasswordRequirements.setText("Password requires at least:"); - - jLabel1.setText("- 10 characters"); - - jLabel2.setText("- 1 uppercase and lowercase letter"); - - jLabel3.setText("- 1 number"); - - jLabel4.setText("- 1 special character"); - - jButtonVerify.setBackground(new java.awt.Color(204, 204, 204)); - jButtonVerify.setFont(new java.awt.Font("Dialog", 1, 48)); // NOI18N - jButtonVerify.setText("PLAY"); - jButtonVerify.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jButtonVerifyActionPerformed(evt); - } - }); - - jTextFieldEmail.setText("john.doe@example.com"); - - jTextFieldMobileNumber.setText("082 738 9016"); - jTextFieldMobileNumber.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jTextFieldMobileNumberActionPerformed(evt); - } - }); - - jLabel5.setText("Must be a valid South African number"); - - jLabelDateOfBirth.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N - jLabelDateOfBirth.setText("Date of birth:"); - - jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); - - jPanel2.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); - - jLabelCardsImage.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assets/cards_icon.png"))); // NOI18N - jLabelCardsImage.setText("jLabel6"); - - jLabel6.setText("You need to be at least 18 to gamble"); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(43, 43, 43) - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(layout.createSequentialGroup() - .addGap(60, 60, 60) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabelLogin) - .addComponent(jLabelUsername) - .addComponent(jLabelEmail) - .addComponent(jLabelMobileNumber) - .addComponent(jLabel5) - .addComponent(jLabelDateOfBirth) - .addComponent(jLabelPassword) - .addComponent(jLabelPasswordRequirements, javax.swing.GroupLayout.PREFERRED_SIZE, 205, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 137, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel2) - .addComponent(jLabel3) - .addComponent(jLabel4) - .addComponent(jLabel6) - .addComponent(jButtonVerify, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(11, 11, 11) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabelWelcome) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jTextFieldUsername, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jTextFieldEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jTextFieldMobileNumber, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabelCardsImage, javax.swing.GroupLayout.PREFERRED_SIZE, 680, javax.swing.GroupLayout.PREFERRED_SIZE))))) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(15, 15, 15) - .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(8, 8, 8) - .addComponent(jLabelWelcome, javax.swing.GroupLayout.PREFERRED_SIZE, 105, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(17, 17, 17) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(71, 71, 71) - .addComponent(jTextFieldUsername, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(21, 21, 21) - .addComponent(jTextFieldEmail, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(jTextFieldMobileNumber, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(68, 68, 68) - .addComponent(jDateChooser1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabelLogin) - .addGap(18, 18, 18) - .addComponent(jLabelUsername) - .addGap(21, 21, 21) - .addComponent(jLabelEmail) - .addGap(20, 20, 20) - .addComponent(jLabelMobileNumber) - .addGap(20, 20, 20) - .addComponent(jLabel5) - .addGap(29, 29, 29) - .addComponent(jLabelDateOfBirth) - .addGap(13, 13, 13) - .addComponent(jLabel6) - .addGap(18, 18, 18) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabelPassword) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jLabelPasswordRequirements) - .addGap(18, 18, 18) - .addComponent(jLabel1) - .addGap(18, 18, 18) - .addComponent(jLabel2) - .addGap(18, 18, 18) - .addComponent(jLabel3) - .addGap(18, 18, 18) - .addComponent(jLabel4)))))) - .addGroup(layout.createSequentialGroup() - .addGap(35, 35, 35) - .addComponent(jLabelCardsImage, javax.swing.GroupLayout.PREFERRED_SIZE, 520, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGap(25, 25, 25) - .addComponent(jButtonVerify, javax.swing.GroupLayout.PREFERRED_SIZE, 86, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(46, Short.MAX_VALUE)) - ); - - pack(); - }// </editor-fold>//GEN-END:initComponents - - private void jPasswordFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPasswordFieldActionPerformed - - }//GEN-LAST:event_jPasswordFieldActionPerformed - - private void jButtonVerifyActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonVerifyActionPerformed - char[] passwordCh = jPasswordField.getPassword(); - String password = new String(passwordCh); // convert password to string - Date selectedDate = jDateChooser1.getDate(); - if (controller.areAllFieldsValid( - jTextFieldEmail.getText(), - jTextFieldMobileNumber.getText(), - selectedDate, - password)) { - new MainGUI().setVisible(true); // open the game window - this.dispose(); // close the login screen - } - }//GEN-LAST:event_jButtonVerifyActionPerformed - - private void jTextFieldUsernameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldUsernameActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_jTextFieldUsernameActionPerformed - - private void jTextFieldMobileNumberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextFieldMobileNumberActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_jTextFieldMobileNumberActionPerformed - - /** - * @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(LoginGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (InstantiationException ex) { - java.util.logging.Logger.getLogger(LoginGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (IllegalAccessException ex) { - java.util.logging.Logger.getLogger(LoginGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (javax.swing.UnsupportedLookAndFeelException ex) { - java.util.logging.Logger.getLogger(LoginGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - //</editor-fold> - - /* Create and display the form */ - java.awt.EventQueue.invokeLater(() -> { - new LoginGUI().setVisible(true); - }); - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton jButtonVerify; - private com.toedter.calendar.JDateChooser jDateChooser1; - private javax.swing.JLabel jLabel1; - private javax.swing.JLabel jLabel2; - private javax.swing.JLabel jLabel3; - private javax.swing.JLabel jLabel4; - private javax.swing.JLabel jLabel5; - private javax.swing.JLabel jLabel6; - private javax.swing.JLabel jLabelCardsImage; - private javax.swing.JLabel jLabelDateOfBirth; - private javax.swing.JLabel jLabelEmail; - private javax.swing.JLabel jLabelLogin; - private javax.swing.JLabel jLabelMobileNumber; - private javax.swing.JLabel jLabelPassword; - private javax.swing.JLabel jLabelPasswordRequirements; - private javax.swing.JLabel jLabelUsername; - private javax.swing.JLabel jLabelWelcome; - private javax.swing.JPanel jPanel1; - private javax.swing.JPanel jPanel2; - private javax.swing.JPanel jPanel3; - private javax.swing.JPasswordField jPasswordField; - private javax.swing.JTextField jTextFieldEmail; - private javax.swing.JTextField jTextFieldMobileNumber; - private javax.swing.JTextField jTextFieldUsername; - // End of variables declaration//GEN-END:variables -} diff --git a/src/view/MainGUI.form b/src/view/MainGUI.form @@ -1,335 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> - -<Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> - <Properties> - <Property name="defaultCloseOperation" type="int" value="3"/> - <Property name="title" type="java.lang.String" value="librejack"/> - <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> - <Color blue="0" green="66" red="0" type="rgb"/> - </Property> - </Properties> - <SyntheticProperties> - <SyntheticProperty name="formSizePolicy" type="int" value="1"/> - <SyntheticProperty name="generateCenter" type="boolean" value="false"/> - </SyntheticProperties> - <AuxValues> - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> - <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> - <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> - <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> - <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> - <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/> - </AuxValues> - - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace min="-2" pref="348" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace min="0" pref="0" max="32767" attributes="0"/> - <Component id="jPanel3" min="-2" max="-2" attributes="0"/> - </Group> - <Component id="jLabelDealerHandValue" alignment="0" min="-2" pref="80" max="-2" attributes="0"/> - </Group> - <EmptySpace min="-2" pref="196" max="-2" attributes="0"/> - </Group> - <Group type="103" groupAlignment="1" max="-2" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace min="1132" pref="1132" max="-2" attributes="0"/> - <Component id="jButtonExit" min="-2" pref="120" max="-2" attributes="0"/> - <EmptySpace min="-2" pref="144" max="-2" attributes="0"/> - </Group> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="-2" pref="256" max="-2" attributes="0"/> - <Component id="jLabelResult" min="-2" pref="894" max="-2" attributes="0"/> - <EmptySpace max="32767" attributes="0"/> - </Group> - <Group type="102" alignment="1" attributes="0"> - <Group type="103" groupAlignment="1" attributes="0"> - <Group type="102" attributes="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace min="70" pref="70" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jLabelDisplayDealerHand" min="-2" pref="440" max="-2" attributes="0"/> - <Component id="jLabelDealerHand" min="-2" pref="270" max="-2" attributes="0"/> - <Component id="jLabelBalance" min="-2" pref="220" max="-2" attributes="0"/> - </Group> - </Group> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="-2" pref="52" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jLabelCurrentBet" min="-2" pref="200" max="-2" attributes="0"/> - <Component id="jButtonBetAmount" min="-2" pref="220" max="-2" attributes="0"/> - </Group> - </Group> - </Group> - <EmptySpace min="-2" pref="20" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <Component id="jLabelDisplayPlayerHand" min="-2" pref="400" max="-2" attributes="0"/> - <EmptySpace max="32767" attributes="0"/> - <Component id="jButtonStand" min="-2" pref="190" max="-2" attributes="0"/> - </Group> - <Group type="102" alignment="0" attributes="0"> - <Group type="103" groupAlignment="1" attributes="0"> - <Component id="jButtonStats" min="-2" pref="199" max="-2" attributes="0"/> - <Group type="102" attributes="0"> - <Component id="jLabelPlayerHand" min="-2" pref="210" max="-2" attributes="0"/> - <EmptySpace type="unrelated" max="-2" attributes="0"/> - <Component id="jLabelPlayerHandValue" min="-2" pref="60" max="-2" attributes="0"/> - <EmptySpace min="-2" pref="288" max="-2" attributes="0"/> - <Component id="jButtonHit" min="-2" pref="190" max="-2" attributes="0"/> - </Group> - </Group> - <EmptySpace min="0" pref="0" max="32767" attributes="0"/> - </Group> - </Group> - </Group> - <Group type="102" attributes="0"> - <EmptySpace min="-2" pref="52" max="-2" attributes="0"/> - <Component id="jButtonDeal" min="-2" pref="460" max="-2" attributes="0"/> - <EmptySpace min="-2" pref="38" max="-2" attributes="0"/> - <Component id="jButtonDouble" min="-2" pref="190" max="-2" attributes="0"/> - </Group> - </Group> - <EmptySpace min="-2" pref="100" max="-2" attributes="0"/> - </Group> - </Group> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace min="-2" pref="95" max="-2" attributes="0"/> - <Component id="jButtonStats" min="-2" pref="64" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Component id="jLabelResult" min="-2" pref="130" max="-2" attributes="0"/> - <EmptySpace max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <Component id="jPanel3" min="-2" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace min="-2" pref="7" max="-2" attributes="0"/> - <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabelPlayerHand" alignment="3" min="-2" pref="30" max="-2" attributes="0"/> - <Component id="jButtonHit" alignment="3" min="-2" pref="110" max="-2" attributes="0"/> - <Component id="jLabelDealerHand" alignment="3" min="-2" pref="30" max="-2" attributes="0"/> - </Group> - <EmptySpace pref="6" max="32767" attributes="0"/> - </Group> - <Group type="102" alignment="1" attributes="0"> - <EmptySpace max="32767" attributes="0"/> - <Component id="jLabelPlayerHandValue" min="-2" pref="40" max="-2" attributes="0"/> - <EmptySpace min="-2" pref="2" max="-2" attributes="0"/> - </Group> - </Group> - </Group> - <Group type="102" alignment="1" attributes="0"> - <EmptySpace min="0" pref="0" max="32767" attributes="0"/> - <Component id="jLabelDealerHandValue" min="-2" pref="40" max="-2" attributes="0"/> - </Group> - </Group> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Component id="jLabelDisplayDealerHand" min="-2" pref="59" max="-2" attributes="0"/> - <EmptySpace type="unrelated" max="-2" attributes="0"/> - <Component id="jLabelBalance" min="-2" pref="40" max="-2" attributes="0"/> - </Group> - <Group type="102" attributes="0"> - <EmptySpace min="10" pref="10" max="-2" attributes="0"/> - <Component id="jLabelDisplayPlayerHand" min="-2" pref="150" max="-2" attributes="0"/> - </Group> - </Group> - <EmptySpace min="-2" pref="50" max="-2" attributes="0"/> - <Component id="jLabelCurrentBet" min="-2" pref="50" max="-2" attributes="0"/> - <EmptySpace type="unrelated" max="-2" attributes="0"/> - <Component id="jButtonBetAmount" min="-2" pref="60" max="-2" attributes="0"/> - </Group> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="-2" pref="63" max="-2" attributes="0"/> - <Component id="jButtonStand" min="-2" pref="110" max="-2" attributes="0"/> - <EmptySpace min="-2" pref="49" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jButtonDeal" min="-2" pref="120" max="-2" attributes="0"/> - <Component id="jButtonDouble" min="-2" pref="120" max="-2" attributes="0"/> - </Group> - </Group> - </Group> - <EmptySpace min="-2" pref="62" max="-2" attributes="0"/> - <Component id="jButtonExit" min="-2" pref="50" max="-2" attributes="0"/> - <EmptySpace min="-2" pref="22" max="-2" attributes="0"/> - </Group> - </Group> - </DimensionLayout> - </Layout> - <SubComponents> - <Container class="javax.swing.JPanel" name="jPanel3"> - - <Layout> - <DimensionLayout dim="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <EmptySpace min="0" pref="100" max="32767" attributes="0"/> - </Group> - </DimensionLayout> - <DimensionLayout dim="1"> - <Group type="103" groupAlignment="0" attributes="0"> - <EmptySpace min="0" pref="100" max="32767" attributes="0"/> - </Group> - </DimensionLayout> - </Layout> - </Container> - <Component class="javax.swing.JLabel" name="jLabelBalance"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="14" style="1"/> - </Property> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> - <Connection code="&quot;Balance: &quot; + game.getBalance()" type="code"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JButton" name="jButtonDouble"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="18" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="DOUBLE DOWN"/> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonDoubleActionPerformed"/> - </Events> - </Component> - <Component class="javax.swing.JButton" name="jButtonStand"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="18" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="STAND"/> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonStandActionPerformed"/> - </Events> - </Component> - <Component class="javax.swing.JButton" name="jButtonHit"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="18" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="HIT"/> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonHitActionPerformed"/> - </Events> - </Component> - <Component class="javax.swing.JButton" name="jButtonDeal"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="48" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="DEAL"/> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonDealActionPerformed"/> - </Events> - </Component> - <Component class="javax.swing.JButton" name="jButtonBetAmount"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="14" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="Change Bet Amount"/> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonBetAmountActionPerformed"/> - </Events> - </Component> - <Component class="javax.swing.JLabel" name="jLabelCurrentBet"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="14" style="1"/> - </Property> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> - <Connection code="&quot;Current Bet: &quot; + game.getBet()" type="code"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabelResult"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="48" style="1"/> - </Property> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> - <Connection code="game.checkWhoWins()" type="code"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabelDisplayDealerHand"> - </Component> - <Component class="javax.swing.JLabel" name="jLabelDisplayPlayerHand"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> - <Connection code="game.displayPlayerHand()" type="code"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabelDealerHand"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="36" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="Dealer&apos;s Hand:"/> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabelPlayerHand"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="36" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="Your Hand:"/> - </Properties> - </Component> - <Component class="javax.swing.JButton" name="jButtonExit"> - <Properties> - <Property name="text" type="java.lang.String" value="EXIT"/> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonExitActionPerformed"/> - </Events> - </Component> - <Component class="javax.swing.JLabel" name="jLabelDealerHandValue"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="36" style="1"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JLabel" name="jLabelPlayerHandValue"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="36" style="1"/> - </Property> - </Properties> - </Component> - <Component class="javax.swing.JButton" name="jButtonStats"> - <Properties> - <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> - <Font name="Dialog" size="18" style="1"/> - </Property> - <Property name="text" type="java.lang.String" value="Show Statistics"/> - </Properties> - <Events> - <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonStatsActionPerformed"/> - </Events> - </Component> - </SubComponents> -</Form> diff --git a/src/view/MainGUI.java b/src/view/MainGUI.java @@ -1,374 +0,0 @@ -package view; - -import controller.Controller; -import java.io.IOException; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.swing.JOptionPane; - -/** - * Main GUI. - * - * @author Michael Neuper - * <a href="mailto:michael@michaelneuper.com">michael@michaelneuper.com</a> - */ -public class MainGUI extends javax.swing.JFrame { - - Controller game = new Controller(); - - /** - * Creates new form GUI - */ - public MainGUI() { - 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() { - - jPanel3 = new javax.swing.JPanel(); - jLabelBalance = new javax.swing.JLabel(); - jButtonDouble = new javax.swing.JButton(); - jButtonStand = new javax.swing.JButton(); - jButtonHit = new javax.swing.JButton(); - jButtonDeal = new javax.swing.JButton(); - jButtonBetAmount = new javax.swing.JButton(); - jLabelCurrentBet = new javax.swing.JLabel(); - jLabelResult = new javax.swing.JLabel(); - jLabelDisplayDealerHand = new javax.swing.JLabel(); - jLabelDisplayPlayerHand = new javax.swing.JLabel(); - jLabelDealerHand = new javax.swing.JLabel(); - jLabelPlayerHand = new javax.swing.JLabel(); - jButtonExit = new javax.swing.JButton(); - jLabelDealerHandValue = new javax.swing.JLabel(); - jLabelPlayerHandValue = new javax.swing.JLabel(); - jButtonStats = new javax.swing.JButton(); - - setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); - setTitle("librejack"); - setForeground(new java.awt.Color(0, 102, 0)); - - javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); - jPanel3.setLayout(jPanel3Layout); - jPanel3Layout.setHorizontalGroup( - jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 100, Short.MAX_VALUE) - ); - jPanel3Layout.setVerticalGroup( - jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 100, Short.MAX_VALUE) - ); - - jLabelBalance.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N - jLabelBalance.setText("Balance: " + game.getBalance()); - - jButtonDouble.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N - jButtonDouble.setText("DOUBLE DOWN"); - jButtonDouble.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jButtonDoubleActionPerformed(evt); - } - }); - - jButtonStand.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N - jButtonStand.setText("STAND"); - jButtonStand.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jButtonStandActionPerformed(evt); - } - }); - - jButtonHit.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N - jButtonHit.setText("HIT"); - jButtonHit.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jButtonHitActionPerformed(evt); - } - }); - - jButtonDeal.setFont(new java.awt.Font("Dialog", 1, 48)); // NOI18N - jButtonDeal.setText("DEAL"); - jButtonDeal.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jButtonDealActionPerformed(evt); - } - }); - - jButtonBetAmount.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N - jButtonBetAmount.setText("Change Bet Amount"); - jButtonBetAmount.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jButtonBetAmountActionPerformed(evt); - } - }); - - jLabelCurrentBet.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N - jLabelCurrentBet.setText("Current Bet: " + game.getBet()); - - jLabelResult.setFont(new java.awt.Font("Dialog", 1, 48)); // NOI18N - jLabelResult.setText(game.checkWhoWins()); - - jLabelDisplayPlayerHand.setText(game.displayPlayerHand()); - - jLabelDealerHand.setFont(new java.awt.Font("Dialog", 1, 36)); // NOI18N - jLabelDealerHand.setText("Dealer's Hand:"); - - jLabelPlayerHand.setFont(new java.awt.Font("Dialog", 1, 36)); // NOI18N - jLabelPlayerHand.setText("Your Hand:"); - - jButtonExit.setText("EXIT"); - jButtonExit.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jButtonExitActionPerformed(evt); - } - }); - - jLabelDealerHandValue.setFont(new java.awt.Font("Dialog", 1, 36)); // NOI18N - - jLabelPlayerHandValue.setFont(new java.awt.Font("Dialog", 1, 36)); // NOI18N - - jButtonStats.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N - jButtonStats.setText("Show Statistics"); - jButtonStats.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jButtonStatsActionPerformed(evt); - } - }); - - 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(348, 348, 348) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(0, 0, Short.MAX_VALUE) - .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(jLabelDealerHandValue, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(196, 196, 196)) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addGroup(layout.createSequentialGroup() - .addGap(1132, 1132, 1132) - .addComponent(jButtonExit, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(144, 144, 144)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() - .addGap(256, 256, 256) - .addComponent(jLabelResult, javax.swing.GroupLayout.PREFERRED_SIZE, 894, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(70, 70, 70) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabelDisplayDealerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 440, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabelDealerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabelBalance, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGroup(layout.createSequentialGroup() - .addGap(52, 52, 52) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabelCurrentBet, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jButtonBetAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)))) - .addGap(20, 20, 20) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabelDisplayPlayerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jButtonStand, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(jButtonStats, javax.swing.GroupLayout.PREFERRED_SIZE, 199, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabelPlayerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jLabelPlayerHandValue, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(288, 288, 288) - .addComponent(jButtonHit, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGap(0, 0, Short.MAX_VALUE)))) - .addGroup(layout.createSequentialGroup() - .addGap(52, 52, 52) - .addComponent(jButtonDeal, javax.swing.GroupLayout.PREFERRED_SIZE, 460, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(38, 38, 38) - .addComponent(jButtonDouble, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGap(100, 100, 100))) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(95, 95, 95) - .addComponent(jButtonStats, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabelResult, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(7, 7, 7) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabelPlayerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jButtonHit, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabelDealerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 6, Short.MAX_VALUE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(jLabelPlayerHandValue, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(2, 2, 2)))) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addGap(0, 0, Short.MAX_VALUE) - .addComponent(jLabelDealerHandValue, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jLabelDisplayDealerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jLabelBalance, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(layout.createSequentialGroup() - .addGap(10, 10, 10) - .addComponent(jLabelDisplayPlayerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGap(50, 50, 50) - .addComponent(jLabelCurrentBet, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(jButtonBetAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(layout.createSequentialGroup() - .addGap(63, 63, 63) - .addComponent(jButtonStand, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(49, 49, 49) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jButtonDeal, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jButtonDouble, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))) - .addGap(62, 62, 62) - .addComponent(jButtonExit, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(22, 22, 22)) - ); - - pack(); - }// </editor-fold>//GEN-END:initComponents - - private void jButtonDealActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDealActionPerformed - jLabelResult.setText(""); // clear the last result - jLabelBalance.setText("Balance: " + game.getBalance()); // update the balance - game.startRound(); - jLabelDisplayDealerHand.setText(game.displayDealerFirstCard()); - jLabelDealerHandValue.setText(game.displayDealerFirstCardValue()); - printPlayerHand(); - }//GEN-LAST:event_jButtonDealActionPerformed - - private void jButtonBetAmountActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonBetAmountActionPerformed - game.setBet(Double.parseDouble(JOptionPane.showInputDialog("Enter the bet amount"))); - jLabelCurrentBet.setText("Current Bet: " + Double.toString(game.getBet())); - }//GEN-LAST:event_jButtonBetAmountActionPerformed - - private void jButtonStandActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonStandActionPerformed - - printDealerHand(); - jLabelResult.setText(game.checkWhoWins()); - printDealerHand(); - jLabelBalance.setText("Balance: " + game.getBalance()); // update the balance - }//GEN-LAST:event_jButtonStandActionPerformed - - private void jButtonDoubleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDoubleActionPerformed - game.setBet(game.getBet() * 2); // double the bet - game.hitPlayer(); - game.setBet(game.getBet() / 2); // reset bet back to original bet - printPlayerHand(); - printDealerHand(); - jLabelResult.setText(game.checkWhoWins()); - jLabelBalance.setText("Balance: " + game.getBalance()); // update the balance - }//GEN-LAST:event_jButtonDoubleActionPerformed - - private void jButtonHitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonHitActionPerformed - game.hitPlayer(); - printPlayerHand(); - printDealerHand(); - jLabelResult.setText(game.checkWhoWins()); - jLabelBalance.setText("Balance: " + game.getBalance()); // update the balance - }//GEN-LAST:event_jButtonHitActionPerformed - - private void jButtonExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonExitActionPerformed - System.exit(0); - }//GEN-LAST:event_jButtonExitActionPerformed - - private void jButtonStatsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonStatsActionPerformed - try { - new StatisticsGUI().setVisible(true); - } catch (IOException ex) { - Logger.getLogger(MainGUI.class.getName()).log(Level.SEVERE, null, ex); - } - }//GEN-LAST:event_jButtonStatsActionPerformed - - /** - * @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(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (InstantiationException ex) { - java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (IllegalAccessException ex) { - java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } catch (javax.swing.UnsupportedLookAndFeelException ex) { - java.util.logging.Logger.getLogger(MainGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - } - //</editor-fold> - //</editor-fold> - - /* Create and display the form */ - java.awt.EventQueue.invokeLater(() -> { - new MainGUI().setVisible(true); - }); - } - - public void printDealerHand() { - jLabelDisplayDealerHand.setText(game.displayDealerHand()); - jLabelDealerHandValue.setText(game.displayDealerHandValue()); - } - - public void printPlayerHand() { - jLabelDisplayPlayerHand.setText(game.displayPlayerHand()); - jLabelPlayerHandValue.setText(game.displayPlayerHandValue()); - } - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton jButtonBetAmount; - private javax.swing.JButton jButtonDeal; - private javax.swing.JButton jButtonDouble; - private javax.swing.JButton jButtonExit; - private javax.swing.JButton jButtonHit; - private javax.swing.JButton jButtonStand; - private javax.swing.JButton jButtonStats; - private javax.swing.JLabel jLabelBalance; - private javax.swing.JLabel jLabelCurrentBet; - private javax.swing.JLabel jLabelDealerHand; - private javax.swing.JLabel jLabelDealerHandValue; - private javax.swing.JLabel jLabelDisplayDealerHand; - private javax.swing.JLabel jLabelDisplayPlayerHand; - private javax.swing.JLabel jLabelPlayerHand; - private javax.swing.JLabel jLabelPlayerHandValue; - private javax.swing.JLabel jLabelResult; - private javax.swing.JPanel jPanel3; - // End of variables declaration//GEN-END:variables -}