Você está na página 1de 44

A

DISSERTATION SUBMITTED
AS PARTIAL FULFILLMENT OF THE REQUIREMENT OF THE SUBJECT
INFORMATICS PRACTICES
OF
CLASS XII
OF
CENTRAL BOARD OF SECONDARY EDUCATION
SESSION 2015 16

Submitted by

Rishab Thakur
(REG. NO. : )

Under the Supervision of


SUNITA DEKA
Computer Teacher,
Opp. To ram Mandir, Basistha Road,
Guwahati 781 029, Assam.

Delhi Public School, Guwahati


Ahomgaon, Guwahati, Assam 781 029.

Delhi Public School, Guwahati

Phone:(0361)2

Ahomgaon,Guwahati 781 029, Assam.


Date:.

Certificate

This is to certify that Rishab Thakur student of Class XII of CBSE, successfully
carried out the project work entitled Hotel Management System at Delhi Public
School, Guwahati, Ahomgaon, Guwahati, Assam 29
for the session 2015-16, under my guidance.
This project report has been prepared as a partial fulfillment of the subject Informatics
Practices of Class XII under Central Board of Secondary Education the session 200809.

Sunita Deka
Computer Teacher,
Ahomgaon,
Guwahati 781 029, Assam.

Delhi Public School, Guwahati

Phone :(0361)2

Ahomgaon,
Guwahati 781 029, Assam.
Date:.

Certificate

This is to certify that Rishab(Reg. No.) a student of Class XII of CBSE, successfully
carried out the project work entitled Hotel Management System at Delhi Public
School, Ahomgaon, Guwahati, Assam 29
for the session 2015-16, under my guidance.
This project report has been prepared as a partial fulfillment of the subject Informatics
Practices of Class XII under Central Board of Secondary Education the session 200809.

(Mrs. Chandralekha Rawat)


Principal,
Delhi Public School,
Guwahati, Ahomgaon,
Guwahati 781 029, Assam.

ACKNOWLEDGEMENT

I am very much grateful to Delhi Public Shool, Guwahati for giving us the chance to
carry out our Class XII project work at its premises (Ahomgaon, Guwahati, Assam
781 029) for the session 2015-16.

I would like to express my deepest sense of gratitude to

Sunita Deka,

Computer Teacher, Delhi Public School, Guwahati for her constant inspiration, valuable
suggestions and construction criticism at every stage of the present work.

(Rishab)
Class XII, Info. Sc.
Ahomgaon,Guwahati 781
029, Assam.

CONTENTS
Chapters

Page No.

1. Introductions
1.1 Introduction to RDBMS
1.2 Introduction to NetBeans IDE 6.7.1
2. Overview of the System
3. Objective of the Proposed System
4. Tools/Environment used
5. System Analysis
6. System Design
6.1 Description of the System Modules
6.2 Description of the Table/Relation
6.3 Data Dictionary
7. Report
7.1 Input Form

***

INTRODUCTIONS
1.1 Introduction to RDBMS:
RDBMS stands for Relational Database Management System. RDBMS data is
structured in database tables, fields and records. Each RDBMS table consists of
database table rows. Each database table row consists of one or more database table
fields.
RDBMS store the data into collection of tables, which might be related by common
fields (database table columns). RDBMS also provide relational operators to
manipulate the data stored into the database tables. Most RDBMS use SQL as
database query language.
Edgar Codd introduced the relational database model. Many modern DBMS do not
conform to the Codds definition of a RDBMS, but nonetheless they are still
considered to be RDBMS.
The most popular RDBMS are MS SQL Server, DB2, Oracle and MySQL.
1.2 Introduction to NetBeans IDE 6.7.1 :
The NetBeans IDE is an award-winning integrated development environment
available for Windows, Mac, Linux, and Solaris. The NetBeans project consists of an
open-source IDE and an application platform that enable developers to rapidly create
web, enterprise, desktop, and mobile applications using the Java platform, as well as
JavaFX, PHP, JavaScript and Ajax, Ruby and Ruby on Rails, Groovy and Grails, and
C/C++.
The NetBeans project is supported by a vibrant developer community and offers
extensive documentation and training resources as well as a diverse selection of thirdparty plugins.
NetBeans IDE 6.7 is integrated with Project Kenai, a collaborative environment for
developers to host open-source projects. With Kenai and the NetBeans IDE, a team of
developers is able to create projects, check out, edit, debug, build, discuss, and
commit code, all through one easy-to-use interface!
The release also builds on the success of NetBeans 6.5 with native support for
Maven; GlassFish, issue tracker and Hudson integrations; and enhancements to Java,
PHP, Ruby, Groovy and C/C++. Highlights of the 6.7 release include support for
JavaScript 1.7, Ruby Remote Debugging, and integration of the Java ME SDK 3.0.

