librejack

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

commit 0d86026aa14b69ca61db8de554fcfb3d4333a466
parent 97ae19cd7027be8a7aaed942c059384e109c6327
Author: Michael Neuper <michael@michaelneuper.com>
Date:   Fri, 12 May 2023 19:57:58 +0200

Add rules to RulesUI

Diffstat:
Msrc/view/RulesUI.form | 26+++++++++++++++++++++++---
Msrc/view/RulesUI.java | 20+++++++++++++++++---
2 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/src/view/RulesUI.form b/src/view/RulesUI.form @@ -2,7 +2,9 @@ <Form version="1.3" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo"> <Properties> - <Property name="defaultCloseOperation" type="int" value="3"/> + <Property name="defaultCloseOperation" type="int" value="2"/> + <Property name="title" type="java.lang.String" value="Rules"/> + <Property name="alwaysOnTop" type="boolean" value="true"/> </Properties> <SyntheticProperties> <SyntheticProperty name="formSizePolicy" type="int" value="1"/> @@ -23,13 +25,31 @@ <Layout> <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> - <EmptySpace min="0" pref="400" max="32767" attributes="0"/> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="21" max="-2" attributes="0"/> + <Component id="jLabelRules" min="-2" pref="776" max="-2" attributes="0"/> + <EmptySpace pref="33" max="32767" attributes="0"/> + </Group> </Group> </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> - <EmptySpace min="0" pref="300" max="32767" attributes="0"/> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="18" max="-2" attributes="0"/> + <Component id="jLabelRules" min="-2" pref="597" max="-2" attributes="0"/> + <EmptySpace pref="38" max="32767" attributes="0"/> + </Group> </Group> </DimensionLayout> </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabelRules"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Segoe UI" size="18" style="0"/> + </Property> + <Property name="text" type="java.lang.String" value="&lt;html&gt;&#xa;&#xa;&lt;h1&gt;Initial Setup&lt;/h1&gt;&#xa;Blackjack, also known as 21, is one of the most popular casino games in the world.&#xa;Blackjack is a card-game where players compete against the dealer. &#xa;Blackjack is played with one or more decks of 52 playing cards.&#xa;&#xa;&lt;h1&gt;Objective&lt;/h1&gt;&#xa;The objective of Blackjack is to reach 21 or to reach a score higher than the dealer without exceeding 21.&#xa;&#xa;&lt;h1&gt;Playing The Game&lt;/h1&gt;&#xa;&lt;p&gt;&#xa;The player begins by placing a bet on the table and the dealer deals two cards to the player.&#xa;Kings, Queens and Jacks are counted as 10.&#xa;Aces count as either 1 or 11 for both the dealer and the player.&#xa;All other cards are counted as the numeric value shown on the card.&#xa;&lt;/p&gt;&#xa;&lt;p&gt;&#xa;After receiving the initial two cards, their value is added together.&#xa;The player then has the option of getting a &apos;hit&apos; to receive an additional card, or to &apos;stand&apos; and stop receiving more cards.&#xa;In a given round, the player or the dealer win by reaching 21 or by having the highest score that is less than 21.&#xa;&lt;/p&gt;&#xa;&lt;p&gt;&#xa;Scoring higher than 21 (called a &apos;bust&apos;) results in a loss. &#xa;If the dealer busts, the player wins by having any final score that is less than 21.&#xa;&lt;/p&gt;&#xa;If both the dealer&apos;s and player&apos;s cards add up to the same number, that hand is considered a tie and is called a &apos;push&apos;.&#xa;The player doesn&apos;t win or lose any money on a push.&#xa;&#xa;&lt;/html&gt;"/> + </Properties> + </Component> + </SubComponents> </Form> diff --git a/src/view/RulesUI.java b/src/view/RulesUI.java @@ -28,17 +28,30 @@ public class RulesUI extends javax.swing.JFrame { // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { - setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + jLabelRules = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); + setTitle("Rules"); + setAlwaysOnTop(true); + + jLabelRules.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N + jLabelRules.setText("<html>\n\n<h1>Initial Setup</h1>\nBlackjack, also known as 21, is one of the most popular casino games in the world.\nBlackjack is a card-game where players compete against the dealer. \nBlackjack is played with one or more decks of 52 playing cards.\n\n<h1>Objective</h1>\nThe objective of Blackjack is to reach 21 or to reach a score higher than the dealer without exceeding 21.\n\n<h1>Playing The Game</h1>\n<p>\nThe player begins by placing a bet on the table and the dealer deals two cards to the player.\nKings, Queens and Jacks are counted as 10.\nAces count as either 1 or 11 for both the dealer and the player.\nAll other cards are counted as the numeric value shown on the card.\n</p>\n<p>\nAfter receiving the initial two cards, their value is added together.\nThe player then has the option of getting a 'hit' to receive an additional card, or to 'stand' and stop receiving more cards.\nIn a given round, the player or the dealer win by reaching 21 or by having the highest score that is less than 21.\n</p>\n<p>\nScoring higher than 21 (called a 'bust') results in a loss. \nIf the dealer busts, the player wins by having any final score that is less than 21.\n</p>\nIf both the dealer's and player's cards add up to the same number, that hand is considered a tie and is called a 'push'.\nThe player doesn't win or lose any money on a push.\n\n</html>"); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 400, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addGap(21, 21, 21) + .addComponent(jLabelRules, javax.swing.GroupLayout.PREFERRED_SIZE, 776, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(33, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGap(0, 300, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addGap(18, 18, 18) + .addComponent(jLabelRules, javax.swing.GroupLayout.PREFERRED_SIZE, 597, javax.swing.GroupLayout.PREFERRED_SIZE) + .addContainerGap(38, Short.MAX_VALUE)) ); pack(); @@ -62,5 +75,6 @@ public class RulesUI extends javax.swing.JFrame { } // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabelRules; // End of variables declaration//GEN-END:variables }