librejack

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

commit adf6f935d7904d9e76ea05ac2ccf4de156cc629a
parent 3d76de317c3c2087c90efb0b1b655cd038175465
Author: Michael Neuper <73108749+michaelneuper@users.noreply.github.com>
Date:   Thu, 27 Apr 2023 21:10:45 +0200

Create StatisticsGUI.java

Diffstat:
Asrc/view/StatisticsGUI.form | 139+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/view/StatisticsGUI.java | 159+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 298 insertions(+), 0 deletions(-)

diff --git a/src/view/StatisticsGUI.form b/src/view/StatisticsGUI.form @@ -0,0 +1,139 @@ +<?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"/> + </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="-2" pref="36" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" attributes="0"> + <Component id="jLabelLosses" min="-2" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jLabelLossesAmount" min="-2" pref="217" max="-2" attributes="0"/> + </Group> + <Component id="jLabelStatistics" min="-2" pref="342" max="-2" attributes="0"/> + <Group type="102" alignment="0" attributes="0"> + <Component id="jLabelWins" min="-2" pref="84" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Component id="jLabelWinsAmount" min="-2" pref="217" max="-2" attributes="0"/> + </Group> + <Group type="102" alignment="0" attributes="0"> + <Component id="jLabelPushes" min="-2" max="-2" attributes="0"/> + <EmptySpace type="unrelated" max="-2" attributes="0"/> + <Component id="jLabelPushesAmount" min="-2" pref="217" max="-2" attributes="0"/> + </Group> + </Group> + <EmptySpace pref="543" max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + <DimensionLayout dim="1"> + <Group type="103" groupAlignment="0" attributes="0"> + <Group type="102" alignment="0" attributes="0"> + <EmptySpace min="-2" pref="27" max="-2" attributes="0"/> + <Component id="jLabelStatistics" min="-2" pref="44" max="-2" attributes="0"/> + <EmptySpace min="-2" pref="101" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabelWins" alignment="3" min="-2" pref="26" max="-2" attributes="0"/> + <Component id="jLabelWinsAmount" alignment="3" min="-2" pref="43" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="40" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabelLosses" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabelLossesAmount" alignment="3" min="-2" pref="43" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="37" max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="jLabelPushes" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabelPushesAmount" alignment="3" min="-2" pref="43" max="-2" attributes="0"/> + </Group> + <EmptySpace pref="305" max="32767" attributes="0"/> + </Group> + </Group> + </DimensionLayout> + </Layout> + <SubComponents> + <Component class="javax.swing.JLabel" name="jLabelStatistics"> + <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="Statistics"/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabelWins"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Dialog" size="24" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Wins:"/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabelWinsAmount"> + <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" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="&quot;&quot; + stats.getWins()" type="code"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabelPushes"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Dialog" size="24" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Pushes:"/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabelPushesAmount"> + <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" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="&quot;&quot; + stats.getPushes()" type="code"/> + </Property> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabelLosses"> + <Properties> + <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> + <Font name="Dialog" size="24" style="1"/> + </Property> + <Property name="text" type="java.lang.String" value="Losses:"/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabelLossesAmount"> + <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" editor="org.netbeans.modules.form.RADConnectionPropertyEditor"> + <Connection code="&quot;&quot; + stats.getLosses()" type="code"/> + </Property> + </Properties> + </Component> + </SubComponents> +</Form> diff --git a/src/view/StatisticsGUI.java b/src/view/StatisticsGUI.java @@ -0,0 +1,159 @@ +package view; +import com.opencsv.exceptions.CsvValidationException; +import java.io.IOException; +import java.util.logging.Level; +import java.util.logging.Logger; +import model.Statistics; + +/** + * + * @author michael + */ +public class StatisticsGUI extends javax.swing.JFrame { + + Statistics stats; + + + /** + * Creates new form StatisticsGUI + */ + public StatisticsGUI() throws IOException { + this.stats = Statistics.load(); + 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() { + + jLabelStatistics = new javax.swing.JLabel(); + jLabelWins = new javax.swing.JLabel(); + jLabelWinsAmount = new javax.swing.JLabel(); + jLabelPushes = new javax.swing.JLabel(); + jLabelPushesAmount = new javax.swing.JLabel(); + jLabelLosses = new javax.swing.JLabel(); + jLabelLossesAmount = new javax.swing.JLabel(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + + jLabelStatistics.setFont(new java.awt.Font("Dialog", 1, 48)); // NOI18N + jLabelStatistics.setText("Statistics"); + + jLabelWins.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N + jLabelWins.setText("Wins:"); + + jLabelWinsAmount.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N + jLabelWinsAmount.setText("" + stats.getWins()); + + jLabelPushes.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N + jLabelPushes.setText("Pushes:"); + + jLabelPushesAmount.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N + jLabelPushesAmount.setText("" + stats.getPushes()); + + jLabelLosses.setFont(new java.awt.Font("Dialog", 1, 24)); // NOI18N + jLabelLosses.setText("Losses:"); + + jLabelLossesAmount.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N + jLabelLossesAmount.setText("" + stats.getLosses()); + + 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(36, 36, 36) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabelLosses) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabelLossesAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(jLabelStatistics, javax.swing.GroupLayout.PREFERRED_SIZE, 342, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabelWins, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jLabelWinsAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabelPushes) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(jLabelPushesAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(543, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(27, 27, 27) + .addComponent(jLabelStatistics, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(101, 101, 101) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabelWins, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabelWinsAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(40, 40, 40) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabelLosses) + .addComponent(jLabelLossesAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(37, 37, 37) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jLabelPushes) + .addComponent(jLabelPushesAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(305, Short.MAX_VALUE)) + ); + + pack(); + }// </editor-fold>//GEN-END:initComponents + + /** + * @param args the command line arguments + */ + public static void main(String args[]) throws CsvValidationException { + /* 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(StatisticsGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(StatisticsGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(StatisticsGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(StatisticsGUI.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() { + try { + new StatisticsGUI().setVisible(true); + } catch (IOException ex) { + Logger.getLogger(StatisticsGUI.class.getName()).log(Level.SEVERE, null, ex); + } + } + }); + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabelLosses; + private javax.swing.JLabel jLabelLossesAmount; + private javax.swing.JLabel jLabelPushes; + private javax.swing.JLabel jLabelPushesAmount; + private javax.swing.JLabel jLabelStatistics; + private javax.swing.JLabel jLabelWins; + private javax.swing.JLabel jLabelWinsAmount; + // End of variables declaration//GEN-END:variables +}