***

OVERVIEW OF THE SYSTEM


Hotel Management System Rooms are the entities of real world system that contains
fields and its respective values in it. Collections of these related information makes a
database. An interface is selected to interact with the user and store the information
passed by them.
When an interface is executed, the entities interact by sending messages to one
another. So, in this system few procedures are prepared to accept the values into the
attributes, manipulate the entities to maintain the information in respective tables and to
prepare a report on them.

*********************

OBJECTIVE OF THE PROPOSED SYSTEM


The objective of this system is to implement the concept of RDBMS with an
Interface known as NetBeans IDE 6.7.1. The concept of fields/Attributes, records, tables,
Entities/ Database, RDBMS, package, package interacting with tables, relation between
entities etc is been used. We have already been introduced to spreadsheets, databases,
word processors and presentation software earlier. That familiarly is been used to
introduce the idea of how the software can be designed by modeling it as operations
permitted on different entities.

**************

TOOLS/ENVIRONMENT USED

Operating System as Window XP or above


Minimum requirement 1GB RAM
PIV Processor or above
My SQL(RDBMS)
NetBeans IDE 6.7.1(Interface or Package)

**************

SYSTEM ANALYSIS
System analysis is a set of technique and graphical tools that allow the analyst to
develop a new kind of system specification that easily understandable to the user. The
goal of system development is to deliver system in line with the user requirement.

The data in this system were collected from an organization through interviews,
questionnaires, on-site observation, procedure manuals, and the like, after analysis some
of the fields were selected and used for calculation of profit of the organization.

***************

SYSTEM DESIGN
6.1 Description of the System Modules:
Main Menu:

All the other forms can be opened from this form.


Hotel Management(Entry) Form:

This module is where the information of a newly occupied room is entered


and information of occupied rooms is edited.
Search Interface:

This module is used to look up the information of a particular room.


Display Interface:

This module displays the information of all the occupied rooms in the
hotel.

***
6.2 Description of Tables/relations:
Hotel:
Name
Name
Phoneno
Roomno
Roomtype
Noofdays
Noofadults
Noofchildren

Data Type(Size)
varchar(30)
int
varchar(30)
varchar(30)
int
int
int
***

Index
Not Null
Not Null
Primary Key
Not Null
Not Null
Not Null
Not Null

