imported files
This commit is contained in:
		
							parent
							
								
									5106689ae2
								
							
						
					
					
						commit
						8858119b26
					
				
					 3 changed files with 617 additions and 0 deletions
				
			
		
							
								
								
									
										136
									
								
								src/main/java/tech/iBeans/POSware/Lite/OnAlert.java
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										136
									
								
								src/main/java/tech/iBeans/POSware/Lite/OnAlert.java
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,136 @@ | ||||||
|  | /* | ||||||
|  |   Hansly Saw | ||||||
|  |   CSCI | ||||||
|  |   Final Project | ||||||
|  |   February 12, 2024 | ||||||
|  | 
 | ||||||
|  |   OnAlert: Alert GUI | ||||||
|  | */ | ||||||
|  | 
 | ||||||
|  | package tech.iBeans.POSware.Lite; | ||||||
|  | 
 | ||||||
|  | import java.util.*; | ||||||
|  | 
 | ||||||
|  | import java.awt.*; | ||||||
|  | import java.awt.event.*; | ||||||
|  | 
 | ||||||
|  | import javax.swing.*; | ||||||
|  | import javax.swing.border.EmptyBorder; | ||||||
|  | import javax.swing.event.*; | ||||||
|  | 
 | ||||||
|  | public class OnAlert extends JDialog { | ||||||
|  | 	public static Dictionary<String, String> USER_INTERACTION = new Hashtable<>(); | ||||||
|  | 
 | ||||||
|  | 	private static final long serialVersionUID = 1L; | ||||||
|  | 	private final JPanel contentPanel = new JPanel(); | ||||||
|  | 	private JTextField textField_alert_input; | ||||||
|  | 
 | ||||||
|  | 	/** | ||||||
|  | 	 * Launch the application. | ||||||
|  | 	 */ | ||||||
|  | 	 | ||||||
|  | 	/** | ||||||
|  | 	 * Create the dialog. | ||||||
|  | 	 */ | ||||||
|  | 	public OnAlert(String MESSAGE_TITLE, String MESSAGE_BODY, int INPUT_OK_STATE, int INPUT_CANCEL_STATE, Boolean INPUT_TEXT) { | ||||||
|  |         setModal(true); | ||||||
|  |              | ||||||
|  | 		// Set window size | ||||||
|  | 		setSize(new Dimension(450, 200)); | ||||||
|  | 		setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); | ||||||
|  |                 contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); | ||||||
|  | 
 | ||||||
|  | 		// apply window properties | ||||||
|  | 		getContentPane().setLayout(new BorderLayout()); | ||||||
|  | 		getContentPane().add(contentPanel, BorderLayout.CENTER); | ||||||
|  | 		 | ||||||
|  | 		// Set layout | ||||||
|  | 		contentPanel.setLayout(new BorderLayout(0, 0)); | ||||||
|  | 		 | ||||||
|  | 		// Add items | ||||||
|  | 		JLabel lblNewLabel_alert_text = new JLabel(); // change the content | ||||||
|  | 		textField_alert_input = new JTextField(); | ||||||
|  | 		JPanel panel_actions = new JPanel(); | ||||||
|  | 		JButton button_confirm = new JButton(); // translate | ||||||
|  | 		JButton button_cancel = new JButton(); // translate | ||||||
|  | 
 | ||||||
|  | 		// Set layout | ||||||
|  | 		contentPanel.add(lblNewLabel_alert_text, BorderLayout.NORTH); | ||||||
|  | 		panel_actions.setLayout(new FlowLayout(FlowLayout.RIGHT)); | ||||||
|  | 		getContentPane().add(panel_actions, BorderLayout.SOUTH); | ||||||
|  | 
 | ||||||
