Professional Documents
Culture Documents
Hotel Management System: A GUI Using JAVA SWING
Hotel Management System: A GUI Using JAVA SWING
ABSTRACT
pertinent details such as name, email, contact number, room type, arrival, and
The application employs Java's Swing library to create an intuitive interface. Users
can input their booking information into designated text fields and confirm the details
using the "Confirm" button. Upon confirmation, the data is added to a dynamically
The graphical layout consists of various components: text fields for input, a button
for confirmation, and a table that dynamically exhibits the entered booking
information. The "Confirm" button triggers the addition of new entries to the table
while simultaneously clearing the input fields for the next booking entry.
details and displaying them in a structured table format. Its simplicity enables
layout, consisting of labeled input fields and a responsive table, ensures a smooth and
organized user experience throughout the hotel booking process.
TABLE OF CONTENTS
S. No Content
1 Introduction
1.2 Objective
1.3 Overview
2 Source Code
3 Test Cases/Outputs
4 Conclusion
5 References
INTRODUCTION
1.1 PROBLEM DEFINITION
The program aims to create a simple hotel booking application using Java Swing. It
provides a graphical user interface (GUI) where users can input their details like
name, email, contact number, room type, arrival date, and departure date to make a
hotel booking. The entered data gets displayed in a table within the application.
1.2 OBJECTIVE
enter their booking details easily through the provided text fields.
- To display entered data in a table*: The program's goal is to exhibit the booking
- To clear input fields after booking confirmation*: Upon confirming the booking by
clicking the "Confirm" button, the program aims to add the entered data to the table
and clear the input fields for the next booking entry.
1.3 OVERVIEW
1. Components:
- Text fields for user input (name, email, number, room type, arrival date,
departure date).
- Upon clicking the "Confirm" button, the entered data is added to the table.
- Input fields are cleared after data entry to facilitate the next booking entry.
3. Main Method:
HotelBookingApp class.
4. Event Handling:
addDataToTable() method to process and display the entered data in the table.
CHAPTER-2
SOURCE CODE
import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.border.EmptyBorder;
arrivalDateField, departureDateField;
public HotelBookingApp() {
// Create components
confirmButton.addActionListener(new ActionListener() {
@Override
addDataToTable();
});
tableModel.addColumn("Name");
tableModel.addColumn("Email");
tableModel.addColumn("Number");
tableModel.addColumn("Room Type");
tableModel.addColumn("Arrival Date");
tableModel.addColumn("Departure Date");
inputPanel.add(new JLabel("Name:"));
inputPanel.add(nameField);
inputPanel.add(new JLabel("Email:"));
inputPanel.add(emailField);
inputPanel.add(new JLabel("Number:"));
inputPanel.add(numberField);
inputPanel.add(roomTypeField);
inputPanel.add(arrivalDateField);
inputPanel.add(departureDateField);
inputPanel.add(confirmButton);
mainPanel.add(inputPanel, BorderLayout.NORTH);
mainPanel.add(scrollPane, BorderLayout.CENTER);
// Create a frame
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(mainPanel);
frame.setSize(600, 400);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
departureDate});
nameField.setText("");
emailField.setText("");
numberField.setText("");
roomTypeField.setText("");
arrivalDateField.setText("");
departureDateField.setText("");
SwingUtilities.invokeLater(new Runnable() {
@Override
new HotelBookingApp();
});
CHAPTER-3
The provided code constitutes a simple Hotel Booking Application using Java's
Swing framework, facilitating user input for hotel booking details and displaying
them in a table format. This application employs various Swing components such as
interface (GUI) for managing hotel reservations. Let's delve into a comprehensive
The provided code offers a fundamental foundation for a Hotel Booking Application
with a GUI using Java Swing. It enables users to input booking information and
suggested improvements, this application could evolve into a more robust and user-
centric booking system, catering to diverse user needs while ensuring data accuracy
and reliability.
REFERENCES
[1]. Java for Programmers, P. J. Deitel and H. M. Deitel, 10th Edition, Pearson
Education
Education
[4]. https://www.w3schools.com/java/java_oop.asp
[5]. https://www.tutorialspoint.com/java/index.htm