CODE
The following is the code for the process ::
Hotel Management(Entry) Form :
package jefferson;
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Student
*/
public class HotelManagementForm extends javax.swing.JFrame {
Connection con;
Statement stmt;
DefaultTableModel model;
int flag;
public HotelManagementForm() {
initComponents();
model=(DefaultTableModel)tbhotel.getModel();
show1();
disable1();
updatepanel.setVisible(false);
}
void OpenConnection()
{
try{
Class.forName("com.mysql.jdbc.Driver");
con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/JEFFERSON","root","");
stmt = con.createStatement();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
void show1()
{
delete();
try{
OpenConnection();
String query="select * from hotel;";
ResultSet rs=stmt.executeQuery(query);

while(rs.next())
{
String name=rs.getString("Name");
String phoneno=rs.getString("Phoneno");
String roomno=rs.getString("Roomno");
String roomtype=rs.getString("Roomtype");
String noofdays=rs.getString("Noofdays");
String noofadults=rs.getString("Noofadults");
String noofchildren=rs.getString("Noofchildren");
model.addRow(new Object[]
{name,phoneno,roomno,roomtype,noofdays,noofadults,noofchildren});
}
rs.close();
stmt.close();
con.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
void disable1()
{
txtname.setEditable(false);
txtphone.setEditable(false);
txtroomno.setEditable(false);
txtadultno.setEditable(false);
txtchildno.setEditable(false);
}
void enable1()
{
txtname.setEditable(true);
txtphone.setEditable(true);
txtroomno.setEditable(true);
txtadultno.setEditable(true);
txtchildno.setEditable(true);
}
void clear()
{
txtname.setText("");
txtphone.setText("");
txtroomno.setText("");
txtadultno.setText("");
txtchildno.setText("");
}
void delete()
{
int rows=model.getRowCount();
if(rows>0){

for(int i=0;i<rows;i++)
{
model.removeRow(0);
}
}
}
void setdata(String x)
{
try
{
OpenConnection();
String query="select * from hotel where roomno ="+x+";";
ResultSet rs=stmt.executeQuery(query);
if(rs.next())
{
String name=rs.getString("name");
String phoneno=rs.getString("phoneno");
String roomno=rs.getString("roomno");
String roomtype=rs.getString("Roomtype");
String noofdays=rs.getString("Noofdays");
String noofadults=rs.getString("Noofadults");
String noofchildren=rs.getString("Noofchildren");
txtname.setText(name);
txtphone.setText(phoneno);
txtroomno.setText(roomno);
txtadultno.setText(noofadults);
txtchildno.setText(noofchildren);
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, e.getMessage());
}
}

/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
pguest = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();


txtname = new javax.swing.JTextField();
txtphone = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
txtroomno = new javax.swing.JTextField();
prate = new javax.swing.JPanel();
rbSuite = new javax.swing.JRadioButton();
rbSingle = new javax.swing.JRadioButton();
rbDeluxe = new javax.swing.JRadioButton();
jLabel5 = new javax.swing.JLabel();
comboday = new javax.swing.JComboBox();
jLabel6 = new javax.swing.JLabel();
txtadultno = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
txtchildno = new javax.swing.JTextField();
printpanel = new javax.swing.JPanel();
btnPrint = new javax.swing.JButton();
btnEdit = new javax.swing.JButton();
btnDelete = new javax.swing.JButton();
btnCheckout = new javax.swing.JButton();
updatepanel = new javax.swing.JPanel();
btnUpdate = new javax.swing.JButton();
btnCancel = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
tbhotel = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
pguest.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFact
ory.createLineBorder(new java.awt.Color(0, 0, 0)), "Guest Information"));
pguest.setToolTipText("");
jLabel2.setText("Enter Name:");
jLabel3.setText("Phone No.:");
txtname.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtnameActionPerformed(evt);
}
});
jLabel4.setText("Room No.:");
javax.swing.GroupLayout pguestLayout = new javax.swing.GroupLayout(pguest);
pguest.setLayout(pguestLayout);
pguestLayout.setHorizontalGroup(

pguestLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pguestLayout.createSequentialGroup()
.addContainerGap()
.addGroup(pguestLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEA
DING)
.addGroup(pguestLayout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtname))
.addGroup(pguestLayout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(pguestLayout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtphone))
.addGroup(pguestLayout.createSequentialGroup()
.addComponent(jLabel4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(txtroomno)))
.addContainerGap())
);
pguestLayout.setVerticalGroup(
pguestLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pguestLayout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pguestLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BAS
ELINE)
.addComponent(jLabel2)
.addComponent(txtname, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(pguestLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BAS
ELINE)
.addComponent(jLabel3)
.addComponent(txtphone, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
20, Short.MAX_VALUE)
.addGroup(pguestLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BAS
ELINE)
.addComponent(jLabel4)
.addComponent(txtroomno, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
prate.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactor
y.createLineBorder(new java.awt.Color(0, 0, 0)), "Rate Information"));
buttonGroup1.add(rbSuite);
rbSuite.setText("Suite");
buttonGroup1.add(rbSingle);
rbSingle.setText("Single");
buttonGroup1.add(rbDeluxe);
rbDeluxe.setText("Deluxe");
jLabel5.setText("Room Type:");
comboday.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1",
"2", "3", "4", "5", "6", "7" }));
jLabel6.setText("No. of days:");
jLabel7.setText("No. of adults:");
jLabel8.setText("No. of children:");
javax.swing.GroupLayout prateLayout = new javax.swing.GroupLayout(prate);
prate.setLayout(prateLayout);
prateLayout.setHorizontalGroup(
prateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(prateLayout.createSequentialGroup()
.addContainerGap()
.addGroup(prateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEAD
ING)
.addComponent(jLabel5)
.addComponent(rbSingle)
.addComponent(rbSuite)

.addComponent(rbDeluxe))
.addGap(41, 41, 41)
.addGroup(prateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEAD
ING)
.addGroup(prateLayout.createSequentialGroup()
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtchildno,
javax.swing.GroupLayout.PREFERRED_SIZE, 29,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(prateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAI
LING, false)
.addGroup(prateLayout.createSequentialGroup()
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtadultno))
.addGroup(prateLayout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboday,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(36, Short.MAX_VALUE))
);
prateLayout.setVerticalGroup(
prateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(prateLayout.createSequentialGroup()
.addContainerGap()
.addGroup(prateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE
LINE)
.addComponent(jLabel5)
.addComponent(jLabel6)
.addComponent(comboday, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(prateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEAD
ING)
.addGroup(prateLayout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(rbSuite)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(rbSingle))
.addGroup(prateLayout.createSequentialGroup()
.addGap(19, 19, 19)
.addGroup(prateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE
LINE)
.addComponent(jLabel7)
.addComponent(txtadultno,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(prateLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE
LINE)
.addComponent(rbDeluxe)
.addComponent(jLabel8)
.addComponent(txtchildno, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(27, Short.MAX_VALUE))
);
printpanel.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
btnPrint.setText("Print");
btnPrint.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnPrintActionPerformed(evt);
}
});
btnEdit.setText("Edit");
btnEdit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnEditActionPerformed(evt);
}
});
btnDelete.setText("Delete");
btnDelete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnDeleteActionPerformed(evt);
}
});

