A modern, user-friendly desktop application for booking bus tickets, built with JavaFX. This platform allows users to search for buses, select seats, and make bookings, while administrators can manage bus schedules and operations efficiently.
- 🚀 Overview
- ✨ Features
- 🛠️ Technologies Used
- 📋 Prerequisites
- ⚙️ Installation
- 🗄️ Database Setup
- 📖 Usage
- 🏗️ Project Structure
- 🤝 Contributing
- 📄 License
The Online Bus Booking Platform is a comprehensive desktop application designed to streamline the bus ticket booking process. It features a dual-role system with separate interfaces for administrators and regular users, ensuring secure and efficient operations.
Key Highlights:
- 🔐 Secure user authentication with password hashing
- 👨💼 Admin dashboard for bus and schedule management
- 👤 User-friendly booking interface with interactive seat selection
- 📊 Real-time bus availability and filtering
- 💳 Integrated payment processing
- 🎨 Modern UI with custom styling
- Bus Management: Add, view, and delete bus information
- Schedule Management: Create and manage bus schedules with dates and times
- Dashboard Overview: Comprehensive table view of all buses and schedules
- Filtering Options: Filter buses by date (Today, Tomorrow, Onward)
- Auto-Cleanup: Automatic deletion of expired schedules
- User Registration & Login: Secure account creation and authentication
- Bus Search: Search buses by source, destination, and travel date
- Interactive Seat Selection: Visual seat layout with real-time availability
- Booking Management: Confirm bookings and view details
- Payment Integration: Seamless payment processing for confirmed bookings
- Password hashing using BCrypt
- SQL injection prevention with prepared statements
- User session management
- Role-based access control (Admin/User)
- Language: Java 21
- GUI Framework: JavaFX 21.0.6
- Database: MySQL 9.2.0
- Database Connector: MySQL Connector/J
- Password Hashing: jBCrypt 0.4
- Build Tool: Manual compilation (javac)
- Styling: CSS for JavaFX components
Before running this application, ensure you have the following installed:
- Java Development Kit (JDK) 21 or higher
- MySQL Server 8.0 or higher
- JavaFX SDK 21.0.6 (included in the project)
- Git for cloning the repository
-
Clone the Repository
git clone https://github.com/your-username/online-bus-booking-platform.git cd online-bus-booking-platform -
Set Up JavaFX
- JavaFX SDK is already included in the
lib/directory - No additional setup required
- JavaFX SDK is already included in the
-
Compile the Application
# Compile all Java files javac -cp "lib/*" -d bin src/**/*.java # Or use the provided compile script if available
-
Set Up Environment Variables (Optional)
- Ensure
JAVA_HOMEpoints to your JDK 21 installation - Add JavaFX bin directory to PATH if needed
- Ensure
-
Create MySQL Database
CREATE DATABASE bus_booking;
-
Run the SQL Script
- Execute the
bus_booking.sqlfile in your MySQL client - This will create all necessary tables:
users,buses,bus_schedule,bookings
- Execute the
-
Update Database Configuration
- Open
src/database/DatabaseConnection.java - Update the database URL, username, and password as per your MySQL setup
private static final String URL = "jdbc:mysql://localhost:3306/bus_booking"; private static final String USER = "your_mysql_username"; private static final String PASSWORD = "your_mysql_password";
- Open
# Run the application
java -cp "bin:lib/*" --module-path lib/javafx-sdk-21.0.6/lib --add-modules javafx.controls,javafx.fxml Main- Launch Application: Start the app and you'll see the login screen
- Register/Login: Create a new account or log in with existing credentials
- Search Buses: Enter source, destination, and travel date
- Select Bus: Choose from available options
- Pick Seats: Click on available seats in the interactive layout
- Confirm Booking: Review details and confirm your booking
- Payment: Complete the payment process
- Login: Use admin credentials to access the admin dashboard
- Manage Buses: Add new buses or delete existing ones
- Manage Schedules: Create schedules for buses with specific dates and times
- View Dashboard: Monitor all buses and schedules with filtering options
- Auto Cleanup: System automatically removes expired schedules
online-bus-booking-platform/
│
├── src/
│ ├── Main.java # Application entry point
│ ├── controllers/ # JavaFX controllers
│ │ ├── LoginController.java
│ │ ├── RegisterController.java
│ │ ├── AdminController.java
│ │ ├── UserController.java
│ │ ├── UserBookingController.java
│ │ ├── PaymentController.java
│ │ ├── AddBusController.java
│ │ └── AddScheduleController.java
│ ├── models/ # Data models
│ │ ├── Bus.java
│ │ └── BusSchedule.java
│ ├── database/ # Database connection
│ │ └── DatabaseConnection.java
│ └── views/ # FXML view files
│ ├── login.fxml
│ ├── register.fxml
│ ├── adminDashboard.fxml
│ ├── userDashboard.fxml
│ ├── userBooking.fxml
│ ├── payment.fxml
│ ├── addBus.fxml
│ └── addSchedule.fxml
│
├── lib/ # External libraries
│ ├── javafx-sdk-21.0.6/
│ ├── mysql-connector-j-9.2.0.jar
│ └── jbcrypt-0.4.jar
│
├── bin/ # Compiled classes and resources
│ ├── Main.class
│ ├── controllers/
│ ├── models/
│ ├── database/
│ ├── views/
│ ├── styles/
│ ├── images/
│ └── lib/
│
├── bus_booking.sql # Database schema
├── styles/ # CSS stylesheets
│ ├── login.css
│ ├── booking.css
│ └── userDashboard.css
├── images/ # UI images
│ ├── bus-logo.png
│ └── logout.png
└── README.md # Project documentation
We welcome contributions to improve the Online Bus Booking Platform! Here's how you can help:
- Fork the Repository
- Create a Feature Branch
git checkout -b feature/AmazingFeature
- Commit Your Changes
git commit -m 'Add some AmazingFeature' - Push to the Branch
git push origin feature/AmazingFeature
- Open a Pull Request
- Follow Java naming conventions
- Add comments for complex logic
- Test your changes thoroughly
- Update documentation as needed
This project is licensed under the MIT License - see the LICENSE file for details.
Happy Traveling! 🎉
For questions or support, please open an issue on GitHub.