Commits

Mark C committed c33c80d

gui adjust

  • Participants
  • Parent commits d241732

Comments (0)

Files changed (4)

File src/KeyStoreGUI/KeyPanel.form

-<?xml version="1.0" encoding="UTF-8" ?>
-
-<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
-  <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="38" max="-2" attributes="0"/>
-              <Group type="103" groupAlignment="0" attributes="0">
-                  <Component id="jScrollPane1" min="-2" pref="470" max="-2" attributes="0"/>
-                  <Group type="102" attributes="0">
-                      <Component id="generateNewButton" min="-2" max="-2" attributes="0"/>
-                      <EmptySpace type="separate" max="-2" attributes="0"/>
-                      <Component id="openExistingButton" min="-2" max="-2" attributes="0"/>
-                  </Group>
-              </Group>
-              <EmptySpace pref="452" 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="57" max="-2" attributes="0"/>
-              <Group type="103" groupAlignment="3" attributes="0">
-                  <Component id="generateNewButton" alignment="3" min="-2" max="-2" attributes="0"/>
-                  <Component id="openExistingButton" alignment="3" min="-2" max="-2" attributes="0"/>
-              </Group>
-              <EmptySpace type="separate" max="-2" attributes="0"/>
-              <Component id="jScrollPane1" min="-2" pref="243" max="-2" attributes="0"/>
-              <EmptySpace pref="362" max="32767" attributes="0"/>
-          </Group>
-      </Group>
-    </DimensionLayout>
-  </Layout>
-  <SubComponents>
-    <Component class="javax.swing.JButton" name="generateNewButton">
-      <Properties>
-        <Property name="text" type="java.lang.String" value="Generate new"/>
-      </Properties>
-      <Events>
-        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="generateNewButtonActionPerformed"/>
-      </Events>
-    </Component>
-    <Component class="javax.swing.JToggleButton" name="openExistingButton">
-      <Properties>
-        <Property name="text" type="java.lang.String" value="Open existing"/>
-      </Properties>
-    </Component>
-    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
-      <AuxValues>
-        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
-      </AuxValues>
-
-      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
-      <SubComponents>
-        <Component class="javax.swing.JTextArea" name="csrTextField">
-          <Properties>
-            <Property name="editable" type="boolean" value="false"/>
-            <Property name="columns" type="int" value="20"/>
-            <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
-              <Font name="Courier New" size="12" style="0"/>
-            </Property>
-            <Property name="rows" type="int" value="5"/>
-            <Property name="autoscrolls" type="boolean" value="false"/>
-          </Properties>
-          <Events>
-            <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="csrTextFieldMouseClicked"/>
-          </Events>
-        </Component>
-      </SubComponents>
-    </Container>
-  </SubComponents>
-</Form>

File src/KeyStoreGUI/KeyPanel.java