btnCheckout.setText("Check Out");
btnCheckout.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCheckoutActionPerformed(evt);
}
});
javax.swing.GroupLayout printpanelLayout = new
javax.swing.GroupLayout(printpanel);
printpanel.setLayout(printpanelLayout);
printpanelLayout.setHorizontalGroup(
printpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(printpanelLayout.createSequentialGroup()
.addContainerGap()
.addComponent(btnPrint)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnEdit)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnDelete)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCheckout)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
printpanelLayout.setVerticalGroup(
printpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(printpanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(printpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.B
ASELINE)
.addComponent(btnPrint)
.addComponent(btnEdit)
.addComponent(btnDelete)
.addComponent(btnCheckout))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
updatepanel.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0)));
btnUpdate.setText("Update");
btnUpdate.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnUpdateActionPerformed(evt);

}
});
btnCancel.setText("Cancel");
btnCancel.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnCancelActionPerformed(evt);
}
});
javax.swing.GroupLayout updatepanelLayout = new
javax.swing.GroupLayout(updatepanel);
updatepanel.setLayout(updatepanelLayout);
updatepanelLayout.setHorizontalGroup(
updatepanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING
)
.addGroup(updatepanelLayout.createSequentialGroup()
.addGap(14, 14, 14)
.addComponent(btnUpdate)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnCancel)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
updatepanelLayout.setVerticalGroup(
updatepanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING
)
.addGroup(updatepanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(updatepanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment
.BASELINE)
.addComponent(btnUpdate)
.addComponent(btnCancel))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
tbhotel.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null}
},
new String [] {

"Name", "Phone No.", "Room No.", "Room Type", "No. of days", "No. of
adults", "No. of children"
}
));
jScrollPane1.setViewportView(tbhotel);
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup()
.addGap(28, 28, 28)
.addComponent(printpanel,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 144,
Short.MAX_VALUE)
.addComponent(updatepanel,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(pguest, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(prate, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(34, 34, 34))
.addGroup(layout.createSequentialGroup()
.addComponent(jScrollPane1)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pguest, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(prate, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(printpanel, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(updatepanel,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE,
89, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(21, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void btnPrintActionPerformed(java.awt.event.ActionEvent evt) {
updatepanel.setVisible(true);
printpanel.setVisible(false);
enable1();
flag = 1;
}
private void btnEditActionPerformed(java.awt.event.ActionEvent evt) {
String x = JOptionPane.showInputDialog("Enter the room number:");
if(x.compareTo("")!=0)
{
setdata(x);
updatepanel.setVisible(true);
printpanel.setVisible(false);
flag = 2;
}
enable1();
}
private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {
try{
String query=null;
if((txtname.getText()).compareTo("")!=0 &&
(txtphone.getText()).compareTo("")!=0 && (txtroomno.getText()).compareTo("")!=0 &&
(txtadultno.getText()).compareTo("")!=0)

{
OpenConnection();
if(flag==1){
query="insert into hotel values ('" + txtname.getText() + "'," +
Integer.parseInt(txtphone.getText()) + "," + Integer.parseInt(txtroomno.getText()) + ",
'dummy',"+ comboday.getSelectedItem() +"," + Integer.parseInt(txtadultno.getText()) +
"," + Integer.parseInt(txtchildno.getText()) +");";
stmt.executeUpdate(query);
if(rbSuite.isSelected())
{query="update hotel set Roomtype='Suite' where Roomtype='dummy';";}
else if(rbSingle.isSelected())
{query="update hotel set Roomtype='Single' where Roomtype='dummy';";}
else if(rbDeluxe.isSelected())
{query="update hotel set Roomtype='Deluxe' where Roomtype='dummy';";}
}
else if(flag==2){
query="update hotel set Name='" + txtname.getText() + "', Phoneno=" +
Integer.parseInt(txtphone.getText()) + ", Roomno=" +
Integer.parseInt(txtroomno.getText()) + ",Roomtype='dummy', Noofdays="+
comboday.getSelectedItem() +", Noofadults="+ Integer.parseInt(txtadultno.getText()) + ",
Noofchildren=" + Integer.parseInt(txtchildno.getText()) + " where Roomno=" +
Integer.parseInt(txtroomno.getText()) + ";";
stmt.executeUpdate(query);
if(rbSuite.isSelected())
{query="update hotel set Roomtype='Suite' where Roomtype='dummy';";}
else if(rbSingle.isSelected())
{query="update hotel set Roomtype='Single' where Roomtype='dummy';";}
else if(rbDeluxe.isSelected())
{query="update hotel set Roomtype='Deluxe' where Roomtype='dummy';";}
}
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "Record inserted!!!");
show1();
stmt.close();
con.close();
printpanel.setVisible(true);
updatepanel.setVisible(false);
clear();
// disable1();
}
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
private void txtnameActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}

private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {


String r = JOptionPane.showInputDialog(null,"Enter the Room No.");
int x=Integer.parseInt(r);
setdata(r);
int x1=JOptionPane.showConfirmDialog(null,"Are you sure you want to delete?");
if(x1==0)
{if(x!=0)
{
try
{OpenConnection();
String query="Delete from hotel where Roomno=" +
Integer.parseInt(txtroomno.getText()) + ";";
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null,"Record deleted!!!");
show1();
clear();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
}
}
private void btnCancelActionPerformed(java.awt.event.ActionEvent evt) {
updatepanel.setVisible(false);
printpanel.setVisible(true);
disable1();
clear();
}
private void btnCheckoutActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional)
">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.

* For details see


http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(HotelManagementForm.class.getName()).log(java.uti
l.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(HotelManagementForm.class.getName()).log(java.uti
l.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(HotelManagementForm.class.getName()).log(java.uti
l.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(HotelManagementForm.class.getName()).log(java.uti
l.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new HotelManagementForm().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton btnCancel;
private javax.swing.JButton btnCheckout;
private javax.swing.JButton btnDelete;
private javax.swing.JButton btnEdit;
private javax.swing.JButton btnPrint;
private javax.swing.JButton btnUpdate;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JComboBox comboday;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;


private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JPanel pguest;
private javax.swing.JPanel prate;
private javax.swing.JPanel printpanel;
private javax.swing.JRadioButton rbDeluxe;
private javax.swing.JRadioButton rbSingle;
private javax.swing.JRadioButton rbSuite;
private javax.swing.JTable tbhotel;
private javax.swing.JTextField txtadultno;
private javax.swing.JTextField txtchildno;
private javax.swing.JTextField txtname;
private javax.swing.JTextField txtphone;
private javax.swing.JTextField txtroomno;
private javax.swing.JPanel updatepanel;
// End of variables declaration
}

Search Interface:
package jefferson;
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**
*
* @author Student
*/
public class HotelSearch extends javax.swing.JFrame {
Connection con;
Statement stmt;
DefaultTableModel model;
/**
* Creates new form HotelSearch
*/
public HotelSearch() {
initComponents();
model=(DefaultTableModel)tbhotel.getModel();
}
void OpenConnection()
{
try{
Class.forName("com.mysql.jdbc.Driver");
con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/JEFFERSON","root","");
stmt = con.createStatement();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
void show1()
{
delete();
try{
OpenConnection();
String query="select * from hotel;";
ResultSet rs=stmt.executeQuery(query);
while(rs.next())
{
String name=rs.getString("Name");
String phoneno=rs.getString("Phoneno");
String roomno=rs.getString("Roomno");
String roomtype=rs.getString("Roomtype");

String noofdays=rs.getString("Noofdays");
String noofadults=rs.getString("Noofadults");
String noofchildren=rs.getString("Noofchildren");
model.addRow(new Object[]
{name,phoneno,roomno,roomtype,noofdays,noofadults,noofchildren});
}
rs.close();
stmt.close();
con.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
void delete()
{
int rows=model.getRowCount();
if(rows>0){
for(int i=0;i<rows;i++)
{
model.removeRow(0);
}
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
combo1 = new javax.swing.JComboBox();
txtvalue = new javax.swing.JTextField();
btnSearch = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane();
tbhotel = new javax.swing.JTable();
jLabel4 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jPanel1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jPanel1.setEnabled(false);

jPanel1.setPreferredSize(new java.awt.Dimension(522, 200));


jPanel1.setLayout(null);
jLabel2.setBackground(new java.awt.Color(0, 0, 0));
jLabel2.setFont(new java.awt.Font("Wide Latin", 3, 10)); // NOI18N
jLabel2.setText("Enter field name:");
jPanel1.add(jLabel2);
jLabel2.setBounds(30, 100, 161, 28);
jLabel3.setBackground(new java.awt.Color(0, 0, 0));
jLabel3.setFont(new java.awt.Font("Wide Latin", 3, 10)); // NOI18N
jLabel3.setText("Enter value:");
jPanel1.add(jLabel3);
jLabel3.setBounds(40, 150, 115, 20);
combo1.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N
combo1.setModel(new javax.swing.DefaultComboBoxModel(new String[]
{ "Name", "Phoneno", "Roomno", "Roomtype", "Noofdays", "Noofadults",
"Noofchildren" }));
combo1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
combo1ActionPerformed(evt);
}
});
jPanel1.add(combo1);
combo1.setBounds(220, 100, 102, 23);
jPanel1.add(txtvalue);
txtvalue.setBounds(220, 140, 330, 30);
btnSearch.setText("Search");
btnSearch.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnSearchActionPerformed(evt);
}
});
jPanel1.add(btnSearch);
btnSearch.setBounds(225, 190, 130, 23);
tbhotel.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null}
},
new String [] {
"Name", "Phone No.", "Room No.", "Room Type", "No. of days", "No. of
adults", "No. of children"
}

));
jScrollPane1.setViewportView(tbhotel);
jPanel1.add(jScrollPane1);
jScrollPane1.setBounds(30, 230, 590, 91);
jLabel4.setBackground(new java.awt.Color(0, 102, 0));
jLabel4.setFont(new java.awt.Font("Vivaldi", 1, 36)); // NOI18N
jLabel4.setForeground(new java.awt.Color(0, 102, 51));
jLabel4.setText("Search Interface");
jPanel1.add(jLabel4);
jLabel4.setBounds(200, 40, 257, 45);
jLabel1.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Student\\Desktop\\background\\003-wood-melaminesubttle-pattern-background-pat.jpg")); // NOI18N
jPanel1.add(jLabel1);
jLabel1.setBounds(0, -30, 640, 400);
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 640,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 340,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void combo1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) {
String x = txtvalue.getText();
String x1=(String)combo1.getSelectedItem();
OpenConnection();
try{
String query=null;
if(x.compareTo("")!=0)

{
query="select * from hotel where "+combo1.getSelectedItem()
+"='"+txtvalue.getText()+"';";
delete();
ResultSet rs=stmt.executeQuery(query);
while(rs.next())
{
String name=rs.getString("Name");
String phoneno=rs.getString("Phoneno");
String roomno=rs.getString("Roomno");
String roomtype=rs.getString("Roomtype");
String noofdays=rs.getString("Noofdays");
String noofadults=rs.getString("Noofadults");
String noofchildren=rs.getString("Noofchildren");
model.addRow(new Object[]
{name,phoneno,roomno,roomtype,noofdays,noofadults,noofchildren});
}
}
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional)
">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}

} catch (ClassNotFoundException ex) {


java.util.logging.Logger.getLogger(HotelSearch.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(HotelSearch.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(HotelSearch.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(HotelSearch.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new HotelSearch().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton btnSearch;
private javax.swing.JComboBox combo1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tbhotel;
private javax.swing.JTextField txtvalue;
// End of variables declaration
}
Display Interface:
package jefferson;
import java.sql.*;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
/**

*
* @author Student
*/
public class HotelDisplay extends javax.swing.JFrame {
Connection con;
Statement stmt;
DefaultTableModel model;
/**
* Creates new form HotelDisplay
*/
public HotelDisplay() {
initComponents();
model=(DefaultTableModel)tbhotel.getModel();
}
void OpenConnection()
{
try{
Class.forName("com.mysql.jdbc.Driver");
con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/JEFFERSON","root","");
stmt = con.createStatement();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
void show1()
{
delete();
try{
OpenConnection();
String query="select * from hotel;";
ResultSet rs=stmt.executeQuery(query);
while(rs.next())
{
String name=rs.getString("Name");
String phoneno=rs.getString("Phoneno");
String roomno=rs.getString("Roomno");
String roomtype=rs.getString("Roomtype");
String noofdays=rs.getString("Noofdays");
String noofadults=rs.getString("Noofadults");
String noofchildren=rs.getString("Noofchildren");
model.addRow(new Object[]
{name,phoneno,roomno,roomtype,noofdays,noofadults,noofchildren});
}
rs.close();

stmt.close();
con.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
void delete()
{
int rows=model.getRowCount();
if(rows>0){
for(int i=0;i<rows;i++)
{
model.removeRow(0);
}
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jScrollPane1 = new javax.swing.JScrollPane();
tbhotel = new javax.swing.JTable();
btnDisplay = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
tbhotel.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null},
{null, null, null, null, null, null, null}
},
new String [] {
"Name", "Phone No.", "Room No.", "Room Type", "No. of days", "No. of
adults", "No. of children"
}
));
jScrollPane1.setViewportView(tbhotel);
btnDisplay.setBackground(new java.awt.Color(255, 153, 153));
btnDisplay.setFont(new java.awt.Font("Comic Sans MS", 1, 24)); // NOI18N

btnDisplay.setForeground(new java.awt.Color(153, 0, 0));


btnDisplay.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Student\\Desktop\\001+background+pattern+designs.
jpg")); // NOI18N
btnDisplay.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
btnDisplay.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnDisplayActionPerformed(evt);
}
});
jLabel1.setIcon(new
javax.swing.ImageIcon("C:\\Users\\Student\\Desktop\\background\\lobby.jpg")); //
NOI18N
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(btnDisplay,
javax.swing.GroupLayout.PREFERRED_SIZE, 328,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel1))
.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 621,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 9, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE,
92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(47, 47, 47)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnDisplay, javax.swing.GroupLayout.PREFERRED_SIZE,
0, Short.MAX_VALUE))

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void btnDisplayActionPerformed(java.awt.event.ActionEvent evt) {
show1();
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional)
">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(HotelDisplay.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(HotelDisplay.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(HotelDisplay.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(HotelDisplay.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
}
//</editor-fold>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new HotelDisplay().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton btnDisplay;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable tbhotel;
// End of variables declaration
}
Main Menu:
package jefferson;
/**
*
* @author Student
*/
public class HotelMain extends javax.swing.JFrame {
HotelManagementForm hm1 = new HotelManagementForm();
HotelSearch hs1 = new HotelSearch();
HotelDisplay hd1 = new HotelDisplay();
/**
* Creates new form HotelMain
*/
public HotelMain() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jMenu1 = new javax.swing.JMenu();
jLabel1 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu2 = new javax.swing.JMenu();

jMenuItem1 = new javax.swing.JMenuItem();


jMenuItem2 = new javax.swing.JMenuItem();
jMenuItem3 = new javax.swing.JMenuItem();
jMenu1.setText("jMenu1");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/jefferson/newpackage/hotel.jpg"))); //
NOI18N
jMenu2.setText("Hotel");
jMenuItem1.setText("Entry Form");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem1);
jMenuItem2.setText("Search");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem2);
jMenuItem3.setText("View");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem3);
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
);

layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
hm1.show();
}
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
hs1.show();
}
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {
hd1.show();
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional)
">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look
and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(HotelMain.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(HotelMain.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);

} catch (IllegalAccessException ex) {


java.util.logging.Logger.getLogger(HotelMain.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(HotelMain.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new HotelMain().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel jLabel1;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
// End of variables declaration
}
*******

REPORT
7.1 Input forms ::
Main Menu:

Hotel Management(Entry) Form:

Search Interface:

Display Interface:

***

Você também pode gostar