|  | 		// Display buttons when necessary | ||||||
|  | 		switch(INPUT_OK_STATE) { | ||||||
|  | 			case 2:  | ||||||
|  | 				getRootPane().setDefaultButton(button_confirm); | ||||||
|  | 			case 1:  | ||||||
|  | 				button_confirm.setActionCommand("OK"); | ||||||
|  | 				panel_actions.add(button_confirm); | ||||||
|  | 		}; | ||||||
|  | 		switch(INPUT_CANCEL_STATE) { | ||||||
|  | 			case 2:  | ||||||
|  | 				getRootPane().setDefaultButton(button_cancel); | ||||||
|  | 			case 1:  | ||||||
|  | 				button_cancel.setActionCommand("Cancel"); | ||||||
|  | 				panel_actions.add(button_cancel); | ||||||
|  | 		}; | ||||||
|  | 		if (INPUT_TEXT) { | ||||||
|  | 			contentPanel.add(textField_alert_input, BorderLayout.SOUTH); | ||||||
|  | 			// textField_alert_input.setColumns(10); | ||||||
|  | 		}; | ||||||
|  | 
 | ||||||
|  | 		// Set dynamic text | ||||||
|  | 		setTitle(MESSAGE_TITLE); | ||||||
|  | 		lblNewLabel_alert_text.setText(MESSAGE_BODY); | ||||||
|  | 		button_confirm.setText("OK"); | ||||||
|  | 		button_cancel.setText("Cancel"); | ||||||
|  | 		 | ||||||
|  | 		// For the user response | ||||||
|  | 		if (INPUT_TEXT) { | ||||||
|  | 			USER_INTERACTION.put("Text Entered", ""); | ||||||
|  | 			 | ||||||
|  | 			DocumentListener user_interaction_text_record = new DocumentListener() { | ||||||
|  | 				public void insertUpdate(DocumentEvent e) { | ||||||
|  | 					user_interaction_text_record_edit(); | ||||||
|  | 				} | ||||||
|  | 				public void removeUpdate(DocumentEvent e) { | ||||||
|  | 					user_interaction_text_record_edit(); | ||||||
|  | 				} | ||||||
|  | 				public void changedUpdate(DocumentEvent e) { | ||||||
|  | 					user_interaction_text_record_edit(); | ||||||
|  | 				} | ||||||
|  | 				public void user_interaction_text_record_edit() { | ||||||
|  | 					USER_INTERACTION.put("Text Entered", textField_alert_input.getText()); | ||||||
|  | 				} | ||||||
|  | 			}; | ||||||
|  | 			 | ||||||
|  | 			textField_alert_input.getDocument().addDocumentListener(user_interaction_text_record); | ||||||
|  | 		}; | ||||||
|  | 
 | ||||||
|  | 		ActionListener user_interaction_click_primary = new ActionListener() { | ||||||
|  | 			public void actionPerformed(ActionEvent e) { | ||||||
|  | 				USER_INTERACTION.put("Button Returned", "1"); | ||||||
|  | 				dispose(); | ||||||
|  | 			}; | ||||||
|  | 		};  | ||||||
|  | 		ActionListener user_interaction_click_cancel = new ActionListener() { | ||||||
|  | 			public void actionPerformed(ActionEvent e) { | ||||||
|  | 				USER_INTERACTION.put("Button Returned", "0"); | ||||||
|  | 				dispose(); | ||||||
|  | 			}; | ||||||
|  | 		};  | ||||||
|  | 		 | ||||||
|  | 		addWindowListener(new WindowAdapter() | ||||||
|  | 			{ | ||||||
|  | 				@Override | ||||||
|  | 				public void windowClosing(WindowEvent e) | ||||||
|  | 				{ | ||||||
|  | 					USER_INTERACTION.put("Button Returned", (INPUT_CANCEL_STATE >= 2) ? "0" : "1"); e.getWindow().dispose();	 | ||||||
|  | 				} | ||||||
|  | 			}); | ||||||
|  | 
 | ||||||
|  | 		button_confirm.addActionListener(user_interaction_click_primary); | ||||||
|  | 		button_cancel.addActionListener(user_interaction_click_cancel); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | } | ||||||
							
								
								
									
										337
									
								
								src/main/java/tech/iBeans/POSware/Lite/OnTransact.form
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										337
									
								
								src/main/java/tech/iBeans/POSware/Lite/OnTransact.form
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,337 @@ | ||||||
|  | <?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="0"/> | ||||||
|  |     <Property name="title" type="java.lang.String" value="POSware Lite: Transaction"/> | ||||||
|  |     <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor"> | ||||||
|  |       <Dimension value="[1000, 800]"/> | ||||||
|  |     </Property> | ||||||
|  |   </Properties> | ||||||
|  |   <SyntheticProperties> | ||||||
|  |     <SyntheticProperty name="formSizePolicy" type="int" value="1"/> | ||||||
|  |     <SyntheticProperty name="generateCenter" type="boolean" value="false"/> | ||||||
|  |   </SyntheticProperties> | ||||||
|  |   <Events> | ||||||
|  |     <EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="transaction_check"/> | ||||||
|  |   </Events> | ||||||
|  |   <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,44,0,0,1,-112"/> | ||||||
|  |   </AuxValues> | ||||||
|  | 
 | ||||||
