commit 19781dfd62c2de80fcf81f409744a5958d43c8fd
parent f354d58147616d8c7f8704f6a1e4e5edbef73461
Author: Michael Neuper <73108749+michaelneuper@users.noreply.github.com>
Date: Thu, 27 Apr 2023 12:29:51 +0200
Rename GUI
Diffstat:
| D | src/view/GUI.form | | | 313 | ------------------------------------------------------------------------------- |
| D | src/view/GUI.java | | | 344 | ------------------------------------------------------------------------------- |
| A | src/view/MainGUI.form | | | 321 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | src/view/MainGUI.java | | | 347 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
4 files changed, 668 insertions(+), 657 deletions(-)
diff --git a/src/view/GUI.form b/src/view/GUI.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">
- <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" alignment="0" attributes="0">
- <EmptySpace min="60" pref="60" max="-2" attributes="0"/>
- <Group type="103" groupAlignment="0" attributes="0">
- <Group type="102" attributes="0">
- <Component id="jLabelDealerHand" min="-2" pref="270" max="-2" attributes="0"/>
- <Group type="103" groupAlignment="0" attributes="0">
- <Group type="102" attributes="0">
- <EmptySpace max="32767" attributes="0"/>
- <Component id="jPanel3" min="-2" max="-2" attributes="0"/>
- <EmptySpace min="-2" pref="72" max="-2" attributes="0"/>
- </Group>
- <Group type="102" alignment="0" attributes="0">
- <EmptySpace type="separate" max="-2" attributes="0"/>
- <Component id="jLabelDealerHandValue" min="-2" pref="80" max="-2" attributes="0"/>
- <EmptySpace max="32767" attributes="0"/>
- </Group>
- </Group>
- <Component id="jButtonHit" min="-2" pref="190" max="-2" attributes="0"/>
- <EmptySpace min="-2" pref="108" max="-2" attributes="0"/>
- </Group>
- <Component id="jLabelBalance" min="-2" pref="220" max="-2" attributes="0"/>
- </Group>
- </Group>
- <Group type="102" attributes="0">
- <Group type="103" groupAlignment="0" max="-2" attributes="0">
- <Group type="102" attributes="0">
- <EmptySpace min="60" pref="60" 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>
- <EmptySpace min="140" pref="140" max="-2" attributes="0"/>
- <Component id="jButtonDeal" min="-2" pref="460" max="-2" attributes="0"/>
- <EmptySpace min="80" pref="80" max="-2" attributes="0"/>
- <Component id="jButtonDouble" min="-2" pref="190" max="-2" attributes="0"/>
- </Group>
- <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"/>
- </Group>
- <Group type="102" alignment="0" attributes="0">
- <EmptySpace min="70" pref="70" max="-2" attributes="0"/>
- <Component id="jLabelDisplayDealerHand" min="-2" pref="440" max="-2" attributes="0"/>
- <EmptySpace min="20" pref="20" max="-2" attributes="0"/>
- <Group type="103" groupAlignment="0" 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"/>
- </Group>
- <Group type="102" attributes="0">
- <Component id="jLabelDisplayPlayerHand" min="-2" pref="400" max="-2" attributes="0"/>
- <EmptySpace min="30" pref="30" max="-2" attributes="0"/>
- <Component id="jButtonStand" min="-2" pref="190" max="-2" attributes="0"/>
- </Group>
- </Group>
- </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"/>
- </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="-2" pref="24" 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="40" max="-2" attributes="0"/>
- <Component id="jLabelPlayerHand" min="-2" pref="30" max="-2" attributes="0"/>
- <EmptySpace 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"/>
- <Group type="103" groupAlignment="0" attributes="0">
- <Group type="103" alignment="1" groupAlignment="0" attributes="0">
- <Component id="jLabelDealerHand" min="-2" pref="30" max="-2" attributes="0"/>
- <Component id="jLabelDealerHandValue" min="-2" pref="40" max="-2" attributes="0"/>
- </Group>
- <Group type="102" alignment="1" attributes="0">
- <Component id="jButtonHit" min="-2" pref="110" max="-2" attributes="0"/>
- <EmptySpace min="-2" pref="2" max="-2" attributes="0"/>
- </Group>
- </Group>
- </Group>
- </Group>
- <Group type="103" groupAlignment="0" attributes="0">
- <Component id="jLabelDisplayDealerHand" min="-2" pref="160" max="-2" attributes="0"/>
- <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 type="102" attributes="0">
- <EmptySpace min="50" pref="50" max="-2" attributes="0"/>
- <Component id="jButtonStand" min="-2" pref="110" max="-2" attributes="0"/>
- </Group>
- </Group>
- <EmptySpace min="20" pref="20" max="-2" attributes="0"/>
- <Component id="jLabelBalance" min="-2" pref="40" max="-2" attributes="0"/>
- <Group type="103" groupAlignment="0" attributes="0">
- <Group type="102" attributes="0">
- <EmptySpace min="10" pref="10" max="-2" attributes="0"/>
- <Component id="jLabelCurrentBet" min="-2" pref="50" max="-2" attributes="0"/>
- <EmptySpace min="10" pref="10" max="-2" attributes="0"/>
- <Component id="jButtonBetAmount" min="-2" pref="60" max="-2" attributes="0"/>
- </Group>
- <Group type="102" attributes="0">
- <EmptySpace min="60" pref="60" max="-2" attributes="0"/>
- <Component id="jButtonDeal" min="-2" pref="120" max="-2" attributes="0"/>
- </Group>
- <Component id="jButtonDouble" min="-2" pref="120" max="-2" attributes="0"/>
- </Group>
- <EmptySpace min="23" pref="23" max="-2" attributes="0"/>
- <Component id="jButtonExit" min="-2" pref="50" 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=""Balance: " + 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=""Current Bet: " + 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'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>
- </SubComponents>
-</Form>
diff --git a/src/view/GUI.java b/src/view/GUI.java
@@ -1,344 +0,0 @@
-package view;
-
-import controller.Controller;
-import javax.swing.JOptionPane;
-
-/**
- *
- * @author Michael
- */
-public class GUI extends javax.swing.JFrame {
-
- Controller game = new Controller();
-
- /**
- * Creates new form GUI
- */
- public GUI() {
- 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();
-
- 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
-
- 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(60, 60, 60)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabelDealerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 270, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(72, 72, 72))
- .addGroup(layout.createSequentialGroup()
- .addGap(18, 18, 18)
- .addComponent(jLabelDealerHandValue, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
- .addComponent(jButtonHit, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(108, 108, 108))
- .addComponent(jLabelBalance, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGroup(layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addGroup(layout.createSequentialGroup()
- .addGap(60, 60, 60)
- .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(140, 140, 140)
- .addComponent(jButtonDeal, javax.swing.GroupLayout.PREFERRED_SIZE, 460, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(80, 80, 80)
- .addComponent(jButtonDouble, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(layout.createSequentialGroup()
- .addGap(1132, 1132, 1132)
- .addComponent(jButtonExit, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(layout.createSequentialGroup()
- .addGap(70, 70, 70)
- .addComponent(jLabelDisplayDealerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 440, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(20, 20, 20)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .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))
- .addGroup(layout.createSequentialGroup()
- .addComponent(jLabelDisplayPlayerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(30, 30, 30)
- .addComponent(jButtonStand, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE))))
- .addGroup(layout.createSequentialGroup()
- .addGap(256, 256, 256)
- .addComponent(jLabelResult, javax.swing.GroupLayout.PREFERRED_SIZE, 894, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addContainerGap())
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(24, 24, 24)
- .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(40, 40, 40)
- .addComponent(jLabelPlayerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, 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)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabelDealerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabelDealerHandValue, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addComponent(jButtonHit, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(2, 2, 2)))))
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabelDisplayDealerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 160, 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))
- .addGroup(layout.createSequentialGroup()
- .addGap(50, 50, 50)
- .addComponent(jButtonStand, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGap(20, 20, 20)
- .addComponent(jLabelBalance, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(10, 10, 10)
- .addComponent(jLabelCurrentBet, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(10, 10, 10)
- .addComponent(jButtonBetAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(layout.createSequentialGroup()
- .addGap(60, 60, 60)
- .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(23, 23, 23)
- .addComponent(jButtonExit, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
- );
-
- 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
- // TODO: add exit operation
- }//GEN-LAST:event_jButtonExitActionPerformed
-
- /**
- * @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(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(GUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(GUI.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 GUI().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.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
-}
diff --git a/src/view/MainGUI.form b/src/view/MainGUI.form
@@ -0,0 +1,321 @@
+<?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>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jLabelDealerHandValue" min="-2" pref="80" max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace min="-2" pref="196" max="-2" attributes="0"/>
+ </Group>
+ <Group type="102" attributes="0">
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Group type="103" groupAlignment="0" 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"/>
+ </Group>
+ <Group type="102" alignment="0" 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" 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="150" max="-2" attributes="0"/>
+ <Component id="jButtonHit" min="-2" pref="190" max="-2" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jLabelDisplayPlayerHand" min="-2" pref="400" max="-2" attributes="0"/>
+ <EmptySpace min="30" pref="30" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jButtonDouble" min="-2" pref="190" max="-2" attributes="0"/>
+ <Component id="jButtonStand" min="-2" pref="190" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </Group>
+ </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"/>
+ </Group>
+ </Group>
+ <Group type="102" alignment="1" 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="322" max="-2" attributes="0"/>
+ </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="-2" pref="24" 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" 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 type="102" attributes="0">
+ <EmptySpace min="50" pref="50" max="-2" attributes="0"/>
+ <Component id="jButtonStand" min="-2" pref="110" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="-2" pref="62" 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 type="102" alignment="0" attributes="0">
+ <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>
+ <EmptySpace min="-2" pref="56" 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=""Balance: " + 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=""Current Bet: " + 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'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>
+ </SubComponents>
+</Form>
diff --git a/src/view/MainGUI.java b/src/view/MainGUI.java
@@ -0,0 +1,347 @@
+package view;
+
+import controller.Controller;
+import javax.swing.JOptionPane;
+
+/**
+ *
+ * @author Michael
+ */
+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();
+
+ 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
+
+ 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))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jLabelDealerHandValue, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
+ .addGap(196, 196, 196))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addGroup(layout.createSequentialGroup()
+ .addGap(1132, 1132, 1132)
+ .addComponent(jButtonExit, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .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(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(150, 150, 150)
+ .addComponent(jButtonHit, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jLabelDisplayPlayerHand, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(30, 30, 30)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jButtonDouble, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jButtonStand, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)))))
+ .addGroup(layout.createSequentialGroup()
+ .addGap(256, 256, 256)
+ .addComponent(jLabelResult, javax.swing.GroupLayout.PREFERRED_SIZE, 894, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGroup(layout.createSequentialGroup()
+ .addGap(52, 52, 52)
+ .addComponent(jButtonDeal, javax.swing.GroupLayout.PREFERRED_SIZE, 460, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGap(322, 322, 322)))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGap(24, 24, 24)
+ .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()
+ .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))
+ .addGroup(layout.createSequentialGroup()
+ .addGap(50, 50, 50)
+ .addComponent(jButtonStand, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addGap(62, 62, 62)
+ .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)))
+ .addGroup(layout.createSequentialGroup()
+ .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)))
+ .addGap(56, 56, 56)
+ .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
+ // TODO: add exit operation
+ }//GEN-LAST:event_jButtonExitActionPerformed
+
+ /**
+ * @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.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
+}