Answered step by step
Verified Expert Solution
Question
1 Approved Answer
package groupproject; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; java.awt.Dialog.ModalExclusionType; import import java.awt.Label; import java.awt.TextField; import java.awt.Window, import java.awt.Choice; import java.awt.Button;
package groupproject; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; java.awt.Dialog.ModalExclusionType; import import java.awt.Label; import java.awt.TextField; import java.awt.Window, import java.awt.Choice; import java.awt.Button; import java.awt.Color; import java.awt.Container; import javax.swing.UlManager; import javax.swing.JCheckBoxMenultem; import javax.swing.JColorChooser; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.JTextField; import javax.swing.JLabel; import javax.swing.JOption Pane; import java.awt.Font; import javax.swing.JScrollBar; import javax.swing.JList; import javax.swing.JComboBox; import java.awt.event.ItemListener; import java.awt.event.ItemEvent; import javax.swing.JTree; import javax.swing.JSlider; import javax.swing.JSeparator; import javax.swing.JFormattedTextField; public class FlightLogin extends JFrame{ protected static final String testField = null; protected static final int comboBox = 0; protected static final int comboBox_2 = 0; protected static final int comboBox_3= 0; } < public BookingDetails(String title) { super (title); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 556, 394); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblNewLabel 3 = new JLabel("Name:" ); lblNewLabel 3.setBounds(24, 28, 49, 14); contentPane.add(lblNewLabel_3); JLabel lblNewLabel 4 = new JLabel("IC"); lblNewLabel_4.setBounds(24, 64, 49, 14); contentPane.add(lblNewLabel_4); JLabel lblNewLabel 7 = new JLabel("Date:"); lblNewLabel 7.setBounds(24, 100, 49, 14); contentPane.add(lblNewLabel_7); JLabel lblNewLabel = new JLabel("Arrival."); lblNewLabel.setBounds(24, 136, 49, 14); contentPane.add(lblNewLabel); JLabel lblNewLabel 9 = new JLabel("Departure."); lblNewLabel 9.setBounds(24, 172, 99, 14); contentPane.add(lblNewLabel_9); //ic textField_3 = new JTextField(); textField_3.setText(FlightLogin.textField_3.getText()); textField 3.setBounds(110, 61, 96, 20); contentPane.add(textField_3); textField 3.setColumns(10); textField_2= new JTextField(); textField_2.setText(FlightLogin.textField_2.getText()); textField_2.setBounds(110, 61, 96, 20); contentPane.add(textField_2); textField 2.setColumns(10); Ln 1. Col 1 100% Windows (CRL public class FlightLogin extends JFrame{ protected static final String testField = null; protected static final int comboBox = 0; protected static final int comboBox_2 = 0; protected static final int comboBox_3= 0; private JPanel contentPane; static JTextField textField_7; static JTextField textField_1; static JTextField textFieldCount; static JTextField textField_2; static JTextField textField_3; static JTextField textField_4; static JTextField textField; static JTextField textField_Date; static String dateLogin; static String arrival; static String departure; //Launch the application. public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { } }); } //Create the frame. FlightLogin frame = new FlightLogin("Flight"); frame.setVisible(true); } catch (Exception e) { } e.printStackTrace(); public FlightLogin(String title) { super(title); setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 517, 512); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); Label label 6 new Label("PhoneNo: "); label_6.setFont(new Font("Tahoma", Font.PLAIN, 14)); label 6.setBounds(100, 302, 60, 21); contentPane.add(label_6); Label label 7 new Label("Date: "); label_7.setFont(new Font("Tahoma", Font.PLAIN, 14)); label 7.setBounds(100, 344, 100, 21); contentPane.add(label_7); textField = new JTextField(); textField.setBounds(220, 170,100, 31); contentPane.add(textField); textField.setColumns(10); textField_2= new JTextField(); textField_2.setBounds(220, 212, 100, 31); contentPane.add(textField_2); textField 2.setColumns(10); textField 3 = new JTextField(); textField_3.setBounds(220, 254, 100, 31); contentPane.add(textField_3); textField 3.setColumns(10); textField 4 = new JTextField(); textField_4.setBounds(220, 294, 100, 31); contentPane.add(textField_4); textField 4.setColumns(10); Label label 8 = new Label("Time: "); label 8.setFont(new Font("Tahoma", Font.PLAIN, 14)); label 8.setBounds(100, 381, 60, 21); contentPane.add(label_8); textField = new JTextField(); textField.setBounds(220, 376, 96, 26); contentPane.add(textField); textField.setColumns(10); JLabel lblNewLabel 10 = new JLabel("Airline Reservation"); lblNewLabel_10.setFont(new Font("Tahoma", Font.BOLD, 14)); lblNewLabel 10.setBounds(190, 22, 150, 22); contentPane.add(lblNewLabel_10); JLabel lblNewLabel = new JLabel("Arrival"); lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblNewLabel.setBounds(100, 120, 89, 22); contentPane.add(lblNewLabel); String[] arrival = {"","Kuala Lumpur", "Kedah", "Kuching", "Kelantan", "Sabah", "Johor", "Perlis"}; JComboBox comboBox_3= new JComboBox(arrival); comboBox_3.setBounds(220, 120, 96, 31); contentPane.add(comboBox_3); JLabel lblNewLabel_1= new JLabel("Num.Passenger :"); lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblNewLabel_1.setBounds(100, 170,300,18); contentPane.add(lblNewLabel_1); JLabel lblNewLabel 3 = new JLabel("Name :"); lblNewLabel 3.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblNewLabel 3.setBounds(100, 212, 61, 31); contentPane.add(lblNewLabel_3); JLabel lblNewLabel 4 = new JLabel("IC :"); lblNewLabel_4.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblNewLabel_4.setBounds(100, 259, 49, 14); contentPane.add(lblNewLabel_4); JLabel lblNewLabel 9 = new JLabel("Departure"); lblNewLabel 9.setFont(new Font("Tahoma", Font.PLAIN, 14)); lblNewLabel 9.setBounds(100, 70, 89, 22); contentPane.add(lblNewLabel_9); String[] departure = {"","Kuala Lumpur", "Kedah", "Kuching", "Kelantan", "Sabah", "Johor", "Perlis"}; JComboBox comboBox_4= new JComboBox(departure); comboBox_4.setBounds(220, 70, 96, 31); contentPane.add(comboBox_4); String currentDateCB = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29","30","31"); JComboBox comboBox= new JComboBox(currentDateCB); comboBox.setBounds(220, 343, 44, 22); contentPane.add(comboBox); JLabel lblNewLabel_5= new JLabel("/"); lblNewLabel 5.setBounds(228, 344, 22, 21); contentPane.add(lblNewLabel 5); String current MonthCB = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; JComboBox comboBox_1= new JComboBox(currentMonthCB); comboBox_1.setBounds(280, 343, 49, 22); contentPane.add(comboBox_1); String current Year CB = {"2021","2022","2023","2024","2025","2026"}; JComboBox comboBox_2; comboBox_2= new JComboBox(current Year CB); comboBox_2.setBounds(340, 343, 60, 22); contentPane.add(comboBox_2); JLabel lblNewLabel_6 = new JLabel("/"); lblNewLabel 6.setBounds(302, 344, 22, 21); contentPane.add(lblNewLabel_6); JButton btnNewButton = new JButton("Submit"); btnNewButton.addActionListener(new ActionListener() { public void action Performed(ActionEvent e) { dispose(); }); } BookingDetails bi-new BookingDetails("BookingDetails"); bi.setVisible(true); btnNewButton.setBounds(150, 429, 89, 23); contentPane.add(btnNewButton); }); JButton btnNewButton_1= new JButton("Cancel"); btnNewButton_1.addActionListener(new ActionListener() { public void action Performed(ActionEvent e) { System.exit(0); } btnNewButton_1.setBounds(270, 429, 89, 23); contentPane.add(btnNewButton_1); JButton btnNewButton_2 = new JButton("Check Price"); btnNewButton.addActionListener(new ActionListener() { public void action Performed(Action Event e) { dispose(); } }); btnNewButton_2.setBounds(390, 429,120, 23); contentPane.add(btnNewButton_2); btnNewButton_2.addActionListener(new ActionListener() { public void action Performed(Action Event e) { int count-5, num1, num2 = 0, price; try { } } count-Integer.parseInt(textFieldCount.getText()); switch (count) { case 1: case 2: case 3: case 4: case 5: default: num2-70; break; num2-80; break; num2=90; break; num2=100; break; num2-120; break; JOptionPane.showMessageDialog(null,"Please enter valid number for passenger!"); } num1= Integer.parseInt(textField_1.getText()); price-num1*num2; textField_7.setText(Integer.toString(price)); JOptionPane.showMessageDialog(null,"Please fill in the information!"); }catch(Exception e) { finally { // ... cleanup that will execute whether or not an error occurred ... } package groupproject; import java.awt.Border Layout; import java.awt.EventQueue; import java.sql.ResultSet; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JTable; import javax.swing.JLabel; import javax.swing.JTextField; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import javax.swing.event.AncestorListener; import javax.swing.event.AncestorEvent; import javax.swing.JTextArea; import javax.swing.JButton; public class BookingDetails extends JFrame { private JPanel contentPane; private JTextField textField; static JTextField textField_1; private JTextField textField_2; private JTextField textField_3; private JTextField textField_4; private JTextField textField_5; private JTextField textField_6; 1** * Launch the application. *1 public static void main(String[] args) { } EventQueue.invokeLater(new Runnable() { }); public void run() { try { /** * Create the frame. *1 BookingDetails frame = new BookingDetails("BookingDetails"); frame.setVisible(true); } catch (Exception e) { } e.printStackTrace();
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started