|  |   <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | ||||||
|  |   <SubComponents> | ||||||
|  |     <Container class="javax.swing.JPanel" name="jPanel1"> | ||||||
|  |       <Constraints> | ||||||
|  |         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | ||||||
|  |           <BorderConstraints direction="Last"/> | ||||||
|  |         </Constraint> | ||||||
|  |       </Constraints> | ||||||
|  | 
 | ||||||
|  |       <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | ||||||
|  |       <SubComponents> | ||||||
|  |         <Component class="javax.swing.JComboBox" name="jComboBox1"> | ||||||
|  |           <Properties> | ||||||
|  |             <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> | ||||||
|  |               <StringArray count="4"> | ||||||
|  |                 <StringItem index="0" value="Item 1"/> | ||||||
|  |                 <StringItem index="1" value="Item 2"/> | ||||||
|  |                 <StringItem index="2" value="Item 3"/> | ||||||
|  |                 <StringItem index="3" value="Item 4"/> | ||||||
|  |               </StringArray> | ||||||
|  |             </Property> | ||||||
|  |           </Properties> | ||||||
|  |           <AuxValues> | ||||||
|  |             <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> | ||||||
|  |           </AuxValues> | ||||||
|  |           <Constraints> | ||||||
|  |             <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | ||||||
|  |               <BorderConstraints direction="East"/> | ||||||
|  |             </Constraint> | ||||||
|  |           </Constraints> | ||||||
|  |         </Component> | ||||||
|  |         <Component class="javax.swing.JLabel" name="jLabel1"> | ||||||
|  |           <Properties> | ||||||
|  |             <Property name="text" type="java.lang.String" value="jLabel1"/> | ||||||
|  |           </Properties> | ||||||
|  |           <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> | ||||||
|  |       </SubComponents> | ||||||
|  |     </Container> | ||||||
|  |     <Container class="javax.swing.JPanel" name="jPanel_Main"> | ||||||
|  |       <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 class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | ||||||
|  |       <SubComponents> | ||||||
|  |         <Container class="javax.swing.JPanel" name="jPanel_Items"> | ||||||
|  |           <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 class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | ||||||
|  |           <SubComponents> | ||||||
|  |             <Container class="javax.swing.JScrollPane" name="jScrollPane1"> | ||||||
|  |               <AuxValues> | ||||||
|  |                 <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | ||||||
|  |               </AuxValues> | ||||||
|  |               <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 class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | ||||||
|  |               <SubComponents> | ||||||
|  |                 <Component class="javax.swing.JTextArea" name="jTextArea1"> | ||||||
|  |                   <Properties> | ||||||
|  |                     <Property name="columns" type="int" value="20"/> | ||||||
|  |                     <Property name="lineWrap" type="boolean" value="true"/> | ||||||
|  |                     <Property name="rows" type="int" value="5"/> | ||||||
|  |                     <Property name="enabled" type="boolean" value="false"/> | ||||||
|  |                   </Properties> | ||||||
|  |                 </Component> | ||||||
|  |               </SubComponents> | ||||||
|  |             </Container> | ||||||
|  |             <Container class="javax.swing.JToolBar" name="jToolBar_Information"> | ||||||
|  |               <Properties> | ||||||
|  |                 <Property name="rollover" type="boolean" value="true"/> | ||||||
|  |               </Properties> | ||||||
|  |               <Constraints> | ||||||
|  |                 <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | ||||||
|  |                   <BorderConstraints direction="South"/> | ||||||
|  |                 </Constraint> | ||||||
|  |               </Constraints> | ||||||
|  | 
 | ||||||
|  |               <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/> | ||||||
|  |               <SubComponents> | ||||||
|  |                 <Container class="javax.swing.JPanel" name="jPanel_Information"> | ||||||
|  | 
 | ||||||
