Skip to content
This repository has been archived by the owner on Feb 6, 2025. It is now read-only.

SG7504/Railway-Booking-SWING-ONLY

Repository files navigation

#Railway Booking Page using JAVA SWING ONLY

This Java code defines a Swing GUI application for a train booking page. Let's go through the main components and functionalities:

Imports: This code imports necessary classes from the javax.swing.* and java.awt.* packages. These packages contain classes and interfaces for building graphical user interface (GUI) applications.

Instance Variables: The class declares several instance variables, including JLabels for displaying text, JTextFields for user input, JComboBoxes for dropdown selection, and a JButton for triggering an action. These variables will be used to create and manipulate GUI components.

Constructor: The constructor method TrainBookingPage() is defined. Inside the constructor, GUI components such as labels, text fields, combo boxes, and the button are initialized and configured with specific fonts and sizes. These components are then added to the TrainBookingPage panel using a GridLayout, which arranges components in a grid-like structure.

Action Listener: An action listener is added to the bookButton. This listener responds to user actions, specifically when the button is clicked. Inside the action listener, you can define the logic to be executed when the button is clicked. In this case, it prints booking details to the console.

Main Method: The main method is defined, which serves as the entry point of the application. It creates an instance of TrainBookingPage, adds it to a JFrame (the top-level container for Swing applications), sets the size of the frame to occupy the whole screen, and makes the frame visible.

Overall, this code sets up a basic train booking page GUI with input fields and a button for booking, using Swing components only in Java, it does not use other components like JDBC or SQL. This code is stricly based on SWING.

Thank you taking interest in my code. Have a great day!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages