This assignment is about creating a graphical user interface (GUI) for an airport reservation system using Java Swing. The GUI has various components such as labels, text fields, combo boxes, and sliders that allow users to input their flight details and preferences. Users can search for flights and view available itineraries.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSlider; import javax.swing.JTextField; import javax.swing.JComboBox; import javax.swing.JButton; import javax.swing.JOptionPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import java.awt.Color; import java.awt.GridLayout; import java.awt.event.ActionEvent; public class AirportFrame extends JFrame { public static void main(String[] args) { new AirportFrame().run(); } public void run() { JPanel panel = new JPanel(); panel.setLayout(new GridLayout(0, 1)); JLabel labelAirline = new JLabel("Airline: ", JLabel.LEFT); panel.add(labelAirline); JLabel labelSourceAir = new JLabel("Source Airport: ", JLabel.LEFT); panel.add(labelSourceAir); JLabel labelDestAir = new JLabel("Destination Airport: ", JLabel.LEFT); panel.add(labelDestAir); JLabel labelDepTime = new JLabel("Departure Time: ", JLabel.LEFT); panel.add(labelDepTime); JLabel labelArrTime = new JLabel("Arrival Time: ", JLabel.LEFT); panel.add(labelArrTime); JTextField tfAirline = new JTextField(""); tfAirline.addActionListener(); JOptionPane.showMessageDialog(null, "Airline Unavailable. Please choose another airline."); panel.add(tfAirline); JTextField tfSourceAir = new JTextField(""); tfSourceAir.addActionListener(); JOptionPane.showMessageDialog(null, "Unknown city."); panel.add(tfSourceAir); JTextField tfDestAir = new JTextField(""); tfDestAir.addActionListener(); JOptionPane.showMessageDialog(null, "Unknown city."); panel.add(tfDestAir); JTextField tfDepTime = new JTextField("");
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.