|  |                   <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/> | ||||||
|  |                   <SubComponents> | ||||||
|  |                     <Component class="javax.swing.JLabel" name="jLabel_price_VAT"> | ||||||
|  |                       <Properties> | ||||||
|  |                         <Property name="text" type="java.lang.String" value="VAT"/> | ||||||
|  |                       </Properties> | ||||||
|  |                       <Constraints> | ||||||
|  |                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||||
|  |                           <GridBagConstraints gridX="0" 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"/> | ||||||
|  |                         </Constraint> | ||||||
|  |                       </Constraints> | ||||||
|  |                     </Component> | ||||||
|  |                     <Component class="javax.swing.JLabel" name="jLabel_price_tip"> | ||||||
|  |                       <Properties> | ||||||
|  |                         <Property name="text" type="java.lang.String" value="Tip"/> | ||||||
|  |                       </Properties> | ||||||
|  |                       <Constraints> | ||||||
|  |                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||||
|  |                           <GridBagConstraints gridX="0" 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"/> | ||||||
|  |                         </Constraint> | ||||||
|  |                       </Constraints> | ||||||
|  |                     </Component> | ||||||
|  |                     <Component class="javax.swing.JLabel" name="jLabel_price_subtotal"> | ||||||
|  |                       <Properties> | ||||||
|  |                         <Property name="text" type="java.lang.String" value="Subtotal"/> | ||||||
|  |                       </Properties> | ||||||
|  |                       <Constraints> | ||||||
|  |                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||||
|  |                           <GridBagConstraints gridX="2" 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"/> | ||||||
|  |                         </Constraint> | ||||||
|  |                       </Constraints> | ||||||
|  |                     </Component> | ||||||
|  |                     <Component class="javax.swing.JLabel" name="jLabel_price_total"> | ||||||
|  |                       <Properties> | ||||||
|  |                         <Property name="text" type="java.lang.String" value="Grand Total"/> | ||||||
|  |                       </Properties> | ||||||
|  |                       <Constraints> | ||||||
|  |                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||||
|  |                           <GridBagConstraints gridX="2" 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"/> | ||||||
|  |                         </Constraint> | ||||||
|  |                       </Constraints> | ||||||
|  |                     </Component> | ||||||
|  |                     <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"/> | ||||||
|  |                         </Constraint> | ||||||
|  |                       </Constraints> | ||||||
|  |                     </Component> | ||||||
|  |                     <Component class="javax.swing.JTextField" name="jTextField_price_VAT_value"> | ||||||
|  |                       <Properties> | ||||||
|  |                         <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"/> | ||||||
|  |                         </Constraint> | ||||||
|  |                       </Constraints> | ||||||
|  |                     </Component> | ||||||
|  |                     <Component class="javax.swing.JTextField" name="jTextField_price_subtotal_value"> | ||||||
|  |                       <Properties> | ||||||
|  |                         <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"/> | ||||||
|  |                         </Constraint> | ||||||
|  |                       </Constraints> | ||||||
|  |                     </Component> | ||||||
|  |                     <Component class="javax.swing.JTextField" name="jTextField_price_total_value"> | ||||||
|  |                       <Properties> | ||||||
|  |                         <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor"> | ||||||
|  |                           <Font name="Dialog" size="14" style="1"/> | ||||||
|  |                         </Property> | ||||||
|  |                         <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="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"/> | ||||||
|  |                         </Constraint> | ||||||
|  |                       </Constraints> | ||||||
|  |                     </Component> | ||||||
|  |                     <Component class="javax.swing.JComboBox" name="jComboBox_information_discount_selections"> | ||||||
|  |                       <Properties> | ||||||
|  |                         <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> | ||||||
|  |                           <StringArray count="4"> | ||||||
|  |                             <StringItem index="0" value="Item 1"/> | ||||||
|  |                             <StringItem index="1" value="Item 2"/> | ||||||
|  |                             <StringItem index="2" value="Item 3"/> | ||||||
|  |                             <StringItem index="3" value="Item 4"/> | ||||||
|  |                           </StringArray> | ||||||
|  |                         </Property> | ||||||
|  |                       </Properties> | ||||||
|  |                       <AuxValues> | ||||||
|  |                         <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> | ||||||
|  |                       </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"/> | ||||||
|  |                         </Constraint> | ||||||
|  |                       </Constraints> | ||||||
|  |                     </Component> | ||||||
|  |                     <Component class="javax.swing.JLabel" name="jLabel2_information_discount"> | ||||||
|  |                       <Properties> | ||||||
|  |                         <Property name="text" type="java.lang.String" value="Discount"/> | ||||||
|  |                       </Properties> | ||||||
|  |                       <Constraints> | ||||||
|  |                         <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription"> | ||||||
|  |                           <GridBagConstraints gridX="0" 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"/> | ||||||
|  |                         </Constraint> | ||||||
|  |                       </Constraints> | ||||||
|  |                     </Component> | ||||||
|  |                   </SubComponents> | ||||||
|  |                 </Container> | ||||||
|  |               </SubComponents> | ||||||
|  |             </Container> | ||||||
|  |           </SubComponents> | ||||||
|  |         </Container> | ||||||
|  |         <Container class="javax.swing.JToolBar" name="jToolBar_Inventory"> | ||||||
|  |           <Properties> | ||||||
|  |             <Property name="rollover" type="boolean" value="true"/> | ||||||
|  |           </Properties> | ||||||
|  |           <Constraints> | ||||||
|  |             <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | ||||||
|  |               <BorderConstraints direction="East"/> | ||||||
|  |             </Constraint> | ||||||
|  |           </Constraints> | ||||||
|  | 
 | ||||||
