commit 695db478368d08c6f768110e7b9bbbe06d1fb2a9
parent 5161542c5835ca4e41bed27f27ff0ffecaa3b9a4
Author: Michael Neuper <michael@michaelneuper.com>
Date: Thu, 11 May 2023 21:03:57 +0200
Create MenuUI
Diffstat:
| A | src/view/MenuUI.form | | | 141 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
| A | src/view/MenuUI.java | | | 159 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
2 files changed, 300 insertions(+), 0 deletions(-)
diff --git a/src/view/MenuUI.form b/src/view/MenuUI.form
@@ -0,0 +1,141 @@
+<?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="2"/>
+ <Property name="title" type="java.lang.String" value="Menu"/>
+ <Property name="alwaysOnTop" type="boolean" value="true"/>
+ </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"/>
+ <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-85,0,0,2,66"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="jPanelNorth">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="North"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="-2" pref="225" max="-2" attributes="0"/>
+ <Component id="jLabelMenu" min="-2" max="-2" attributes="0"/>
+ <EmptySpace pref="231" 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="23" max="-2" attributes="0"/>
+ <Component id="jLabelMenu" min="-2" pref="54" max="-2" attributes="0"/>
+ <EmptySpace pref="29" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="jLabelMenu">
+ <Properties>
+ <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
+ <Font name="Segoe UI" size="48" style="0"/>
+ </Property>
+ <Property name="text" type="java.lang.String" value="Menu"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Container class="javax.swing.JPanel" name="jPanelCenter">
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
+ <BorderConstraints direction="Center"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace min="-2" pref="219" max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jButtonSource" min="-2" pref="140" max="-2" attributes="0"/>
+ <Component id="jButtonRules" min="-2" pref="140" max="-2" attributes="0"/>
+ <Component id="jButtonStatistics" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace pref="219" 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="24" max="-2" attributes="0"/>
+ <Component id="jButtonStatistics" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="-2" pref="59" max="-2" attributes="0"/>
+ <Component id="jButtonRules" min="-2" max="-2" attributes="0"/>
+ <EmptySpace min="-2" pref="59" max="-2" attributes="0"/>
+ <Component id="jButtonSource" min="-2" max="-2" attributes="0"/>
+ <EmptySpace pref="86" max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JButton" name="jButtonStatistics">
+ <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="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
+ <Image iconType="3" name="/assets/icons/stats.png"/>
+ </Property>
+ <Property name="text" type="java.lang.String" value="STATISTICS"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JButton" name="jButtonRules">
+ <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="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
+ <Image iconType="3" name="/assets/icons/question.png"/>
+ </Property>
+ <Property name="text" type="java.lang.String" value="RULES"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JButton" name="jButtonSource">
+ <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="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
+ <Image iconType="3" name="/assets/icons/code.png"/>
+ </Property>
+ <Property name="text" type="java.lang.String" value="SOURCE"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButtonSourceActionPerformed"/>
+ </Events>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>
diff --git a/src/view/MenuUI.java b/src/view/MenuUI.java
@@ -0,0 +1,159 @@
+package view;
+
+import com.formdev.flatlaf.FlatDarkLaf;
+import java.awt.Desktop;
+import java.net.URI;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+/**
+ * GUI to show the following options:
+ * <ul>
+ * <li>Statistics</li>
+ * <li>Rules</li>
+ * <li>Source</li>
+ * </ul>
+ *
+ * @author Michael Neuper
+ * <a href="mailto:michael@michaelneuper.com">michael@michaelneuper.com</a>
+ */
+public class MenuUI extends javax.swing.JFrame {
+
+ /**
+ * Creates new form OptionsUI
+ */
+ public MenuUI() {
+ 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() {
+
+ jPanelNorth = new javax.swing.JPanel();
+ jLabelMenu = new javax.swing.JLabel();
+ jPanelCenter = new javax.swing.JPanel();
+ jButtonStatistics = new javax.swing.JButton();
+ jButtonRules = new javax.swing.JButton();
+ jButtonSource = new javax.swing.JButton();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
+ setTitle("Menu");
+ setAlwaysOnTop(true);
+
+ jLabelMenu.setFont(new java.awt.Font("Segoe UI", 0, 48)); // NOI18N
+ jLabelMenu.setText("Menu");
+
+ javax.swing.GroupLayout jPanelNorthLayout = new javax.swing.GroupLayout(jPanelNorth);
+ jPanelNorth.setLayout(jPanelNorthLayout);
+ jPanelNorthLayout.setHorizontalGroup(
+ jPanelNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelNorthLayout.createSequentialGroup()
+ .addGap(225, 225, 225)
+ .addComponent(jLabelMenu)
+ .addContainerGap(231, Short.MAX_VALUE))
+ );
+ jPanelNorthLayout.setVerticalGroup(
+ jPanelNorthLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelNorthLayout.createSequentialGroup()
+ .addGap(23, 23, 23)
+ .addComponent(jLabelMenu, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(29, Short.MAX_VALUE))
+ );
+
+ getContentPane().add(jPanelNorth, java.awt.BorderLayout.NORTH);
+
+ jButtonStatistics.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
+ jButtonStatistics.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assets/icons/stats.png"))); // NOI18N
+ jButtonStatistics.setText("STATISTICS");
+
+ jButtonRules.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
+ jButtonRules.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assets/icons/question.png"))); // NOI18N
+ jButtonRules.setText("RULES");
+
+ jButtonSource.setFont(new java.awt.Font("Segoe UI", 0, 18)); // NOI18N
+ jButtonSource.setIcon(new javax.swing.ImageIcon(getClass().getResource("/assets/icons/code.png"))); // NOI18N
+ jButtonSource.setText("SOURCE");
+ jButtonSource.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButtonSourceActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout jPanelCenterLayout = new javax.swing.GroupLayout(jPanelCenter);
+ jPanelCenter.setLayout(jPanelCenterLayout);
+ jPanelCenterLayout.setHorizontalGroup(
+ jPanelCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelCenterLayout.createSequentialGroup()
+ .addGap(219, 219, 219)
+ .addGroup(jPanelCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jButtonSource, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jButtonRules, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(jButtonStatistics))
+ .addContainerGap(219, Short.MAX_VALUE))
+ );
+ jPanelCenterLayout.setVerticalGroup(
+ jPanelCenterLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanelCenterLayout.createSequentialGroup()
+ .addGap(24, 24, 24)
+ .addComponent(jButtonStatistics)
+ .addGap(59, 59, 59)
+ .addComponent(jButtonRules)
+ .addGap(59, 59, 59)
+ .addComponent(jButtonSource)
+ .addContainerGap(86, Short.MAX_VALUE))
+ );
+
+ getContentPane().add(jPanelCenter, java.awt.BorderLayout.CENTER);
+
+ pack();
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void jButtonSourceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSourceActionPerformed
+ try {
+ // get the user's default browser
+ Desktop desktop = Desktop.getDesktop();
+
+ // open the URL in the default browser
+ desktop.browse(new URI("https://github.com/michaelneuper/librejack"));
+ } catch (Exception e) {
+ System.err.println(e);
+ }
+ }//GEN-LAST:event_jButtonSourceActionPerformed
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ /* Set the FlatDarkLaf look and feel */
+ try {
+ UIManager.setLookAndFeel(new FlatDarkLaf());
+ } catch (UnsupportedLookAndFeelException e) {
+ System.err.println(e);
+ }
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(() -> {
+ new MainUI().setVisible(true);
+ });
+
+ /* Create and display the form */
+ java.awt.EventQueue.invokeLater(() -> {
+ new MenuUI().setVisible(true);
+ });
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton jButtonRules;
+ private javax.swing.JButton jButtonSource;
+ private javax.swing.JButton jButtonStatistics;
+ private javax.swing.JLabel jLabelMenu;
+ private javax.swing.JPanel jPanelCenter;
+ private javax.swing.JPanel jPanelNorth;
+ // End of variables declaration//GEN-END:variables
+}