Class LoadGUI
- All Implemented Interfaces:
Command
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:
-
Field Summary
Fields inherited from interface bcu.cmp5332.bookingsystem.commands.Command
HELP_MESSAGE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
execute
(FlightBookingSystem flightBookingSystem) Executes the load GUI command within the provided FlightBookingSystem instance.
-
Constructor Details
-
LoadGUI
public LoadGUI()
-
-
Method Details
-
execute
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 interfaceCommand
- 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
-