|  |           <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/> | ||||||
|  |           <SubComponents> | ||||||
|  |             <Container class="javax.swing.JPanel" name="jPanel2"> | ||||||
|  | 
 | ||||||
|  |               <Layout class="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout"/> | ||||||
|  |               <SubComponents> | ||||||
|  |                 <Container class="javax.swing.JPanel" name="jPanel_Inventory_Actions"> | ||||||
|  |                   <Constraints> | ||||||
|  |                     <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription"> | ||||||
|  |                       <BorderConstraints direction="South"/> | ||||||
|  |                     </Constraint> | ||||||
|  |                   </Constraints> | ||||||
|  | 
 | ||||||
|  |                   <Layout class="org.netbeans.modules.form.compat2.layouts.DesignFlowLayout"/> | ||||||
|  |                   <SubComponents> | ||||||
|  |                     <Component class="javax.swing.JButton" name="jButton_item_void"> | ||||||
|  |                       <Properties> | ||||||
|  |                         <Property name="text" type="java.lang.String" value="Void"/> | ||||||
|  |                         <Property name="focusable" type="boolean" value="false"/> | ||||||
|  |                         <Property name="horizontalTextPosition" type="int" value="0"/> | ||||||
|  |                         <Property name="verticalTextPosition" type="int" value="3"/> | ||||||
|  |                       </Properties> | ||||||
|  |                       <Events> | ||||||
|  |                         <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_item_voidActionPerformed"/> | ||||||
|  |                       </Events> | ||||||
|  |                     </Component> | ||||||
|  |                     <Component class="javax.swing.JSpinner" name="jSpinner_item_quantity"> | ||||||
|  |                     </Component> | ||||||
|  |                     <Component class="javax.swing.JButton" name="jButton_item_add"> | ||||||
|  |                       <Properties> | ||||||
|  |                         <Property name="text" type="java.lang.String" value="Add"/> | ||||||
|  |                         <Property name="focusable" type="boolean" value="false"/> | ||||||
|  |                         <Property name="horizontalTextPosition" type="int" value="0"/> | ||||||
|  |                         <Property name="verticalTextPosition" type="int" value="3"/> | ||||||
|  |                       </Properties> | ||||||
|  |                       <Events> | ||||||
|  |                         <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton_item_addActionPerformed"/> | ||||||
|  |                       </Events> | ||||||
|  |                     </Component> | ||||||
|  |                   </SubComponents> | ||||||
|  |                 </Container> | ||||||
|  |                 <Container class="javax.swing.JScrollPane" name="jScrollPane_Inventory"> | ||||||
|  |                   <AuxValues> | ||||||
|  |                     <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/> | ||||||
|  |                   </AuxValues> | ||||||
|  |                   <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 class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> | ||||||
|  |                   <SubComponents> | ||||||
|  |                     <Component class="javax.swing.JList" name="jList1_Inventory"> | ||||||
|  |                       <Properties> | ||||||
|  |                         <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor"> | ||||||
|  |                           <StringArray count="5"> | ||||||
|  |                             <StringItem index="0" value="Item 1"/> | ||||||
|  |                             <StringItem index="1" value="Item 2"/> | ||||||
|  |                             <StringItem index="2" value="Item 3"/> | ||||||
|  |                             <StringItem index="3" value="Item 4"/> | ||||||
|  |                             <StringItem index="4" value="Item 5"/> | ||||||
|  |                           </StringArray> | ||||||
|  |                         </Property> | ||||||
|  |                       </Properties> | ||||||
|  |                       <AuxValues> | ||||||
|  |                         <AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/> | ||||||
|  |                       </AuxValues> | ||||||
|  |                     </Component> | ||||||
|  |                   </SubComponents> | ||||||
|  |                 </Container> | ||||||
|  |               </SubComponents> | ||||||
|  |             </Container> | ||||||
|  |           </SubComponents> | ||||||
|  |         </Container> | ||||||
|  |       </SubComponents> | ||||||
|  |     </Container> | ||||||
|  |   </SubComponents> | ||||||
|  | </Form> | ||||||
							
								
								
									
										144
									
								
								src/main/java/tech/iBeans/POSware/Lite/WindowManagement.java
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										144
									
								
								src/main/java/tech/iBeans/POSware/Lite/WindowManagement.java
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,144 @@ | ||||||
|  | /* | ||||||
|  |   Hansly Saw | ||||||
|  |   CSCI | ||||||
|  |   Final Project | ||||||
|  |   February 12, 2024 | ||||||
|  | 
 | ||||||
|  |   Window Management | ||||||
|  | */ | ||||||
|  | 
 | ||||||
