fix layout

This commit is contained in:
buzz-lightsnack-2007 2024-02-25 13:05:00 +08:00
parent 12a15ba386
commit f824201e4c
2 changed files with 53 additions and 25 deletions

View file

@ -30,7 +30,7 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Container class="javax.swing.JPanel" name="jPanel_statusinfo">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Last"/>
@ -170,43 +170,44 @@
<Component class="javax.swing.JSpinner" name="jSpinner_price_tip_value">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_price_VAT_value">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="text" type="java.lang.String" value="0"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="0" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_price_subtotal_value">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="text" type="java.lang.String" value="0"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="3" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="3" gridY="0" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="jTextField_price_total_value">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Dialog" size="14" style="1"/>
<Font name="Dialog" size="20" style="1"/>
</Property>
<Property name="text" type="java.lang.String" value="0"/>
<Property name="enabled" type="boolean" value="false"/>
<Property name="dragEnabled" type="boolean" value="false"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="3" gridY="1" gridWidth="1" gridHeight="2" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="3" gridY="1" gridWidth="1" gridHeight="2" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -226,7 +227,7 @@
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="2" gridWidth="1" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -269,7 +270,7 @@
</Constraint>
</Constraints>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="jButton_item_void">
<Properties>
@ -281,8 +282,18 @@
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_item_voidActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Before"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JSpinner" name="jSpinner_item_quantity">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="Center"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="jButton_item_add">
<Properties>
@ -294,6 +305,11 @@
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_item_addActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="After"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Container>

View file

@ -29,7 +29,7 @@ public class OnTransact extends javax.swing.JFrame {
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
jPanel1 = new javax.swing.JPanel();
jPanel_statusinfo = new javax.swing.JPanel();
jComboBox1 = new javax.swing.JComboBox<>();
jLabel1 = new javax.swing.JLabel();
jPanel_Main = new javax.swing.JPanel();
@ -66,15 +66,15 @@ public class OnTransact extends javax.swing.JFrame {
}
});
jPanel1.setLayout(new java.awt.BorderLayout());
jPanel_statusinfo.setLayout(new java.awt.BorderLayout());
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
jPanel1.add(jComboBox1, java.awt.BorderLayout.EAST);
jPanel_statusinfo.add(jComboBox1, java.awt.BorderLayout.EAST);
jLabel1.setText("jLabel1");
jPanel1.add(jLabel1, java.awt.BorderLayout.LINE_START);
jPanel_statusinfo.add(jLabel1, java.awt.BorderLayout.LINE_START);
getContentPane().add(jPanel1, java.awt.BorderLayout.PAGE_END);
getContentPane().add(jPanel_statusinfo, java.awt.BorderLayout.PAGE_END);
jPanel_Main.setLayout(new java.awt.BorderLayout());
@ -119,35 +119,45 @@ public class OnTransact extends javax.swing.JFrame {
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 1;
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
gridBagConstraints.weightx = 1.0;
jPanel_Information.add(jSpinner_price_tip_value, gridBagConstraints);
jTextField_price_VAT_value.setEditable(false);
jTextField_price_VAT_value.setText("0");
jTextField_price_VAT_value.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
jPanel_Information.add(jTextField_price_VAT_value, gridBagConstraints);
jTextField_price_subtotal_value.setEditable(false);
jTextField_price_subtotal_value.setText("0");
jTextField_price_subtotal_value.setEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 0;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
jPanel_Information.add(jTextField_price_subtotal_value, gridBagConstraints);
jTextField_price_total_value.setFont(new java.awt.Font("Dialog", 1, 14)); // NOI18N
jTextField_price_total_value.setEditable(false);
jTextField_price_total_value.setFont(new java.awt.Font("Dialog", 1, 20)); // NOI18N
jTextField_price_total_value.setText("0");
jTextField_price_total_value.setEnabled(false);
jTextField_price_total_value.setDragEnabled(false);
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 3;
gridBagConstraints.gridy = 1;
gridBagConstraints.gridheight = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.weightx = 1.0;
jPanel_Information.add(jTextField_price_total_value, gridBagConstraints);
jComboBox_information_discount_selections.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 1;
gridBagConstraints.gridy = 2;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
jPanel_Information.add(jComboBox_information_discount_selections, gridBagConstraints);
jLabel2_information_discount.setText("Discount");
@ -166,6 +176,8 @@ public class OnTransact extends javax.swing.JFrame {
jPanel2.setLayout(new java.awt.BorderLayout());
jPanel_Inventory_Actions.setLayout(new java.awt.BorderLayout());
jButton_item_void.setText("Void");
jButton_item_void.setFocusable(false);
jButton_item_void.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
@ -175,8 +187,8 @@ public class OnTransact extends javax.swing.JFrame {
jButton_item_voidActionPerformed(evt);
}
});
jPanel_Inventory_Actions.add(jButton_item_void);
jPanel_Inventory_Actions.add(jSpinner_item_quantity);
jPanel_Inventory_Actions.add(jButton_item_void, java.awt.BorderLayout.LINE_START);
jPanel_Inventory_Actions.add(jSpinner_item_quantity, java.awt.BorderLayout.CENTER);
jButton_item_add.setText("Add");
jButton_item_add.setFocusable(false);
@ -187,7 +199,7 @@ public class OnTransact extends javax.swing.JFrame {
jButton_item_addActionPerformed(evt);
}
});
jPanel_Inventory_Actions.add(jButton_item_add);
jPanel_Inventory_Actions.add(jButton_item_add, java.awt.BorderLayout.LINE_END);
jPanel2.add(jPanel_Inventory_Actions, java.awt.BorderLayout.SOUTH);
@ -220,7 +232,7 @@ public class OnTransact extends javax.swing.JFrame {
private void transaction_check(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_transaction_check
boolean CLOSING_STATE = false;
if (transaction.items_count <= 0) {
if (transaction.items_count.size() <= 0) {
CLOSING_STATE = true;
} else {
CLOSING_STATE = confirm_discard();
@ -293,12 +305,12 @@ public class OnTransact extends javax.swing.JFrame {
private javax.swing.JLabel jLabel_price_tip;
private javax.swing.JLabel jLabel_price_total;
private javax.swing.JList<String> jList1_Inventory;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel_Information;
private javax.swing.JPanel jPanel_Inventory_Actions;
private javax.swing.JPanel jPanel_Items;
private javax.swing.JPanel jPanel_Main;
private javax.swing.JPanel jPanel_statusinfo;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane_Inventory;
private javax.swing.JSpinner jSpinner_item_quantity;