librejack

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

commit 59654b22623d5c2f09471e3a5f8fad47cac92239
parent f933060b19afff8f431401d947b27b4a20627ae7
Author: Michael Neuper <michael@michaelneuper.com>
Date:   Thu, 11 May 2023 20:42:06 +0200

Add options burger menu

Diffstat:
Asrc/assets/icons/menu_burger.png | 0
Msrc/view/MainUI.form | 40++++++++++++++++++++++++++++++++++++----
Msrc/view/MainUI.java | 31++++++++++++++++++++++++++++---
3 files changed, 64 insertions(+), 7 deletions(-)

diff --git a/src/assets/icons/menu_burger.png b/src/assets/icons/menu_burger.png Binary files differ. diff --git a/src/view/MainUI.form b/src/view/MainUI.form @@ -4,6 +4,9 @@ <Properties> <Property name="defaultCloseOperation" type="int" value="3"/> <Property name="title" type="java.lang.String" value="librejack"/> + <Property name="iconImage" type="java.awt.Image" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="Toolkit.getDefaultToolkit().getImage(getClass().getResource(&quot;/assets/icons/heart_cards.png&quot;))" type="code"/> + </Property> <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> <Dimension value="[800, 600]"/> </Property> @@ -43,7 +46,9 @@ <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> <Group type="102" alignment="1" attributes="0"> - <EmptySpace pref="388" max="32767" attributes="0"/> + <EmptySpace min="-2" pref="41" max="-2" attributes="0"/> + <Component id="jButton1" min="-2" max="-2" attributes="0"/> + <EmptySpace pref="323" max="32767" attributes="0"/> <Component id="jLabelResult" min="-2" pref="300" max="-2" attributes="0"/> <EmptySpace min="-2" pref="260" max="-2" attributes="0"/> </Group> @@ -51,9 +56,17 @@ </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="-2" pref="19" max="-2" attributes="0"/> - <Component id="jLabelResult" min="-2" pref="50" max="-2" attributes="0"/> + <Group type="102" attributes="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="19" max="-2" attributes="0"/> + <Component id="jLabelResult" min="-2" pref="50" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="30" max="-2" attributes="0"/> + <Component id="jButton1" min="-2" max="-2" attributes="0"/> + </Group> + </Group> <EmptySpace pref="31" max="32767" attributes="0"/> </Group> </Group> @@ -68,6 +81,25 @@ <Property name="text" type="java.lang.String" value="WELCOME"/> </Properties> </Component> + <Component class="javax.swing.JButton" name="jButton1"> + <Properties> + <Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> + <Color blue="33" green="66" red="0" type="rgb"/> + </Property> + <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor"> + <Color blue="cc" green="cc" red="cc" type="rgb"/> + </Property> + <Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor"> + <Image iconType="3" name="/assets/icons/menu_burger.png"/> + </Property> + <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> + <Border info="null"/> + </Property> + </Properties> + <Events> + <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/> + </Events> + </Component> </SubComponents> </Container> <Container class="javax.swing.JPanel" name="jPanelEast"> diff --git a/src/view/MainUI.java b/src/view/MainUI.java @@ -2,6 +2,7 @@ package view; import com.formdev.flatlaf.FlatDarkLaf; import controller.Controller; +import java.awt.Toolkit; import javax.swing.ImageIcon; import javax.swing.JOptionPane; import javax.swing.UIManager; @@ -35,6 +36,7 @@ public class MainUI extends javax.swing.JFrame { jPanelNorth = new javax.swing.JPanel(); jLabelResult = new javax.swing.JLabel(); + jButton1 = new javax.swing.JButton(); jPanelEast = new javax.swing.JPanel(); jButtonHit = new javax.swing.JButton(); jButtonStand = new javax.swing.JButton(); @@ -64,6 +66,7 @@ public class MainUI extends javax.swing.JFrame { setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("librejack"); + setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/assets/icons/heart_cards.png"))); setPreferredSize(new java.awt.Dimension(800, 600)); jPanelNorth.setBackground(new java.awt.Color(0, 102, 51)); @@ -71,20 +74,37 @@ public class MainUI extends javax.swing.JFrame { jLabelResult.setFont(new java.awt.Font("Segoe UI", 0, 48)); // NOI18N jLabelResult.setText("WELCOME"); + jButton1.setBackground(new java.awt.Color(0, 102, 51)); + jButton1.setForeground(new java.awt.Color(204, 204, 204)); + jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assets/icons/menu_burger.png"))); // NOI18N + jButton1.setBorder(null); + jButton1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jButton1ActionPerformed(evt); + } + }); + javax.swing.GroupLayout jPanelNorthLayout = new javax.swing.GroupLayout(jPanelNorth); jPanelNorth.setLayout(jPanelNorthLayout); jPanelNorthLayout.setHorizontalGroup( jPanelNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelNorthLayout.createSequentialGroup() - .addContainerGap(388, Short.MAX_VALUE) + .addGap(41, 41, 41) + .addComponent(jButton1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 323, Short.MAX_VALUE) .addComponent(jLabelResult, javax.swing.GroupLayout.PREFERRED_SIZE, 300, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(260, 260, 260)) ); jPanelNorthLayout.setVerticalGroup( jPanelNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanelNorthLayout.createSequentialGroup() - .addGap(19, 19, 19) - .addComponent(jLabelResult, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanelNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanelNorthLayout.createSequentialGroup() + .addGap(19, 19, 19) + .addComponent(jLabelResult, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(jPanelNorthLayout.createSequentialGroup() + .addGap(30, 30, 30) + .addComponent(jButton1))) .addContainerGap(31, Short.MAX_VALUE)) ); @@ -418,6 +438,10 @@ public class MainUI extends javax.swing.JFrame { jLabelCurrentBetAmount.setText("R " + Double.toString(game.getBet())); }//GEN-LAST:event_jButtonChangeBetActionPerformed + private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_jButton1ActionPerformed + /** * @param args the command line arguments */ @@ -461,6 +485,7 @@ public class MainUI extends javax.swing.JFrame { } // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton jButton1; private javax.swing.JButton jButtonChangeBet; private javax.swing.JButton jButtonDeal; private javax.swing.JButton jButtonDoubleDown;