|  | package tech.iBeans.POSware.Lite; | ||||||
|  | 
 | ||||||
|  | import java.util.function.Function; | ||||||
|  | 
 | ||||||
|  | import javax.swing.JDialog; | ||||||
|  | import tech.iBeans.POSware.Lite.OnAlert.*; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * | ||||||
|  |  * @author tenth | ||||||
|  |  */ | ||||||
|  | public class WindowManagement { | ||||||
|  |     public static void alert(String MESSAGE_TITLE, String MESSAGE_BODY, Boolean INVERT) { | ||||||
|  |         /*  | ||||||
|  |          * This displays an onscreen message, where the user interacts through one button. | ||||||
|  |          *  | ||||||
|  |          * Parameter:  | ||||||
|  |          * 	MESSAGE_TITLE (String): The message title | ||||||
|  |          *  MESSAGE_BODY (String): The message body | ||||||
|  |          * 	INVERT (Boolean): determines wheter show or cancel is default | ||||||
|  |          */ | ||||||
|  | 
 | ||||||
|  |         try { | ||||||
|  |             OnAlert dialog = new OnAlert(MESSAGE_TITLE, MESSAGE_BODY, (!INVERT) ? 2 : 0, (INVERT) ? 2 : 0, false); | ||||||
|  |             dialog.setVisible(true); | ||||||
|  |         } catch (Exception e) { | ||||||
|  |             e.printStackTrace(); | ||||||
|  |         }; | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     public static void alert(String MESSAGE_TITLE, String MESSAGE_BODY) { | ||||||
|  |         /*  | ||||||
|  |          * This displays an onscreen message, where the user interacts through one button. | ||||||
|  |          *  | ||||||
|  |          * Parameter:  | ||||||
|  |          * 	MESSAGE_TITLE (String): The message title | ||||||
|  |          *  MESSAGE_BODY (String): The message body | ||||||
|  |          */ | ||||||
|  | 
 | ||||||
|  |         alert(MESSAGE_TITLE, MESSAGE_BODY, false); | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     public static void alert(String MESSAGE_BODY) { | ||||||
|  |             /*  | ||||||
|  |              * This displays an onscreen message, where the user interacts through one button. | ||||||
|  |              *  | ||||||
|  |              * Parameter:  | ||||||
|  |              * 	MESSAGE_BODY (String): The message body | ||||||
|  |              */ | ||||||
|  | 
 | ||||||
|  |             alert("", MESSAGE_BODY, false); | ||||||
|  |     }; | ||||||
|  | 
 | ||||||
|  |     public static Boolean confirm(String MESSAGE_TITLE, String MESSAGE_BODY, Boolean INVERT) { | ||||||
|  |         /*  | ||||||
|  |          * This displays an onscreen message, where the user interacts through two buttons. | ||||||
|  |          *  | ||||||
|  |          * Parameter:  | ||||||
|  |          * 	MESSAGE_TITLE (String): The message title | ||||||
|  |          *  MESSAGE_BODY (String): The message body | ||||||
|  |          *  INVERT (Boolean): to set cancel as default | ||||||
|  |          */ | ||||||
|  | 
 | ||||||
|  |         try { | ||||||
|  |                OnAlert dialog = new OnAlert(MESSAGE_TITLE, MESSAGE_BODY, 1+((!INVERT)? 1 : 0), 1+((INVERT)? 1 : 0), false); | ||||||
|  |                dialog.setVisible(true); | ||||||
|  |        } catch (Exception e) { | ||||||
|  |                e.printStackTrace(); | ||||||
|  |        }; | ||||||
|  | 
 | ||||||
|  |         return ((OnAlert.USER_INTERACTION.get("Button Returned").contains("1")));  | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public static Boolean confirm(String MESSAGE_TITLE, String MESSAGE_BODY) { | ||||||
|  |         /*  | ||||||
|  |          * This displays an onscreen message, where the user interacts through two buttons. | ||||||
|  |          *  | ||||||
|  |          * Parameter:  | ||||||
|  |          * 	MESSAGE_TITLE (String): The message title | ||||||
|  |          *  MESSAGE_BODY (String): The message body | ||||||
|  |          */ | ||||||
|  | 
 | ||||||
|  |          | ||||||
|  |         return (confirm(MESSAGE_TITLE, MESSAGE_BODY, false));  | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public static Boolean confirm(String MESSAGE_BODY) { | ||||||
|  |             /*  | ||||||
|  |              * This displays an onscreen message, where the user interacts through two buttons. | ||||||
|  |              *  | ||||||
|  |              * Parameter:  | ||||||
|  |              * 	MESSAGE_BODY (String): The message body | ||||||
|  |              */ | ||||||
|  | 
 | ||||||
|  |         return(confirm("", MESSAGE_BODY, false)); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public static String input(String MESSAGE_TITLE, String MESSAGE_BODY) { | ||||||
|  |         /*  | ||||||
|  |          * This displays an onscreen message, where the user interacts through text. | ||||||
|  |          *  | ||||||
|  |          * Parameter:  | ||||||
|  |          * 	MESSAGE_TITLE (String): The message title | ||||||
|  |          *  MESSAGE_BODY (String): The message body | ||||||
|  |          */ | ||||||
|  | 
 | ||||||
|  |          try { | ||||||
|  |             OnAlert dialog = new OnAlert(MESSAGE_TITLE, MESSAGE_BODY, 2, 0, true); | ||||||
|  |             dialog.setVisible(true); | ||||||
|  |         } catch (Exception e) { | ||||||
|  |                 e.printStackTrace(); | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         return (OnAlert.USER_INTERACTION.get("Text Entered")); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public static String input(String MESSAGE_BODY) { | ||||||
|  |         /*  | ||||||
|  |          * This displays an onscreen message, where the user interacts through text. | ||||||
|  |          *  | ||||||
|  |          * Parameter:  | ||||||
|  |          * 	MESSAGE_BODY (String): The message body | ||||||
|  |          */ | ||||||
|  | 
 | ||||||
|  |          try { | ||||||
|  |             OnAlert dialog = new OnAlert("", MESSAGE_BODY, 2, 0, true); | ||||||
|  |             dialog.setVisible(true); | ||||||
|  |         } catch (Exception e) { | ||||||
|  |             e.printStackTrace(); | ||||||
|  |         }; | ||||||
|  | 
 | ||||||
|  |         return (OnAlert.USER_INTERACTION.get("Text Entered")); | ||||||
|  |     } | ||||||
|  |      | ||||||
|  | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue