Class LoadGUI

java.lang.Object
bcu.cmp5332.bookingsystem.commands.LoadGUI
All Implemented Interfaces:
Command

public class LoadGUI extends Object implements Command
The LoadGUI class represents a command to load the graphical user interface (GUI) for the Flight Booking System. It implements the Command interface, allowing it to be executed within the context of a FlightBookingSystem instance.

Upon execution, the command creates a JFrame with a specific size and layout to display the GUI components. It sets the background color of the frame to white and adds borders for styling.

The command loads image icons from specified absolute paths and adds them to JLabels for display within the frame. It creates a JProgressBar to show loading progress and updates it incrementally.

Two main panels, panelNorth and panelSouth, are created to organize the GUI components in the JFrame. These panels include the logo, name, progress bar, and additional logo images.

A Timer is used to simulate the loading process with incremental progress updates. Once the progress reaches 100%, the JFrame is disposed, and a new MainWindow instance is created to display the main application window.

Example usage:


 // Create a new LoadGUI command instance
 Command loadGUICommand = new LoadGUI();
 
 // Execute the command within a FlightBookingSystem instance
 loadGUICommand.execute(flightBookingSystem);
 
See Also:
  • Constructor Details

    • LoadGUI

      public LoadGUI()
  • Method Details

    • execute

      public void execute(FlightBookingSystem flightBookingSystem) throws FlightBookingSystemException
      Executes the load GUI command within the provided FlightBookingSystem instance. Initializes a JFrame and loads graphical components such as images, progress bar, and additional logos to simulate the loading process.

      Once the loading completes (progress reaches 100%), disposes of the JFrame and initializes the main application window (MainWindow).

      Specified by:
      execute in interface Command
      Parameters:
      flightBookingSystem - The FlightBookingSystem instance on which the command is executed
      Throws:
      FlightBookingSystemException - If there is an error while accessing or processing flight booking system data