diff --git a/CALCULATOR.jar b/CALCULATOR.jar new file mode 100644 index 0000000..e5f90d6 Binary files /dev/null and b/CALCULATOR.jar differ diff --git a/Calculator.java b/Calculator.java new file mode 100644 index 0000000..ce9947f --- /dev/null +++ b/Calculator.java @@ -0,0 +1,374 @@ +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JTextField; +import javax.swing.JButton; +import java.awt.Font; +import java.awt.TextField; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.SwingConstants; +import javax.swing.JOptionPane; + + +public class Calculator { + + private JFrame frame; + private JTextField textField; + + double first; + double second; + double result; + String operation; + String answer; + + + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + Calculator window = new Calculator(); + window.frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the application. + */ + public Calculator() { + initialize(); + } + + /** + * Initialize the contents of the frame. + */ + private void initialize() { + frame = new JFrame(); + frame.getContentPane().setFont(new Font("Tahoma", Font.BOLD, 18)); + frame.setBounds(100, 100, 306, 459); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.getContentPane().setLayout(null); + + textField = new JTextField(); + textField.setFont(new Font("Tahoma", Font.BOLD, 17)); + textField.setHorizontalAlignment(SwingConstants.RIGHT); + textField.setBounds(10, 11, 269, 67); + frame.getContentPane().add(textField); + textField.setColumns(10); + + + //........................Row 1.................... + + + JButton btnBackspace = new JButton("\uF0E7"); + btnBackspace.setBounds(10, 89, 71, 55); + btnBackspace.setFont(new Font("Windings", Font.BOLD, 19)); + btnBackspace.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String backspace=null; + if (textField.getText().length() > 0) { + StringBuilder strB=new StringBuilder(textField.getText()); + strB.deleteCharAt(textField.getText().length() - 1); + backspace=strB.toString(); + textField.setText(backspace); + } + + } + }); + frame.getContentPane().add(btnBackspace); + + JButton btnClear = new JButton("C"); + btnClear.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + textField.setText(null); + } + }); + btnClear.setBounds(76, 89, 71, 55); + btnClear.setFont(new Font("Tahoma", Font.BOLD, 18)); + frame.getContentPane().add(btnClear); + + + JButton btnPercent = new JButton("%"); + btnPercent.setBounds(142, 89, 71, 55); + btnPercent.setFont(new Font("Tahoma", Font.BOLD, 23)); + btnPercent.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + first=Double.parseDouble(textField.getText()); + textField.setText(""); + operation="%"; + + } + }); + frame.getContentPane().add(btnPercent); + + + + JButton btnPlus = new JButton("+"); + btnPlus.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + first=Double.parseDouble(textField.getText()); + textField.setText(""); + operation="+"; + + + + } + }); + btnPlus.setBounds(208,89, 71, 55); + btnPlus.setFont(new Font("Tahoma", Font.BOLD, 20)); + frame.getContentPane().add(btnPlus); + + + + + + //........................Row 2.................... + + + JButton btn7 = new JButton("7"); + btn7.setBounds(10, 155, 71, 55); + btn7.setFont(new Font("Tahoma", Font.BOLD, 23)); + btn7.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String number=textField.getText()+btn7.getText(); + textField.setText(number); + + } + }); + frame.getContentPane().add(btn7); + + JButton btn8 = new JButton("8"); + btn8.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String number=textField.getText()+btn8.getText(); + textField.setText(number); + } + }); + btn8.setBounds(76, 155, 71, 55); + btn8.setFont(new Font("Tahoma", Font.BOLD, 20)); + frame.getContentPane().add(btn8); + + + JButton btn9 = new JButton("9"); + btn9.setBounds(142, 155, 71, 55); + btn9.setFont(new Font("Tahoma", Font.BOLD, 23)); + btn9.addActionListener(new ActionListener() { + public void actionPerformed( ActionEvent arg0) { + String number=textField.getText()+btn9.getText(); + textField.setText(number); + } + }); + frame.getContentPane().add(btn9); + + + + JButton btnSub = new JButton("-"); + btnSub.addActionListener(new ActionListener() { + public void actionPerformed( ActionEvent arg0) { + first=Double.parseDouble(textField.getText()); + textField.setText(""); + operation="-"; + } + }); + btnSub.setBounds(208, 155, 71, 55); + btnSub.setFont(new Font("Tahoma", Font.BOLD, 20)); + frame.getContentPane().add(btnSub); + + + //........................Row 3.................... + + + JButton btn4 = new JButton("4"); + btn4.setBounds(10, 221, 71, 55); + btn4.setFont(new Font("Tahoma", Font.BOLD, 23)); + btn4.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + String number=textField.getText()+btn4.getText(); + textField.setText(number); + + } + }); + frame.getContentPane().add(btn4); + + JButton btn5 = new JButton("5"); + btn5.setBounds(76, 221, 71, 55); + btn5.addActionListener(new ActionListener() { + public void actionPerformed( ActionEvent arg0) { + String number=textField.getText()+btn5.getText(); + textField.setText(number); + + } + }); + btn5.setFont(new Font("Tahoma", Font.BOLD, 21)); + frame.getContentPane().add(btn5); + + + JButton btn6 = new JButton("6"); + btn6.setBounds(142, 221, 71, 55); + btn6.setFont(new Font("Tahoma", Font.BOLD, 23)); + btn6.addActionListener(new ActionListener() { + public void actionPerformed( ActionEvent arg0) { + ;String number=textField.getText()+btn6.getText(); + textField.setText(number); + + + } + }); + frame.getContentPane().add(btn6); + + + + JButton btnMult = new JButton("*"); + btnMult.addActionListener(new ActionListener() { + public void actionPerformed( ActionEvent arg0) { + first=Double.parseDouble(textField.getText()); + textField.setText(""); + operation="*"; + + } + }); + btnMult.setBounds(208, 221, 71, 55); + btnMult.setFont(new Font("Tahoma", Font.BOLD, 20)); + frame.getContentPane().add(btnMult); + + + + //........................Row 4.................... + + + JButton btn1 = new JButton("1"); + btn1.setBounds(10, 287, 71, 55); + btn1.setFont(new Font("Tahoma", Font.BOLD, 23)); + btn1.addActionListener(new ActionListener() { + public void actionPerformed( ActionEvent arg0) { + String number=textField.getText()+btn1.getText(); + textField.setText(number); + } + }); + frame.getContentPane().add(btn1); + + JButton btn2 = new JButton("2"); + btn2.addActionListener(new ActionListener() { + public void actionPerformed( ActionEvent arg0) { + String number=textField.getText()+btn2.getText(); + textField.setText(number); + } + }); + btn2.setBounds(76, 287, 71, 55); + btn2.setFont(new Font("Tahoma", Font.BOLD, 21)); + frame.getContentPane().add(btn2); + + + JButton btn3 = new JButton("3"); + btn3.setBounds(142, 287, 71, 55); + btn3.setFont(new Font("Tahoma", Font.BOLD, 23)); + btn3.addActionListener(new ActionListener() { + public void actionPerformed( ActionEvent arg0) { + String number=textField.getText()+btn3.getText(); + textField.setText(number); + } + }); + frame.getContentPane().add(btn3); + + + + JButton btnDivide = new JButton("/"); + btnDivide.addActionListener(new ActionListener() { + public void actionPerformed( ActionEvent arg0 ) { + first=Double.parseDouble(textField.getText()); + textField.setText(""); + operation="/"; + + } + }); + btnDivide.setBounds(208, 287, 71, 55); + btnDivide.setFont(new Font("Tahoma", Font.BOLD, 20)); + frame.getContentPane().add(btnDivide); + + + + //........................Row 5.................... + + + JButton btn0 = new JButton("0"); + btn0.setBounds(10, 353, 71, 55); + btn0.setFont(new Font("Tahoma", Font.BOLD, 23)); + btn0.addActionListener(new ActionListener() { + public void actionPerformed( ActionEvent arg0 ) { + String number=textField.getText()+btn0.getText(); + textField.setText(number); + } + }); + frame.getContentPane().add(btn0); + + JButton btnDot= new JButton("."); + btnDot.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0 ) { + String number=textField.getText()+btnDot.getText(); + textField.setText(number); + } + }); + btnDot.setBounds(76, 353, 71, 55); + btnDot.setFont(new Font("Tahoma", Font.BOLD, 20)); + frame.getContentPane().add(btnDot); + + + JButton btnPM = new JButton("+ -"); + btnPM.setBounds(142, 353, 71, 55); + btnPM.setFont(new Font("Tahoma", Font.BOLD, 20)); + btnPM.addActionListener(new ActionListener() { + public void actionPerformed( ActionEvent arg0) { + double ops = Double.parseDouble(String.valueOf(textField.getText())); + ops = ops * (-1); + textField.setText(String.valueOf(ops)); + } + }); + frame.getContentPane().add(btnPM); + + + JButton btnEquals = new JButton("="); + btnEquals.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + second = Double.parseDouble(textField.getText()); + if (operation.equals("+")) { + result = first + second; + } else if (operation.equals("-")) { + result = first - second; + } else if (operation.equals("*")) { + result = first * second; + } else if (operation.equals("/")) { + if (second != 0) { + result = first / second; + } else { + JOptionPane.showMessageDialog(frame, "Error: Division by zero"); + textField.setText(""); + return; + } + } else if (operation.equals("%")) { + result = first % second; + } + + answer = String.format("%.2f", result); + textField.setText(answer); + } + }); + btnEquals.setBounds(208, 353, 71, 55); + btnEquals.setFont(new Font("Tahoma", Font.BOLD, 20)); + frame.getContentPane().add(btnEquals); + + // ... + + } + + +} \ No newline at end of file diff --git a/miglayout-src.zip b/miglayout-src.zip new file mode 100644 index 0000000..9c51c32 Binary files /dev/null and b/miglayout-src.zip differ diff --git a/src/Travel.java b/src/Travel.java new file mode 100644 index 0000000..4505b30 --- /dev/null +++ b/src/Travel.java @@ -0,0 +1,470 @@ +import java.awt.EventQueue; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.border.LineBorder; +import javax.swing.text.JTextComponent; + +import java.awt.Color; +import javax.swing.JLabel; +import javax.swing.JOptionPane; + +import java.awt.Font; +import javax.swing.JTextField; +import javax.swing.SwingConstants; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeEvent; +import javax.swing.JRadioButton; +import javax.swing.JComboBox; +import javax.print.attribute.standard.Destination; +import javax.swing.AbstractButton; +import javax.swing.DefaultComboBoxModel; +import javax.swing.JButton; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public class Travel { + + private JFrame frame; + private JTextField txtFirstname; + private JTextField txtSurname; + private JTextField txtAddress; + private JTextField txtPhoneNumber; + private JTextField txtEmail; + private JTextField txtDate; + protected AbstractButton JAccomodation; + protected AbstractButton DeparturePoint; + protected JComboBox Accomadation; + private JComboBox cabAccomodation; + + /** + * Launch the application. + */ + public static void main(String[] args) { + EventQueue.invokeLater(new Runnable() { + public void run() { + try { + Travel window = new Travel(); + window.frame.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + } + + /** + * Create the application. + */ + public Travel() { + initialize(); + } + + /** + * Initialize the contents of the frame. + */ + @SuppressWarnings("unchecked") + private void initialize() { + frame = new JFrame(); + frame.setBounds(0, 0 , 1360, 689); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.getContentPane().setLayout(null); + + JPanel panel = new JPanel(); + panel.setBounds(10, 114, 513, 293); + panel.setBorder(new LineBorder(new Color(0, 0, 0), 8)); + frame.getContentPane().add(panel); + panel.setLayout(null); + + JLabel lblNewLabel_2 = new JLabel("Firstname"); + lblNewLabel_2.setBounds(10, 13, 106, 28); + lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 15)); + panel.add(lblNewLabel_2); + + JLabel lblNewLabel_1 = new JLabel("Surname"); + lblNewLabel_1.setFont(new Font("Tahoma", Font.BOLD, 15)); + lblNewLabel_1.setBounds(10, 65, 78, 21); + panel.add(lblNewLabel_1); + + JLabel lblNewLabel_3 = new JLabel("Address"); + lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 15)); + lblNewLabel_3.setBounds(10, 120, 78, 21); + panel.add(lblNewLabel_3); + + JLabel lblNewLabel_4 = new JLabel("Phone Number"); + lblNewLabel_4.setFont(new Font("Tahoma", Font.BOLD, 15)); + lblNewLabel_4.setBounds(10, 211, 123, 21); + panel.add(lblNewLabel_4); + + JLabel lblNewLabel_5 = new JLabel("Email"); + lblNewLabel_5.setFont(new Font("Tahoma", Font.BOLD, 15)); + lblNewLabel_5.setBounds(10, 250, 78, 21); + panel.add(lblNewLabel_5); + + txtFirstname = new JTextField(); + txtFirstname.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + } + }); + txtFirstname.setFont(new Font("Tahoma", Font.BOLD, 14)); + txtFirstname.setBounds(137, 21, 277, 28); + panel.add(txtFirstname); + txtFirstname.setColumns(10); + + txtSurname = new JTextField(); + txtSurname.setFont(new Font("Tahoma", Font.BOLD, 14)); + txtSurname.setBounds(137, 67, 277, 28); + panel.add(txtSurname); + txtSurname.setColumns(10); + + txtAddress = new JTextField(); + txtAddress.setFont(new Font("Tahoma", Font.BOLD, 14)); + txtAddress.setBounds(137, 118, 277, 28); + panel.add(txtAddress); + txtAddress.setColumns(10); + + txtPhoneNumber = new JTextField(); + txtPhoneNumber.setFont(new Font("Tahoma", Font.BOLD, 14)); + txtPhoneNumber.setBounds(137, 209, 277, 28); + panel.add(txtPhoneNumber); + txtPhoneNumber.setColumns(10); + + txtEmail = new JTextField(); + txtEmail.setFont(new Font("Tahoma", Font.BOLD, 14)); + txtEmail.setBounds(137, 247, 277, 30); + panel.add(txtEmail); + txtEmail.setColumns(10); + + JLabel lblNewLabel_9 = new JLabel(" Date"); + lblNewLabel_9.setFont(new Font("Tahoma", Font.BOLD, 15)); + lblNewLabel_9.setBounds(10, 171, 93, 21); + panel.add(lblNewLabel_9); + + txtDate = new JTextField(); + txtDate.setFont(new Font("Tahoma", Font.BOLD, 14)); + txtDate.setBounds(137, 164, 277, 30); + panel.add(txtDate); + txtDate.setColumns(10); + + JPanel panel_3 = new JPanel(); + panel_3.setBounds(10, 425, 513, 208); + panel_3.setBorder(new LineBorder(new Color(0, 0, 0), 8)); + frame.getContentPane().add(panel_3); + panel_3.setLayout(null); + + JLabel lblNewLabel_13 = new JLabel(" Transport Means"); + lblNewLabel_13.setBounds(10, 13, 151, 28); + lblNewLabel_13.setFont(new Font("Tahoma", Font.BOLD, 16)); + panel_3.add(lblNewLabel_13); + + JRadioButton rdbtnPlane = new JRadioButton("Plane"); + rdbtnPlane.setBounds(20, 48, 109, 23); + rdbtnPlane.setFont(new Font("Tahoma", Font.BOLD, 13)); + panel_3.add(rdbtnPlane); + + JRadioButton rdbtnTrain = new JRadioButton("Train"); + rdbtnTrain.setBounds(17, 84, 109, 23); + rdbtnTrain.setFont(new Font("Tahoma", Font.BOLD, 13)); + panel_3.add(rdbtnTrain); + + JRadioButton rdbtnBus = new JRadioButton("Bus"); + rdbtnBus.setBounds(17, 121, 109, 23); + rdbtnBus.setFont(new Font("Tahoma", Font.BOLD, 13)); + panel_3.add(rdbtnBus); + + JLabel lblNewLabel_14 = new JLabel(" Ticket Type"); + lblNewLabel_14.setBounds(231, 15, 131, 23); + lblNewLabel_14.setFont(new Font("Tahoma", Font.BOLD, 18)); + panel_3.add(lblNewLabel_14); + + JRadioButton rdbtnStandard = new JRadioButton(" Standard"); + rdbtnStandard.setBounds(162, 48, 109, 23); + rdbtnStandard.setFont(new Font("Tahoma", Font.BOLD, 13)); + panel_3.add(rdbtnStandard); + + JRadioButton rdbtnEconomy = new JRadioButton("Economy"); + rdbtnEconomy.setBounds(162, 84, 109, 23); + rdbtnEconomy.setFont(new Font("Tahoma", Font.BOLD, 13)); + panel_3.add(rdbtnEconomy); + + JRadioButton rdbtnVip = new JRadioButton("Vip"); + rdbtnVip.setBounds(162, 121, 109, 23); + rdbtnVip.setFont(new Font("Tahoma", Font.BOLD, 13)); + panel_3.add(rdbtnVip); + + JRadioButton rdbtnSingleTicket = new JRadioButton("Single Ticket"); + rdbtnSingleTicket.setBounds(273, 48, 109, 23); + rdbtnSingleTicket.setFont(new Font("Tahoma", Font.BOLD, 13)); + panel_3.add(rdbtnSingleTicket); + + JRadioButton rdbtnReturnTicket = new JRadioButton("Return Ticket"); + rdbtnReturnTicket.setBounds(273, 84, 120, 23); + rdbtnReturnTicket.setFont(new Font("Tahoma", Font.BOLD, 13)); + panel_3.add(rdbtnReturnTicket); + + JRadioButton rdbtnAdult = new JRadioButton("Adult"); + rdbtnAdult.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + } + }); + rdbtnAdult.setBounds(405, 48, 69, 23); + rdbtnAdult.setFont(new Font("Tahoma", Font.BOLD, 13)); + panel_3.add(rdbtnAdult); + + JRadioButton rdbtnChild = new JRadioButton("Child"); + rdbtnChild.setBounds(405, 84, 69, 23); + rdbtnChild.setFont(new Font("Tahoma", Font.BOLD, 13)); + panel_3.add(rdbtnChild); + + JRadioButton rdbtnTaxPaid = new JRadioButton("Tax Paid"); + rdbtnTaxPaid.setFont(new Font("Tahoma", Font.BOLD, 13)); + rdbtnTaxPaid.setBounds(31, 166, 95, 23); + panel_3.add(rdbtnTaxPaid); + + JRadioButton rdbtnTravellingInsurancePaid = new JRadioButton("Travelling Insurance Paid"); + rdbtnTravellingInsurancePaid.setFont(new Font("Tahoma", Font.BOLD, 13)); + rdbtnTravellingInsurancePaid.setBounds(138, 166, 208, 23); + panel_3.add(rdbtnTravellingInsurancePaid); + + JRadioButton rdbtnExitLaugage = new JRadioButton("Exit Laugage"); + rdbtnExitLaugage.setFont(new Font("Tahoma", Font.BOLD, 13)); + rdbtnExitLaugage.setBounds(354, 166, 120, 23); + panel_3.add(rdbtnExitLaugage); + + JRadioButton rdbtnRegisterLaugage = new JRadioButton("Register Laugage"); + rdbtnRegisterLaugage.setFont(new Font("Tahoma", Font.BOLD, 13)); + rdbtnRegisterLaugage.setBounds(352, 140, 142, 23); + panel_3.add(rdbtnRegisterLaugage); + + JPanel panel_2_2 = new JPanel(); + panel_2_2.setBounds(973, 114, 361, 519); + panel_2_2.setBorder(new LineBorder(new Color(0, 0, 0), 8)); + frame.getContentPane().add(panel_2_2); + panel_2_2.setLayout(null); + + JButton btnNewButton_2 = new JButton("Exit"); + btnNewButton_2.setToolTipText("Exit System"); + btnNewButton_2.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + frame = new JFrame("Exit"); + if (JOptionPane.showConfirmDialog(frame, "Confirm if you want to exit" , "TRAVEL MANAGEMENT SYSTEM", + JOptionPane.YES_NO_OPTION)== JOptionPane.YES_NO_OPTION) { + System.exit(0); + } + + + } + }); + btnNewButton_2.setFont(new Font("Tahoma", Font.BOLD, 20)); + btnNewButton_2.setBounds(251, 463, 89, 33); + panel_2_2.add(btnNewButton_2); + + JButton btnNewButton_3 = new JButton("Receipt"); + btnNewButton_3.setFont(new Font("Tahoma", Font.BOLD, 20)); + btnNewButton_3.setBounds(21, 463, 120, 32); + panel_2_2.add(btnNewButton_3); + + JPanel panel_1 = new JPanel(); + panel_1.setBorder(new LineBorder(new Color(0, 0, 0), 8)); + panel_1.setBounds(10, 11, 1324, 78); + frame.getContentPane().add(panel_1); + panel_1.setLayout(null); + + JLabel lblNewLabel = new JLabel("TRAVEL MANAGEMENT SYSTEM"); + lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 60)); + lblNewLabel.setBounds(177, 11, 1060, 56); + panel_1.add(lblNewLabel); + + JPanel panel_2 = new JPanel(); + panel_2.setBorder(new LineBorder(new Color(0, 0, 0), 8)); + panel_2.setBounds(527, 174, 441, 404); + frame.getContentPane().add(panel_2); + panel_2.setLayout(null); + + JComboBox cabDestination = new JComboBox(); + cabDestination.setFont(new Font("Tahoma", Font.BOLD, 18)); + cabDestination.setModel(new DefaultComboBoxModel(new String[] {"None", "Nigeria - 2 Days in Lagos", "Ghana - 2 Days in Accra", "Kenya - 3 Days in Nairobi", "Congo - 2 Days in kinshasa", "USA - 5 Days in Boston", "Uk - 4 Days in London", "France - 4 Days in Paris", "Canada - 5 Days in Ottawa", "Italy - 4 Days in Roma", "Brazil - 5 Days in Rio", "Portugal - 4 Days in Lisbon"})); + cabDestination.setBounds(153, 76, 267, 35); + panel_2.add(cabDestination); + + JComboBox Accomodation = new JComboBox(); + Accomodation.setFont(new Font("Tahoma", Font.BOLD, 18)); + Accomodation.setModel(new DefaultComboBoxModel(new String[] {"None", "Single", "Double", "Extra"})); + Accomodation.setBounds(183, 129, 237, 35); + panel_2.add(Accomodation); + + JLabel lblNewLabel_10 = new JLabel(" Sub Total"); + lblNewLabel_10.setBounds(10, 248, 133, 30); + lblNewLabel_10.setFont(new Font("Tahoma", Font.BOLD, 19)); + panel_2.add(lblNewLabel_10); + + JLabel lblNewLabel_11 = new JLabel(" Total"); + lblNewLabel_11.setBounds(10, 298, 123, 26); + lblNewLabel_11.setFont(new Font("Tahoma", Font.BOLD, 19)); + panel_2.add(lblNewLabel_11); + + JLabel textTax = new JLabel(" "); + textTax.setBounds(183, 202, 237, 28); + textTax.setFont(new Font("Tahoma", Font.BOLD, 21)); + textTax.setHorizontalAlignment(SwingConstants.RIGHT); + textTax.setBorder(new LineBorder(new Color(0, 0, 0), 2)); + panel_2.add(textTax); + + JLabel textSubTotal = new JLabel(" "); + textSubTotal.setBounds(183, 250, 237, 28); + textSubTotal.setHorizontalAlignment(SwingConstants.RIGHT); + textSubTotal.setFont(new Font("Tahoma", Font.BOLD, 21)); + textSubTotal.setBorder(new LineBorder(new Color(0, 0, 0), 2)); + panel_2.add(textSubTotal); + + JLabel textTotal = new JLabel(" "); + textTotal.setBounds(183, 296, 237, 28); + textTotal.setHorizontalAlignment(SwingConstants.RIGHT); + textTotal.setFont(new Font("Tahoma", Font.BOLD, 21)); + textTotal.setBorder(new LineBorder(new Color(0, 0, 0), 2)); + panel_2.add(textTotal); + + JButton Total = new JButton("Total"); + Total.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + Total.addMouseListener(this); + + double Canada = 320; + double Brazil = 560; + double Italy = 670; + double Ghana = 470; + double USA = 760; + double kenya = 630; + double Congo = 340; + double UK = 650; + double France = 610; + double Portugal = 710; + double Nigeria = 270; + + + + double Acc_Single = 45; + double Acc_Double = 45; + double Acc_Extra = 45; + + double Std = 2.5; + double Eco = 65.5; + double Vip = 122.5; + + double TaxPaid = 6.7; + double Travelling_Insurance_Paid = 62.4; + double Register_Laugage = 25.9; + double Ext_Laugage = 25.9; + + + double[] TravelCost = new double[20]; + double iTax = 4.5; + + if (cabDestination.getSelectedItem().equals("Nigeria - 2 Days in Lagos") && + Accomodation.getSelectedItem().equals("Single") && rdbtnPlane.isSelected()) { + + } + + TravelCost[0] = Nigeria + Acc_Single + Std; + TravelCost[1] = ((TravelCost[0] * iTax/100)); + String tax = String.format("$%.2f",TravelCost[1]); + + JLabel lblTax = new JLabel(); + lblTax.setText((tax)); + String subTotal = String.format("$%.2f",TravelCost[0]); + + + + } + }); + Total.setToolTipText("Total cost of Ticket"); + Total.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + } + }); + Total.setBounds(38, 346, 105, 36); + Total.setFont(new Font("Tahoma", Font.BOLD, 20)); + panel_2.add(Total); + + JButton btnNewButton_1 = new JButton("Reset"); + btnNewButton_1.setToolTipText("Reset System"); + btnNewButton_1.setBounds(263, 346, 105, 36); + btnNewButton_1.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + + textTax.setText(null); + textSubTotal.setText(null); + textTotal.setText(null); + txtFirstname.setText(null); + txtSurname.setText(null); + txtAddress.setText(null); + txtDate.setText(null); + txtPhoneNumber.setText(null); + txtEmail.setText(null); + rdbtnPlane.setSelected(false); + rdbtnTrain.setSelected(false); + rdbtnBus.setSelected(false); + rdbtnStandard.setSelected(false); + rdbtnEconomy.setSelected(false); + rdbtnVip.setSelected(false); + rdbtnTaxPaid.setSelected(false); + rdbtnTravellingInsurancePaid.setSelected(false); + rdbtnSingleTicket.setSelected(false); + rdbtnReturnTicket.setSelected(false); + rdbtnAdult.setSelected(false); + rdbtnChild.setSelected(false); + rdbtnRegisterLaugage.setSelected(false); + rdbtnExitLaugage.setSelected(false); + + + + + + + + + + } + + }); + btnNewButton_1.setFont(new Font("Tahoma", Font.BOLD, 20)); + panel_2.add(btnNewButton_1); + + JLabel lblTax = new JLabel(" Tax"); + lblTax.setBounds(10, 202, 133, 35); + lblTax.setFont(new Font("Tahoma", Font.BOLD, 20)); + panel_2.add(lblTax); + + JLabel lblNewLabel_6 = new JLabel(" Departure Point"); + lblNewLabel_6.setFont(new Font("Tahoma", Font.BOLD, 18)); + lblNewLabel_6.setBounds(10, 21, 163, 35); + panel_2.add(lblNewLabel_6); + + JLabel lblNewLabel_7 = new JLabel(" Destination"); + lblNewLabel_7.setFont(new Font("Tahoma", Font.BOLD, 18)); + lblNewLabel_7.setBounds(10, 76, 133, 35); + panel_2.add(lblNewLabel_7); + + JLabel lblNewLabel_12 = new JLabel(" Accomodation"); + lblNewLabel_12.setFont(new Font("Tahoma", Font.BOLD, 18)); + lblNewLabel_12.setBounds(10, 129, 147, 35); + panel_2.add(lblNewLabel_12); + + JComboBox comboBox = new JComboBox(); + comboBox.setFont(new Font("Tahoma", Font.BOLD, 18)); + comboBox.setModel(new DefaultComboBoxModel(new String[] {"None", "Yaounde", "Douala", "Ngoundere", "Buea", "Limbe", "Bafoussam"})); + comboBox.setBounds(183, 30, 237, 35); + panel_2.add(comboBox); + + JLabel lblNewLabel_15 = new JLabel("Receipt"); + lblNewLabel_15.setFont(new Font("Tahoma", Font.BOLD, 18)); + lblNewLabel_15.setBounds(983, 92, 91, 22); + frame.getContentPane().add(lblNewLabel_15); + } + +} +