Fixed alignment for labels and fields
authorlhauch <lhauch@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 12 Oct 2006 20:39:25 +0000 (20:39 +0000)
committerlhauch <lhauch@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 12 Oct 2006 20:39:25 +0000 (20:39 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1735 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Java/Source/FrameworkWizard/src/org/tianocore/frameworkwizard/packaging/ui/SpdPackageHeaders.java

index 1deccad..8ee8805 100644 (file)
@@ -77,10 +77,6 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
 \r
     private JButton jButtonClearAll = null;\r
 \r
-    private JButton jButtonCancel = null;\r
-\r
-    private JButton jButtonOk = null;\r
-\r
     private JLabel jLabel = null;\r
 \r
     private JTextField jTextField = null;\r
@@ -99,6 +95,18 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
 \r
     private JTable jTable = null;\r
 \r
+    private final int buttonWidth = 100;\r
+    private final int buttonSep = 6;\r
+    private final int addButtonCol = 148;\r
+    private final int removeButtonCol = addButtonCol + buttonWidth + buttonSep;\r
+    private final int removeAllButtonCol = removeButtonCol + buttonWidth + buttonSep;\r
+    private final int labelCol = 12;\r
+    private final int valueCol = 168;\r
+    private final int rowOne = 12;\r
+    private final int rowTwo = rowOne + 25;\r
+    private final int rowThree = rowTwo + 25;\r
+    private final int rowFour = rowThree + 30;\r
+    private final int rowFive = rowFour + 30;\r
 \r
 \r
     /**\r
@@ -112,14 +120,14 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
     }\r
 \r
     /**\r
-      This method initializes jRadioButtonSelect       \r
+      This method initializes jLabelSelect\r
        \r
-      @return javax.swing.JRadioButton \r
+      @return javax.swing.JLabel jLabelSelect\r
      **/\r
     private JLabel getJLabelSelect() {\r
         if (jLabelSelect == null) {\r
             jLabelSelect = new JLabel();\r
-            jLabelSelect.setBounds(new java.awt.Rectangle(14,10,198,20));\r
+            jLabelSelect.setBounds(new java.awt.Rectangle(labelCol,rowOne,155,20));\r
             jLabelSelect.setText("Select ModuleType");\r
 \r
         }\r
@@ -134,7 +142,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
     private JComboBox getJComboBoxSelect() {\r
         if (jComboBoxSelect == null) {\r
             jComboBoxSelect = new JComboBox();\r
-            jComboBoxSelect.setBounds(new java.awt.Rectangle(220, 10, 260, 20));\r
+            jComboBoxSelect.setBounds(new java.awt.Rectangle(valueCol, rowOne, 260, 20));\r
             jComboBoxSelect.setPreferredSize(new java.awt.Dimension(260,20));\r
             \r
             jComboBoxSelect.setEnabled(true);\r
@@ -165,7 +173,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
     private JButton getJButtonAdd() {\r
         if (jButtonAdd == null) {\r
             jButtonAdd = new JButton();\r
-            jButtonAdd.setBounds(new java.awt.Rectangle(189,119,73,20));\r
+            jButtonAdd.setBounds(new java.awt.Rectangle(addButtonCol,rowFour,buttonWidth,20));\r
             jButtonAdd.setText("Add");\r
             jButtonAdd.addActionListener(this);\r
         }\r
@@ -180,7 +188,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
     private JButton getJButtonRemove() {\r
         if (jButtonRemove == null) {\r
             jButtonRemove = new JButton();\r
-            jButtonRemove.setBounds(new java.awt.Rectangle(271,119,87,20));\r
+            jButtonRemove.setBounds(new java.awt.Rectangle(removeButtonCol,rowFour,buttonWidth,20));\r
             jButtonRemove.setText("Remove");\r
             jButtonRemove.addActionListener(this);\r
         }\r
@@ -195,48 +203,13 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
     private JButton getJButtonClearAll() {\r
         if (jButtonClearAll == null) {\r
             jButtonClearAll = new JButton();\r
-            jButtonClearAll.setBounds(new java.awt.Rectangle(374,119,90,20));\r
+            jButtonClearAll.setBounds(new java.awt.Rectangle(removeAllButtonCol,rowFour,buttonWidth,20));\r
             jButtonClearAll.setText("Clear All");\r
             jButtonClearAll.addActionListener(this);\r
         }\r
         return jButtonClearAll;\r
     }\r
 \r
-    /**\r
-      This method initializes jButtonCancel    \r
-       \r
-      @return javax.swing.JButton      \r
-     **/\r
-    private JButton getJButtonCancel() {\r
-        if (jButtonCancel == null) {\r
-            jButtonCancel = new JButton();\r
-            jButtonCancel.setPreferredSize(new java.awt.Dimension(90, 20));\r
-            jButtonCancel.setLocation(new java.awt.Point(390, 305));\r
-            jButtonCancel.setText("Cancel");\r
-            jButtonCancel.setSize(new java.awt.Dimension(90, 20));\r
-            jButtonCancel.setVisible(false);\r
-            jButtonCancel.addActionListener(this);\r
-        }\r
-        return jButtonCancel;\r
-    }\r
-\r
-    /**\r
-      This method initializes jButton  \r
-       \r
-      @return javax.swing.JButton      \r
-     **/\r
-    private JButton getJButtonOk() {\r
-        if (jButtonOk == null) {\r
-            jButtonOk = new JButton();\r
-            jButtonOk.setSize(new java.awt.Dimension(90, 20));\r
-            jButtonOk.setText("OK");\r
-            jButtonOk.setLocation(new java.awt.Point(290, 305));\r
-            jButtonOk.setVisible(false);\r
-            jButtonOk.addActionListener(this);\r
-        }\r
-        return jButtonOk;\r
-    }\r
-\r
     /**\r
       This is the default constructor\r
      **/\r
@@ -306,11 +279,11 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
     private JPanel getJContentPane() {\r
         if (jContentPane == null) {\r
             jStarLabel1 = new StarLabel();\r
-            jStarLabel1.setLocation(new java.awt.Point(0, 10));\r
+            jStarLabel1.setLocation(new java.awt.Point(0, rowOne));\r
             jStarLabel2 = new StarLabel();\r
-            jStarLabel2.setLocation(new java.awt.Point(0,62));\r
+            jStarLabel2.setLocation(new java.awt.Point(0,rowTwo));\r
             jLabel = new JLabel();\r
-            jLabel.setBounds(new java.awt.Rectangle(14,62,199,22));\r
+            jLabel.setBounds(new java.awt.Rectangle(labelCol,rowTwo,320,22));\r
             jLabel.setText("Include Header for Module Type");\r
             \r
             jContentPane = new JPanel();\r
@@ -324,8 +297,6 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
             jContentPane.add(getJButtonAdd(), null);\r
             jContentPane.add(getJButtonRemove(), null);\r
             jContentPane.add(getJButtonClearAll(), null);\r
-            jContentPane.add(getJButtonCancel(), null);\r
-            jContentPane.add(getJButtonOk(), null);\r
             \r
             jContentPane.add(getJTextField(), null);\r
             jContentPane.add(getJButtonBrowse(), null);\r
@@ -360,14 +331,6 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
     public void actionPerformed(ActionEvent arg0) {\r
         \r
         docConsole.setSaved(false);\r
-        if (arg0.getSource() == jButtonOk) {\r
-            this.save();\r
-            this.dispose();\r
-\r
-        }\r
-        if (arg0.getSource() == jButtonCancel) {\r
-            this.dispose();\r
-        }\r
 \r
         if (arg0.getSource() == jButtonAdd) {\r
             String strLibClass = "";\r
@@ -432,7 +395,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
     private JTextField getJTextField() {\r
         if (jTextField == null) {\r
             jTextField = new JTextField();\r
-            jTextField.setBounds(new java.awt.Rectangle(13,90,346,21));\r
+            jTextField.setBounds(new java.awt.Rectangle(labelCol,rowThree,346,20));\r
             jTextField.setPreferredSize(new java.awt.Dimension(345,20));\r
         }\r
         return jTextField;\r
@@ -446,9 +409,9 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
     private JButton getJButtonBrowse() {\r
         if (jButtonBrowse == null) {\r
             jButtonBrowse = new JButton();\r
-            jButtonBrowse.setBounds(new java.awt.Rectangle(374,89,92,21));\r
+            jButtonBrowse.setBounds(new java.awt.Rectangle(374,rowThree,buttonWidth,20));\r
             jButtonBrowse.setText("Browse");\r
-            jButtonBrowse.setPreferredSize(new java.awt.Dimension(92,20));\r
+            jButtonBrowse.setPreferredSize(new java.awt.Dimension(buttonWidth,20));\r
             jButtonBrowse.addActionListener(new javax.swing.AbstractAction() {\r
                 /**\r
                  * \r
@@ -501,7 +464,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
     private JScrollPane getJScrollPanePkgHdr() {\r
         if (jScrollPanePkgHdr == null) {\r
             jScrollPanePkgHdr = new JScrollPane();\r
-            jScrollPanePkgHdr.setBounds(new java.awt.Rectangle(13,149,453,258));\r
+            jScrollPanePkgHdr.setBounds(new java.awt.Rectangle(labelCol,rowFive,453,258));\r
             jScrollPanePkgHdr.setViewportView(getJTable());\r
         }\r
         return jScrollPanePkgHdr;\r
@@ -589,7 +552,7 @@ public class SpdPackageHeaders extends IInternalFrame implements TableModelListe
     public void componentResized(ComponentEvent arg0) {\r
         int intPreferredWidth = 500;\r
         \r
-        Tools.resizeComponentWidth(this.jComboBoxSelect, this.getWidth(), intPreferredWidth);\r
+        // Tools.resizeComponentWidth(this.jComboBoxSelect, this.getWidth(), intPreferredWidth);\r
         Tools.resizeComponentWidth(this.jTextField, this.getWidth(), intPreferredWidth);\r
         Tools.resizeComponentWidth(this.jScrollPanePkgHdr, this.getWidth(), intPreferredWidth);\r
         Tools.relocateComponentX(this.jButtonBrowse, this.getWidth(), this.getPreferredSize().width, 30);\r