-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package KeyStoreGUI;
-
-import javax.swing.Box;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
-import javax.swing.JPasswordField;
-
-/**
- *
- * @author lp1
- */
-public class KeyPanel extends javax.swing.JPanel {
-    private static Integer bitLength = 2048;
-    /**
-     * Creates new form KeyPanel
-     */
-    public KeyPanel() {
-        initComponents();
-    }
-    
-    private static String getPassword(String message) {
-        JPasswordField jpf = new JPasswordField(24);
-        JLabel jl = new JLabel(message);
-        Box box = Box.createHorizontalBox();
-        box.add(jl);
-        box.add(jpf);
-        // TODO get password input field to pull focus
-        int x = JOptionPane.showConfirmDialog(null, box, "Password Entry", JOptionPane.OK_CANCEL_OPTION);
-        
-        if (x == JOptionPane.OK_OPTION) {
-        //TODO dont store passswords as string, use char[]
-        return  new String (jpf.getPassword());
-    }
-    return null;
-  }
-
-    /**
-     * 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() {
-
-        generateNewButton = new javax.swing.JButton();
-        openExistingButton = new javax.swing.JToggleButton();
-        jScrollPane1 = new javax.swing.JScrollPane();
-        csrTextField = new javax.swing.JTextArea();
-
-        generateNewButton.setText("Generate new");
-        generateNewButton.addActionListener(new java.awt.event.ActionListener() {
-            public void actionPerformed(java.awt.event.ActionEvent evt) {
-                generateNewButtonActionPerformed(evt);
-            }
-        });
-
-        openExistingButton.setText("Open existing");
-
-        csrTextField.setEditable(false);
-        csrTextField.setColumns(20);
-        csrTextField.setFont(new java.awt.Font("Courier New", 0, 12)); // NOI18N
-        csrTextField.setRows(5);
-        csrTextField.setAutoscrolls(false);
-        csrTextField.addMouseListener(new java.awt.event.MouseAdapter() {
-            public void mouseClicked(java.awt.event.MouseEvent evt) {
-                csrTextFieldMouseClicked(evt);
-            }
-        });
-        jScrollPane1.setViewportView(csrTextField);
-
-        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
-        this.setLayout(layout);
-        layout.setHorizontalGroup(
-            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGroup(layout.createSequentialGroup()
-                .addGap(38, 38, 38)
-                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 470, javax.swing.GroupLayout.PREFERRED_SIZE)
-                    .addGroup(layout.createSequentialGroup()
-                        .addComponent(generateNewButton)
-                        .addGap(18, 18, 18)
-                        .addComponent(openExistingButton)))
-                .addContainerGap(452, Short.MAX_VALUE))
-        );
-        layout.setVerticalGroup(
-            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
-            .addGroup(layout.createSequentialGroup()
-                .addGap(57, 57, 57)
-                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
-                    .addComponent(generateNewButton)
-                    .addComponent(openExistingButton))
-                .addGap(18, 18, 18)
-                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)
-                .addContainerGap(362, Short.MAX_VALUE))
-        );
-    }// </editor-fold>//GEN-END:initComponents
-
-    private void generateNewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateNewButtonActionPerformed
-        String keyPassword = getPassword("Enter new key password: ");
-        String keyPassword2 = getPassword("Confirm password: ");
-        if (keyPassword.equals(keyPassword2)) {
-            String c = JOptionPane.showInputDialog(null, "Enter country code (http://www.digicert.com/ssl-certificate-country-codes.htm for valid options): ","", 1);
-            String o = JOptionPane.showInputDialog(null, "Organisation name: ","", 1);
-            String cn = JOptionPane.showInputDialog(null, "Common name: ","", 1);
-            String email = JOptionPane.showInputDialog(null, "Contact email: ","", 1);
-            String x500Text = "C=" + c + ", O=" + o + ", CN=" + cn + ", EMAILADDRESS=" + email;
-            KeyStore.KeyStoreController newKeySess = new KeyStore.KeyStoreController(bitLength, keyPassword, cn + ".pem");
-            csrTextField.setText(newKeySess.getCSR(x500Text));
-        } else
-             JOptionPane.showMessageDialog(null, "Passwords do not match", "Oops", JOptionPane.INFORMATION_MESSAGE);
-    }//GEN-LAST:event_generateNewButtonActionPerformed
-
-    private void csrTextFieldMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_csrTextFieldMouseClicked
-        csrTextField.selectAll();
-    }//GEN-LAST:event_csrTextFieldMouseClicked
-
-    // Variables declaration - do not modify//GEN-BEGIN:variables
-    private javax.swing.JTextArea csrTextField;
-    private javax.swing.JButton generateNewButton;
-    private javax.swing.JScrollPane jScrollPane1;
-    private javax.swing.JToggleButton openExistingButton;
-    // End of variables declaration//GEN-END:variables
-}

File src/KeyStoreGUI/MainMenuPanel.form

+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.8" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
+  <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="38" max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="0" attributes="0">
+                  <Component id="jScrollPane1" min="-2" pref="470" max="-2" attributes="0"/>
+                  <Group type="102" attributes="0">
+                      <Component id="generateNewButton" min="-2" max="-2" attributes="0"/>
+                      <EmptySpace type="separate" max="-2" attributes="0"/>
+                      <Component id="openExistingButton" min="-2" max="-2" attributes="0"/>
+                  </Group>
+              </Group>
+              <EmptySpace pref="452" 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="57" max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="generateNewButton" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="openExistingButton" alignment="3" min="-2" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace type="separate" max="-2" attributes="0"/>
+              <Component id="jScrollPane1" min="-2" pref="243" max="-2" attributes="0"/>
+              <EmptySpace pref="362" max="32767" attributes="0"/>
+          </Group>
+      </Group>
+    </DimensionLayout>
+  </Layout>
+  <SubComponents>
+    <Component class="javax.swing.JButton" name="generateNewButton">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Generate new"/>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="generateNewButtonActionPerformed"/>
+      </Events>
+    </Component>
+    <Component class="javax.swing.JToggleButton" name="openExistingButton">
+      <Properties>
+        <Property name="text" type="java.lang.String" value="Open existing"/>
+      </Properties>
+    </Component>
+    <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+      <AuxValues>
+        <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+      </AuxValues>
+
+      <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+      <SubComponents>
+        <Component class="javax.swing.JTextArea" name="csrTextField">
+          <Properties>
+            <Property name="editable" type="boolean" value="false"/>
+            <Property name="columns" type="int" value="20"/>
+            <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
+              <Font name="Courier New" size="12" style="0"/>
+            </Property>
+            <Property name="rows" type="int" value="5"/>
+            <Property name="autoscrolls" type="boolean" value="false"/>
+          </Properties>
+          <Events>
+            <EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="csrTextFieldMouseClicked"/>
+          </Events>
+        </Component>
+      </SubComponents>
+    </Container>
+  </SubComponents>
+</Form>

File src/KeyStoreGUI/MainMenuPanel.java

+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package KeyStoreGUI;
+
+import javax.swing.Box;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPasswordField;
+
+/**
+ *
+ * @author lp1
+ */
+public class KeyPanel extends javax.swing.JPanel {
+    private static Integer bitLength = 2048;
+    /**
+     * Creates new form KeyPanel
+     */
+    public KeyPanel() {
+        initComponents();
+    }
+    
+    private static String getPassword(String message) {
+        JPasswordField jpf = new JPasswordField(24);
+        JLabel jl = new JLabel(message);
+        Box box = Box.createHorizontalBox();
+        box.add(jl);
+        box.add(jpf);
+        // TODO get password input field to pull focus
+        int x = JOptionPane.showConfirmDialog(null, box, "Password Entry", JOptionPane.OK_CANCEL_OPTION);
+        
+        if (x == JOptionPane.OK_OPTION) {
+        //TODO dont store passswords as string, use char[]
+        return  new String (jpf.getPassword());
+    }
+    return null;
+  }
+
+    /**
+     * 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() {
+
+        generateNewButton = new javax.swing.JButton();
+        openExistingButton = new javax.swing.JToggleButton();
+        jScrollPane1 = new javax.swing.JScrollPane();
+        csrTextField = new javax.swing.JTextArea();
+
+        generateNewButton.setText("Generate new");
+        generateNewButton.addActionListener(new java.awt.event.ActionListener() {
+            public void actionPerformed(java.awt.event.ActionEvent evt) {
+                generateNewButtonActionPerformed(evt);
+            }
+        });
+
+        openExistingButton.setText("Open existing");
+
+        csrTextField.setEditable(false);
+        csrTextField.setColumns(20);
+        csrTextField.setFont(new java.awt.Font("Courier New", 0, 12)); // NOI18N
+        csrTextField.setRows(5);
+        csrTextField.setAutoscrolls(false);
+        csrTextField.addMouseListener(new java.awt.event.MouseAdapter() {
+            public void mouseClicked(java.awt.event.MouseEvent evt) {
+                csrTextFieldMouseClicked(evt);
+            }
+        });
+        jScrollPane1.setViewportView(csrTextField);
+
+        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
+        this.setLayout(layout);
+        layout.setHorizontalGroup(
+            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(layout.createSequentialGroup()
+                .addGap(38, 38, 38)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 470, javax.swing.GroupLayout.PREFERRED_SIZE)
+                    .addGroup(layout.createSequentialGroup()
+                        .addComponent(generateNewButton)
+                        .addGap(18, 18, 18)
+                        .addComponent(openExistingButton)))
+                .addContainerGap(452, Short.MAX_VALUE))
+        );
+        layout.setVerticalGroup(
+            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+            .addGroup(layout.createSequentialGroup()
+                .addGap(57, 57, 57)
+                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+                    .addComponent(generateNewButton)
+                    .addComponent(openExistingButton))
+                .addGap(18, 18, 18)
+                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 243, javax.swing.GroupLayout.PREFERRED_SIZE)
+                .addContainerGap(362, Short.MAX_VALUE))
+        );
+    }// </editor-fold>//GEN-END:initComponents
+
+    private void generateNewButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_generateNewButtonActionPerformed
+        String keyPassword = getPassword("Enter new key password: ");
+        String keyPassword2 = getPassword("Confirm password: ");
+        if (keyPassword.equals(keyPassword2)) {
+            String c = JOptionPane.showInputDialog(null, "Enter country code (http://www.digicert.com/ssl-certificate-country-codes.htm for valid options): ","", 1);
+            String o = JOptionPane.showInputDialog(null, "Organisation name: ","", 1);
+            String cn = JOptionPane.showInputDialog(null, "Common name: ","", 1);
+            String email = JOptionPane.showInputDialog(null, "Contact email: ","", 1);
+            String x500Text = "C=" + c + ", O=" + o + ", CN=" + cn + ", EMAILADDRESS=" + email;
+            KeyStore.KeyStoreController newKeySess = new KeyStore.KeyStoreController(bitLength, keyPassword, cn + ".pem");
+            csrTextField.setText(newKeySess.getCSR(x500Text));
+        } else
+             JOptionPane.showMessageDialog(null, "Passwords do not match", "Oops", JOptionPane.INFORMATION_MESSAGE);
+    }//GEN-LAST:event_generateNewButtonActionPerformed
+
+    private void csrTextFieldMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_csrTextFieldMouseClicked
+        csrTextField.selectAll();
+    }//GEN-LAST:event_csrTextFieldMouseClicked
+
+    // Variables declaration - do not modify//GEN-BEGIN:variables
+    private javax.swing.JTextArea csrTextField;
+    private javax.swing.JButton generateNewButton;
+    private javax.swing.JScrollPane jScrollPane1;
+    private javax.swing.JToggleButton openExistingButton;
+    // End of variables declaration//GEN-END:variables
+}