A comprehensive Bus Reservation System built in Core Java with GUI using Java Swing. This desktop application allows users to book, cancel, and manage bus tickets with an intuitive interface, efficient thread management for processing bookings, and real-time seat availability management.
Problem Identified: When traveling by bus, it's often very hectic to buy tickets/reserve seats at the time of departure. Long queues, time wastage, and inconvenience are common issues faced by passengers.
Solution Proposed: To overcome this problem, we have developed the Bus Seat Reservation System, which helps users book seats at their comfort without having to stand in long queues, saving users valuable time.
- User-Friendly GUI: Interactive Java Swing interface for easy navigation
- Seat Booking: Real-time seat selection and booking system
- Ticket Cancellation: Cancel existing bookings with refund processing
- Seat Management: Dynamic seat availability tracking
- Multi-threading: Efficient thread management for concurrent bookings
- Database Integration: MySQL database for persistent data storage
- Passenger Management: Add, edit, and manage passenger information
- Booking History: View past and current bookings
- Route Management: Manage bus routes and schedules
- Payment Processing: Handle booking payments and refunds
- Report Generation: Generate booking reports and statistics
- Programming Language: Java (Core Java)
- GUI Framework: Java Swing
- Database: MySQL
- Platform: Java JDK 19
- IDE: NetBeans
- Threading: Java Thread Management
- Architecture: Desktop Application
- Processor: Intel Core i3 or equivalent
- RAM: 4GB minimum (8GB recommended)
- Storage: 1GB free disk space
- Display: 1024x768 resolution minimum
- Operating System: Windows 8/10/11
- Java Runtime Environment: JRE 8 or higher
- Java Development Kit: JDK 19
- Database: MySQL 5.7 or higher
- IDE: NetBeans (recommended)
- Download Java JDK 19 from Oracle Official Website
- Install JDK on your system
- Set JAVA_HOME environment variable
- Download MySQL from MySQL Official Website
- Install MySQL Server and MySQL Workbench
- Start MySQL service
- Open MySQL Workbench or Command Line
- Create database:
CREATE DATABASE bus_reservation_db;
USE bus_reservation_db;- Import the SQL schema file (if provided) or run the database scripts
# Clone the repository
git clone https://github.com/harshad8782/Bus-Reservation-System.git
# Or download ZIP file and extract- Open NetBeans IDE
- Click on File β Open Project
- Navigate to the project folder and select it
- Right-click on project β Properties
- Add MySQL JDBC driver to Libraries
Edit the database configuration in your Java files:
// Database Configuration
private static final String DB_URL = "jdbc:mysql://localhost:3306/bus_reservation_db";
private static final String DB_USER = "root";
private static final String DB_PASSWORD = "your_password";- Build the project in NetBeans
- Run the main class file
- The GUI application should launch successfully
Bus-Reservation-System/
β
βββ src/
β βββ main/
β β βββ BusReservationMain.java # Main application entry point
β β βββ LoginFrame.java # User login interface
β β βββ BookingFrame.java # Ticket booking interface
β β βββ CancelFrame.java # Ticket cancellation
β β βββ SeatLayout.java # Seat arrangement GUI
β β βββ DatabaseConnection.java # Database connectivity
β β
β βββ models/
β β βββ Bus.java # Bus entity class
β β βββ Passenger.java # Passenger entity class
β β βββ Booking.java # Booking entity class
β β βββ Route.java # Route entity class
β β
β βββ dao/
β β βββ BusDAO.java # Bus data access object
β β βββ PassengerDAO.java # Passenger DAO
β β βββ BookingDAO.java # Booking DAO
β β
β βββ utils/
β β βββ ThreadManager.java # Thread management utility
β β βββ ValidationUtils.java # Input validation
β β βββ ReportGenerator.java # Report generation
β β
β βββ resources/
β βββ images/ # GUI images and icons
β βββ sql/ # Database schema files
β
βββ lib/ # External JAR files
βββ dist/ # Compiled application
βββ build/ # Build files
βββ README.md
The application uses Java threading for:
- Concurrent Bookings: Handle multiple booking requests simultaneously
- Real-time Updates: Update seat availability in real-time
- Background Tasks: Process payments and database operations
- GUI Responsiveness: Maintain UI responsiveness during operations
// Example Thread Implementation
public class BookingThread extends Thread {
@Override
public void run() {
// Handle booking process in separate thread
processBooking();
}
}- buses - Bus information (bus_id, bus_name, capacity, route_id)
- routes - Route details (route_id, source, destination, distance, fare)
- passengers - Customer information (passenger_id, name, email, phone)
- bookings - Booking records (booking_id, passenger_id, bus_id, seat_no, date)
- seats - Seat management (seat_id, bus_id, seat_no, is_available)
- payments - Payment transactions (payment_id, booking_id, amount, status)
- Input Validation: Comprehensive input validation and sanitization
- SQL Injection Prevention: Prepared statements for database queries
- User Authentication: Secure login system with password hashing
- Session Management: Proper session handling for user security
- Data Encryption: Sensitive data encryption where applicable
Database Connection Error:
- Verify MySQL server is running
- Check database credentials in configuration
- Ensure MySQL JDBC driver is added to classpath
GUI Not Loading:
- Check Java version compatibility
- Verify Swing components are properly imported
- Look for any missing resource files
Booking Thread Issues:
- Monitor thread synchronization
- Check for deadlock conditions
- Verify concurrent access handling
Compilation Errors:
- Ensure all dependencies are included
- Check Java version compatibility
- Verify classpath configuration
(Add screenshots of your application here)
- Login Screen
- Main Dashboard
- Seat Selection Interface
- Booking Confirmation
- Admin Panel
- Web-based Version: Convert to web application
- Mobile App: Develop mobile application
- Payment Gateway: Integration with real payment systems
- GPS Tracking: Real-time bus location tracking
- SMS/Email Notifications: Automated booking confirmations
- Multi-language Support: Support for multiple languages
- Analytics Dashboard: Advanced reporting and analytics
- Fork the repository
- Create feature branch (
git checkout -b feature/new-feature) - Commit changes (
git commit -m 'Add new feature') - Push to branch (
git push origin feature/new-feature) - Open Pull Request
This project is open source. Please check the repository for specific license terms.
- GitHub Issues: Create an issue
- Email: harshad8782@gmail.com
- Developer Profile: GitHub Profile
- Java Community for excellent documentation
- Oracle for Java Swing framework
- MySQL team for robust database system
- NetBeans IDE for development environment
- All contributors and testers
- Language: Java (100%)
- GUI Components: Java Swing
- Database: MySQL
- Threading: Multi-threaded application
- Architecture: MVC Pattern
Developer: Harshad
Repository: GitHub Link
Technology: Core Java + MySQL + Swing
Version: 1.0
Last Updated: 2025
For more Java projects and updates, visit the developer's profile.