Hotel Management System
Hotel Management System
DEC, 2021
Prakash Singh
Saurabh Vishwakarma
Front Page
Source Code Of Front Page
import com.sun.org.apache.xerces.internal.util.DOMUtil;
import java.awt.SplashScreen;
import javax.swing.JOptionPane;
/*
*/
/**
* @author ASUS
*/
*/
public Front() {
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
*/
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Welcome Page");
setUndecorated(true);
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(530, 80, 670, 50));
getContentPane().add(jLabel7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(700, 210, 350, 30));
LoadingValue.setText("0 %");
getContentPane().add(LoadingValue, new
org.netbeans.lib.awtextra.AbsoluteConstraints(1560, 710, 70, 50));
LoadingLabel1.setText("Loading.....");
getContentPane().add(LoadingLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(40, 700, 500, 30));
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(780, 240, 200, 30));
jLabel1.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/Front1.jpg"))); // NOI18N
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(10, -10, 1620, 760));
getContentPane().add(LoadingBar, new
org.netbeans.lib.awtextra.AbsoluteConstraints(10, 750, 1620, 30));
pack();
setLocationRelativeTo(null);
}// </editor-fold>
/**
*/
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(Front.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Front.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Front.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
//</editor-fold>
//</editor-fold>
sp.setVisible(true);
try {
for(int i=0;i<=100;i++) {
Thread.sleep(100);
sp.LoadingValue.setText(i +"%");
if(i==10) {
sp.LoadingLabel1.setText("Loading Modules..");
if(i==20) {
sp.LoadingLabel1.setText("Loading Module......");
if(i==50) {
if(i==70) {
sp.LoadingLabel1.setText("Connection Successfull..");
if(i==80) {
sp.LoadingLabel1.setText("Launching Application......");
sp.LoadingBar.setValue(i);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, e);
}
sp.setVisible(false);
obj.setVisible(true);
}
Login Page
Source Code Of Login Page
/*
*/
/**
* @author ASUS
*/
import javax.swing.*;
import java.sql.*;
*/
if (cn==null) {
try {
url = "jdbc:mysql://localhost:3306/hotel";
user = "root";
password = "root";
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
cn = DriverManager.getConnection(url,user,password);
//JOptionPane.showMessageDialog(null,"Connection Successfuly");
} catch (Exception e) {
}
}
return cn;
public Login() {
initComponents();
// setBounds(380,180,1200,700);
Login.getConn();
/**
* 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
*/
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Login Page");
setUndecorated(true);
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel3.setText("Username");
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(30, 260, 160, 40));
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 36)); // NOI18N
jLabel2.setText("Login");
getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(180, 160, 180, 50));
jLabel4.setText("Password");
getContentPane().add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(30, 330, 150, 50));
jTextField1.addActionListener(new java.awt.event.ActionListener() {
jTextField1ActionPerformed(evt);
});
getContentPane().add(jTextField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(250, 260, 260, 40));
jButton1.setText("Login");
jButton1.addActionListener(new java.awt.event.ActionListener() {
jButton1ActionPerformed(evt);
});
getContentPane().add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(80, 420, -1, -1));
jButton2.setText("Cancel");
jButton2.addActionListener(new java.awt.event.ActionListener() {
jButton2ActionPerformed(evt);
}
});
getContentPane().add(jButton2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(250, 420, -1, -1));
getContentPane().add(jLabel5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(220, 0, 700, 70));
jLabel1.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/LoginMain.jpg"))); //
NOI18N
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1010, 740));
pack();
}// </editor-fold>
//System.exit(0);
dispose();
try{
Connection c = Login.getConn();
Statement s = c.createStatement();
ResultSet r = s.executeQuery(sql);
if(r.next()){
this.dispose();
menu.setVisible(true);
}
else{
JOptionPane.showMessageDialog(rootPane,"Invalid Username or
Password","",JOptionPane.WARNING_MESSAGE);
}catch(SQLException e){
JOptionPane.showMessageDialog(rootPane, e);
/**
*/
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Lev
el.SEVERE, null, ex);
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
new Login().setVisible(true);
});
}
MainMenu
Source Code of MainMenu
/*
*/
/**
* @author ASUS
*/
/**
public MainMenu() {
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
*/
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("MainMenu");
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/Hotel_Animated2.jpg")));
// NOI18N
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, -10, 1920, 970));
jMenuBar1.setCursor(new
java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jMenuBar1.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION
);
jMenu1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jMenuItem4.setText("RECEPTION");
jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
jMenuItem4ActionPerformed(evt);
});
jMenu1.add(jMenuItem4);
jMenuItem7.setText("CUSTOMER_LIST");
jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
jMenuItem7ActionPerformed(evt);
});
jMenu1.add(jMenuItem7);
jMenuBar1.add(jMenu1);
jMenu2.setText("ADMIN");
jMenu2.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
jMenuItem1.setText("LOGOUT");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
jMenuItem1ActionPerformed(evt);
});
jMenu2.add(jMenuItem1);
jMenuItem2.setText("ADD EMPLOYEE");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
jMenuItem2ActionPerformed(evt);
}
});
jMenu2.add(jMenuItem2);
jMenuItem3.setText("ADD ROOMS");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
jMenuItem3ActionPerformed(evt);
});
jMenu2.add(jMenuItem3);
jMenuItem5.setText("All_Employee");
jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
jMenuItem5ActionPerformed(evt);
});
jMenu2.add(jMenuItem5);
jMenuItem6.addActionListener(new java.awt.event.ActionListener() {
jMenuItem6ActionPerformed(evt);
});
jMenu2.add(jMenuItem6);
jMenuBar1.add(jMenu2);
jMenu2.getAccessibleContext().setAccessibleDescription("");
setJMenuBar(jMenuBar1);
pack();
}// </editor-fold>
System.exit(0);
}
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
obj1.setVisible(true);
obj3.setVisible(true);
obj4.setVisible(true);
obj5.setVisible(true);
obj6.setVisible(true);
obj7.setVisible(true);
}
/**
*/
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(MainMenu.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new MainMenu().setVisible(true);
}
});
}
Reception Page
Reception Page Source Code
/*
*/
/**
* @author ASUS
*/
/**
*/
public Reception() {
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
*/
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Reception");
jButton1.setText("Check In");
jButton1.addActionListener(new java.awt.event.ActionListener() {
jButton1ActionPerformed(evt);
});
getContentPane().add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(630, 540, 170, 60));
jButton2.setText("Check Out");
jButton2.addActionListener(new java.awt.event.ActionListener() {
jButton2ActionPerformed(evt);
}
});
getContentPane().add(jButton2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(860, 540, 170, 60));
jLabel3.setText("Reception");
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(160, 20, 250, -1));
jLabel1.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/Receptio_Page1.jpg")));
// NOI18N
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1780, 1040));
pack();
}// </editor-fold>
obj.setVisible(true);
}
obj2.setVisible(true);
/**
*/
*/
try {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(Reception.class.getName()).log(java.util.logging
.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Reception.class.getName()).log(java.util.logging
.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Reception.class.getName()).log(java.util.logging
.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Reception.class.getName()).log(java.util.logging
.Level.SEVERE, null, ex);
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
new Reception().setVisible(true);
});
}
Check_In
Check_In Page Source Code
import com.sun.org.apache.bcel.internal.generic.Select;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.sql.*;
import javax.swing.*;
import net.proteanit.sql.DbUtils;
/*
*/
/**
* @author ASUS
*/
/**
*/
public CheckIn() {
initComponents();
DisplayTable();
jTextField5.setEditable(false);
load();
Calendar cal=Calendar.getInstance();
jTextField5.setText(myFormat.format(cal.getTime()));
//For Remaining
public void load()
try
Class.forName("com.mysql.jdbc.Driver");
Connection
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/hotel","root","
root");
Statement st=conn.createStatement();
jComboBox3.removeAllItems();
while(rs.next())
jComboBox3.addItem(rs.getString("RoomNo"));
conn.close();
}
catch(Exception e)
JOptionPane.showMessageDialog(null, e);
System.exit(0);
try
Class.forName("com.mysql.jdbc.Driver");
Connection
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/hotel","root","
root");
PreparedStatement ps=conn.prepareStatement(sql);
ResultSet rs=ps.executeQuery();
t1.setModel(DbUtils.resultSetToTableModel(rs));
}
catch(ClassNotFoundException | SQLException e)
JOptionPane.showMessageDialog(null, e);
/**
* 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
*/
@SuppressWarnings("unchecked")
t1 = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setText("Room_No");
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 165, 109, -1));
jLabel2.setText("Name");
getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 230, 109, -1));
jLabel3.setText("Aadhar No");
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 289, -1, -1));
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel4.setText("Mob");
getContentPane().add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 350, -1, -1));
jLabel5.setText("Gender");
getContentPane().add(jLabel5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 483, -1, -1));
jLabel6.setText("CheckIn Date");
getContentPane().add(jLabel6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 533, -1, -1));
jLabel7.setText("CheckOut Date");
getContentPane().add(jLabel7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 600, -1, -1));
getContentPane().add(jTextField2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(444, 224, 271, -1));
jTextField3.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
getContentPane().add(jTextField3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(444, 283, 271, -1));
getContentPane().add(jTextField4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(444, 344, 271, -1));
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new
String[] { "Male", "Female" }));
getContentPane().add(jComboBox1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(444, 480, 116, -1));
getContentPane().add(jTextField5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(444, 530, 266, -1));
jTextField6.addActionListener(new java.awt.event.ActionListener() {
jTextField6ActionPerformed(evt);
}
});
getContentPane().add(jTextField6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(440, 600, 261, -1));
jButton1.setText("Allot");
jButton1.addActionListener(new java.awt.event.ActionListener() {
jButton1ActionPerformed(evt);
});
getContentPane().add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(429, 730, -1, -1));
jButton2.setText("Cancel");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
});
getContentPane().add(jButton2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(591, 730, -1, -1));
jButton3.setText("Update");
jButton3.addActionListener(new java.awt.event.ActionListener() {
jButton3ActionPerformed(evt);
});
getContentPane().add(jButton3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(610, 158, -1, 28));
jLabel8.setText("Bed");
getContentPane().add(jLabel8, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 430, -1, -1));
jComboBox2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new
String[] { "Single", "Double" }));
jComboBox2.addActionListener(new java.awt.event.ActionListener() {
jComboBox2ActionPerformed(evt);
});
getContentPane().add(jComboBox2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(444, 427, -1, -1));
jLabel9.setText("Price");
getContentPane().add(jLabel9, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 663, 71, -1));
getContentPane().add(jTextField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(444, 660, 150, -1));
t1.setModel(new javax.swing.table.DefaultTableModel(
},
new String [] {
));
jScrollPane1.setViewportView(t1);
getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(849, 91, 505, 402));
jLabel10.setText("Customer_ID");
getContentPane().add(jLabel10, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 94, -1, -1));
getContentPane().add(jTextField7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(444, 91, 105, -1));
jLabel12.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/Checkin_Back.jpg"))); //
NOI18N
jLabel12.setText("jLabel12");
getContentPane().add(jLabel12, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1520, 850));
pack();
}// </editor-fold>
try
Class.forName("com.mysql.jdbc.Driver");
Connection
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/hotel","root","
root");
PreparedStatement pstmt=conn.prepareStatement(sql);
//Room No
//pstmt.setInt(1,Integer.parseInt(jTextField7.getText()));
//from JComboBox
String RoomNo;
RoomNo=jComboBox3.getSelectedItem().toString();
pstmt.setString(1, RoomNo);
//Name
pstmt.setString(2, jTextField2.getText());
//Aadhaar
pstmt.setString(3, jTextField3.getText());
//Mobile
pstmt.setString(4, jTextField4.getText());
//Bed Type
String bed;
bed=jComboBox2.getSelectedItem().toString();
pstmt.setString(5, bed);
//Gender
String Gen;
Gen=jComboBox1.getSelectedItem().toString();
pstmt.setString(6, Gen);
//CheckIn Date
pstmt.setString(7, jTextField5.getText());
//CheckOut Date
pstmt.setString(8, jTextField6.getText());
//Price
pstmt.setInt(9,Integer.parseInt(jTextField1.getText()));
//CustomerID
pstmt.setInt(10,Integer.parseInt(jTextField7.getText()));
//Executing Queries
pstmt.executeUpdate();
JOptionPane.showMessageDialog(null,"Insertion Successfuly");
conn.close();
}
catch(Exception e)
JOptionPane.showMessageDialog(null, e);
//System.exit(0);
dispose();
try
Class.forName("com.mysql.jdbc.Driver");
Connection
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/hotel","root","
root");
String sql="update addrooms set Status='Booked' where RoomNo=? ";
PreparedStatement pstmt=conn.prepareStatement(sql);
String RoomNo;
RoomNo=jComboBox3.getSelectedItem().toString();
pstmt.setString(1, RoomNo);
pstmt.executeUpdate();
conn.close();
catch(Exception e)
/**
* @param args the command line arguments
*/
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(CheckIn.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
java.util.logging.Logger.getLogger(CheckIn.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
java.util.logging.Logger.getLogger(CheckIn.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new CheckIn().setVisible(true);
});
Check_Out
Check_Out Page Source Code
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
import java.sql.*;
import java.util.Date;
import javax.swing.*;
/*
/**
* @author ASUS
*/
/**
*/
public CheckOut() {
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
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setText("Customer_ID");
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 120, 141, 25));
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel2.setText("Room_No");
getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 220, -1, -1));
jLabel3.setText("Name");
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 290, -1, -1));
jLabel4.setText("Aadhaar_No");
getContentPane().add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 370, -1, -1));
jLabel5.setText("Mobile_No");
getContentPane().add(jLabel5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 440, -1, -1));
jLabel6.setText("Bed");
getContentPane().add(jLabel6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 510, -1, -1));
jLabel7.setText("Gender");
getContentPane().add(jLabel7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 590, -1, -1));
jTextField1.addActionListener(new java.awt.event.ActionListener() {
jTextField1ActionPerformed(evt);
});
getContentPane().add(jTextField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(490, 120, 102, -1));
getContentPane().add(jTextField2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(490, 220, 278, -1));
getContentPane().add(jTextField4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(490, 370, 278, -1));
getContentPane().add(jTextField5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(490, 440, 278, -1));
getContentPane().add(jTextField6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(490, 510, 278, -1));
getContentPane().add(jTextField7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(490, 590, 278, -1));
jLabel8.setText("Check_In");
getContentPane().add(jLabel8, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 670, 100, -1));
jLabel9.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel9.setText("Check_Out");
getContentPane().add(jLabel9, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 740, 112, -1));
jLabel10.setText("Price");
getContentPane().add(jLabel10, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 860, 67, 27));
getContentPane().add(jTextField8, new
org.netbeans.lib.awtextra.AbsoluteConstraints(490, 660, 278, -1));
getContentPane().add(jTextField9, new
org.netbeans.lib.awtextra.AbsoluteConstraints(490, 730, 278, -1));
getContentPane().add(jTextField10, new
org.netbeans.lib.awtextra.AbsoluteConstraints(490, 860, 150, -1));
jButton1.setText("Search");
jButton1.addActionListener(new java.awt.event.ActionListener() {
jButton1ActionPerformed(evt);
});
getContentPane().add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(630, 120, -1, -1));
jButton2.setText("Generate Receipt");
jButton2.addActionListener(new java.awt.event.ActionListener() {
jButton2ActionPerformed(evt);
});
getContentPane().add(jButton2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(200, 920, -1, -1));
jButton3.setBackground(new java.awt.Color(102, 0, 0));
jButton3.setText("Print Pdf");
jButton3.addActionListener(new java.awt.event.ActionListener() {
jButton3ActionPerformed(evt);
});
getContentPane().add(jButton3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(450, 920, -1, -1));
jButton4.setText("Clear");
jButton4.addActionListener(new java.awt.event.ActionListener() {
jButton4ActionPerformed(evt);
});
getContentPane().add(jButton4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(620, 920, -1, -1));
area.setColumns(20);
area.setRows(5);
jScrollPane1.setViewportView(area);
getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(870, 20, 510, 430));
jButton5.setText("Update");
jButton5.addActionListener(new java.awt.event.ActionListener() {
jButton5ActionPerformed(evt);
});
getContentPane().add(jButton5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(750, 120, -1, -1));
jTextField11.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
getContentPane().add(jTextField11, new
org.netbeans.lib.awtextra.AbsoluteConstraints(490, 790, 110, -1));
jLabel12.setText("Days");
getContentPane().add(jLabel12, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 800, -1, -1));
jLabel11.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/Checkin_Back.jpg"))); //
NOI18N
getContentPane().add(jLabel11, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1590, 1020));
pack();
}// </editor-fold>
try
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/hotel", "root",
"root");
st.setString(1,jTextField1.getText());
//execute Query
ResultSet rs=st.executeQuery();
if(rs.next())
jTextField2.setText(rs.getString(1));
jTextField3.setText(rs.getString(2));
jTextField4.setText(rs.getString(3));
jTextField5.setText(rs.getString(4));
jTextField6.setText(rs.getString(5));
jTextField7.setText(rs.getString(6));
jTextField8.setText(rs.getString(7));
jTextField9.setText(rs.getString(8));
jTextField10.setText(rs.getString(9));
else
jTextField1.setText("");
catch(Exception e)
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
//Printing Pdf
try
area.print();
catch(Exception e)
//Calculating Price:
try
{
int days=Integer.parseInt(jTextField11.getText());
int price=Integer.parseInt(jTextField10.getText());
total=days*price;
String total1=String.valueOf(total);
jTextField10.setText(total1);
catch(Exception e)
//Generating PDF
area.setText("*******************************************************
*\n");
area.setText(area.getText()+"******************************************\
n");
String Date=obj.toString();
area.setText(area.getText()+"\n"+Date+"\n\n");
area.setText(area.getText()+"\n Signature\n");
area.setText(area.getText()+"******************************************\
n");
area.setText("");
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
jTextField4.setText("");
jTextField5.setText("");
jTextField6.setText("");
jTextField7.setText("");
jTextField8.setText("");
jTextField9.setText("");
jTextField10.setText("");
jTextField11.setText("");
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/hotel","root","
root");
PreparedStatement pstmt=conn.prepareStatement(sql);
pstmt.setInt(1,Integer.parseInt(jTextField2.getText()));
// String RoomNo;
// RoomNo=jComboBox3.getSelectedItem().toString();
// pstmt.setString(1, RoomNo);
pstmt.executeUpdate();
conn.close();
}
catch(Exception e)
/**
*/
*/
try {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(CheckOut.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(CheckOut.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(CheckOut.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(CheckOut.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
new CheckOut().setVisible(true);
});
}
Customer List
Customer List Source Code
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.swing.JOptionPane;
import net.proteanit.sql.DbUtils;
/*
*/
/**
*
* @author ASUS
*/
/**
*/
public CustomerList() {
initComponents();
DisplayTable();
try
Class.forName("com.mysql.jdbc.Driver");
Connection
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/hotel","root","
root");
PreparedStatement ps=conn.prepareStatement(sql);
ResultSet rs=ps.executeQuery();
t1.setModel(DbUtils.resultSetToTableModel(rs));
catch(ClassNotFoundException | SQLException e)
JOptionPane.showMessageDialog(null, e);
/**
* 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
*/
@SuppressWarnings("unchecked")
t1 = new javax.swing.JTable();
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
t1.setModel(new javax.swing.table.DefaultTableModel(
},
new String [] {
));
jScrollPane1.setViewportView(t1);
getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(60, 90, 1380, 562));
jLabel1.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/Checkin_Back.jpg"))); //
NOI18N
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, -170, 1590, 1010));
pack();
}// </editor-fold>
/**
*/
*/
try {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(CustomerList.class.getName()).log(java.util.logg
ing.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(CustomerList.class.getName()).log(java.util.logg
ing.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(CustomerList.class.getName()).log(java.util.logg
ing.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(CustomerList.class.getName()).log(java.util.logg
ing.Level.SEVERE, null, ex);
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
new CustomerList().setVisible(true);
});
}
AddEmployee
AddEmployee Page Source Code
/*
*/
import java.sql.*;
import javax.swing.*;
/**
* @author ASUS
*/
/**
* Creates new form EmployeeAdd
*/
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
jTextField4.setText("");
jTextField5.setText("");
public EmployeeAdd() {
initComponents();
setLocation(300, 100);
/**
* 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
*/
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel2.setText("Name");
getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(40, 50, -1, -1));
jLabel4.setText("Gender");
getContentPane().add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(40, 130, -1, -1));
jLabel5.setText("Job");
getContentPane().add(jLabel5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(50, 210, -1, -1));
jTextField1.addActionListener(new java.awt.event.ActionListener() {
jTextField1ActionPerformed(evt);
}
});
getContentPane().add(jTextField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 50, 340, 40));
jLabel1.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/waiter.png"))); //
NOI18N
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(590, 0, 440, 570));
jLabel6.setText("Salary");
getContentPane().add(jLabel6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(40, 280, -1, -1));
jLabel7.setText("Id");
getContentPane().add(jLabel7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(50, 360, 50, -1));
getContentPane().add(jTextField3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 200, 340, 40));
jTextField4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jTextField4.addActionListener(new java.awt.event.ActionListener() {
jTextField4ActionPerformed(evt);
});
getContentPane().add(jTextField4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 280, 340, 40));
jButton1.setText("ADD");
jButton1.setToolTipText("Add Data");
jButton1.addActionListener(new java.awt.event.ActionListener() {
jButton1ActionPerformed(evt);
});
getContentPane().add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 460, 90, 40));
jTextField5.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jTextField5.addActionListener(new java.awt.event.ActionListener() {
jTextField5ActionPerformed(evt);
});
getContentPane().add(jTextField5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 360, 340, 40));
jButton2.setText("CANCEL");
jButton2.addActionListener(new java.awt.event.ActionListener() {
jButton2ActionPerformed(evt);
});
getContentPane().add(jButton2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(400, 460, 100, 40));
jTextField2.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
getContentPane().add(jTextField2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(240, 120, 340, 50));
jLabel8.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/White
background.jpg"))); // NOI18N
getContentPane().add(jLabel8, new
org.netbeans.lib.awtextra.AbsoluteConstraints(4, 0, 1030, 560));
pack();
}// </editor-fold>
try {
Class.forName("com.mysql.jdbc.Driver");
// establish connection
statement.close();
con.close();
Referesh();
/*
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
jTextField4.setText("");
*/
} catch (SQLException | ClassNotFoundException e) {
JOptionPane.showMessageDialog(null, e);
//System.exit(0);
dispose();
/**
*/
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(EmployeeAdd.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(EmployeeAdd.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(EmployeeAdd.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(EmployeeAdd.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new EmployeeAdd().setVisible(true);
});
}
AddRooms Page
Source Code of AddRooms
import javax.swing.JOptionPane;
import java.sql.*;
import javax.swing.*;
import net.proteanit.sql.DbUtils;
/*
*/
/**
* @author ASUS
*/
*/
public RoomsAdd() {
initComponents();
DisplayTable();
//Start
try
Class.forName("com.mysql.jdbc.Driver");
Connection
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/hotel","root","
root");
ResultSet rs=ps.executeQuery();
t1.setModel(DbUtils.resultSetToTableModel(rs));
catch(ClassNotFoundException | SQLException e)
JOptionPane.showMessageDialog(null, e);
//End
/**
* 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
*/
@SuppressWarnings("unchecked")
t1 = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Add_Rooms");
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel1.setText("Room no");
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(110, 110, 100, 40));
jLabel2.setText("Status");
getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(110, 180, 110, 30));
jLabel4.setText("Price");
getContentPane().add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(110, 360, 80, -1));
jLabel5.setText("Bed Type");
getContentPane().add(jLabel5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(110, 250, 110, 40));
jTextField1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
getContentPane().add(jTextField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(310, 110, 240, 30));
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new
String[] { "Booked", "UnBooked" }));
jComboBox1.addActionListener(new java.awt.event.ActionListener() {
jComboBox1ActionPerformed(evt);
});
getContentPane().add(jComboBox1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(310, 180, 110, 40));
jTextField2.addActionListener(new java.awt.event.ActionListener() {
jTextField2ActionPerformed(evt);
});
getContentPane().add(jTextField2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(310, 360, 230, 30));
jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new
String[] { "Single", "Double" }));
getContentPane().add(jComboBox3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(310, 260, 170, 40));
jButton2.setText("CANCEL");
jButton2.addActionListener(new java.awt.event.ActionListener() {
jButton2ActionPerformed(evt);
});
getContentPane().add(jButton2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(340, 460, 140, 40));
jButton1.setText("ADD");
jButton1.addActionListener(new java.awt.event.ActionListener() {
jButton1ActionPerformed(evt);
});
getContentPane().add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(110, 460, 130, 40));
t1.setModel(new javax.swing.table.DefaultTableModel(
},
new String [] {
));
jScrollPane1.setViewportView(t1);
getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(570, 110, 650, 330));
jLabel6.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/Bed_img
Animated.jpg"))); // NOI18N
getContentPane().add(jLabel6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(10, 0, 1780, 1020));
pack();
}// </editor-fold>
//System.exit(0);
dispose();
}
private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {
//coding Started
try
Class.forName("com.mysql.jdbc.Driver");
Connection
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/hotel","root","
root");
PreparedStatement pstmt=conn.prepareStatement(sql);
//pstmt.setInt(1,Integer.parseInt(jTextField1.getText()));
//For Adding Rooms
pstmt.setString(1, jTextField1.getText());
String status;
status=jComboBox1.getSelectedItem().toString();
pstmt.setString(2, status);
String Bed_Type;
Bed_Type=jComboBox3.getSelectedItem().toString();
pstmt.setString(3, Bed_Type);
pstmt.setInt(4,Integer.parseInt(jTextField2.getText()));
//Execute Here
pstmt.executeUpdate();
JOptionPane.showMessageDialog(null,"Insertion Successfuly");
conn.close();
catch(Exception e)
JOptionPane.showMessageDialog(null, e);
}
//Ended
/**
*/
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
java.util.logging.Logger.getLogger(RoomsAdd.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(RoomsAdd.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(RoomsAdd.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(RoomsAdd.class.getName()).log(java.util.loggin
g.Level.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
});
}
All_Employee Page
Source Code Of All_Employee
/*
*/
/**
* @author ASUS
*/
import java.sql.DriverManager;
import net.proteanit.sql.DbUtils;
import javax.swing.*;
import java.sql.*;
*/
public All_Employee() {
initComponents();
DisplayTable();
try
Class.forName("com.mysql.jdbc.Driver");
Connection
conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/hotel","root","
root");
PreparedStatement ps=conn.prepareStatement(sql);
ResultSet rs=ps.executeQuery();
t1.setModel(DbUtils.resultSetToTableModel(rs));
}
catch(ClassNotFoundException | SQLException e)
JOptionPane.showMessageDialog(null, e);
/**
* 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
*/
@SuppressWarnings("unchecked")
t1 = new javax.swing.JTable();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
t1.setModel(new javax.swing.table.DefaultTableModel(
},
new String [] {
));
jScrollPane1.setViewportView(t1);
getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(90, 90, 1099, 612));
jLabel1.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/Checkin_Back.jpg"))); //
NOI18N
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(-10, 0, 1290, 770));
pack();
}// </editor-fold>
/**
*/
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(All_Employee.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(All_Employee.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(All_Employee.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(All_Employee.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new All_Employee().setVisible(true);
});
}
Search_Employee Page
Source Code Of Search_Employee
/*
*/
/**
* @author ASUS
*/
import java.sql.*;
import javax.swing.*;
/**
* Creates new form Search_Employee
*/
public Search_Employee() {
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
*/
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle("Search_Employee");
setUndecorated(true);
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel2.setText(" Name");
getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 230, 90, 30));
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel1.setText("Enter Name");
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(110, 70, 170, 30));
jLabel3.setText("Gender");
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(140, 300, -1, -1));
jLabel4.setText("Job");
getContentPane().add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(160, 360, -1, -1));
jLabel5.setText("Salary");
getContentPane().add(jLabel5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(150, 430, -1, -1));
jLabel6.setText("Id");
getContentPane().add(jLabel6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(170, 500, -1, -1));
jTextField1.addActionListener(new java.awt.event.ActionListener() {
jTextField1ActionPerformed(evt);
});
getContentPane().add(jTextField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(320, 70, 310, 40));
getContentPane().add(jTextField2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(320, 240, 360, -1));
getContentPane().add(jTextField3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(320, 300, 360, -1));
getContentPane().add(jTextField4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(320, 360, 360, -1));
jTextField5.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
getContentPane().add(jTextField5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(320, 430, 360, -1));
jTextField6.addActionListener(new java.awt.event.ActionListener() {
jTextField6ActionPerformed(evt);
});
getContentPane().add(jTextField6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(320, 500, 360, -1));
jButton1.setText("Search");
jButton1.addActionListener(new java.awt.event.ActionListener() {
jButton1ActionPerformed(evt);
}
});
getContentPane().add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(350, 150, -1, -1));
jLabel7.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/search.png"))); //
NOI18N
getContentPane().add(jLabel7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(590, 40, 420, 640));
jButton2.setText("Exit");
jButton2.addActionListener(new java.awt.event.ActionListener() {
jButton2ActionPerformed(evt);
});
getContentPane().add(jButton2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(510, 580, 120, 40));
jButton3.setText("Delete");
jButton3.addActionListener(new java.awt.event.ActionListener() {
jButton3ActionPerformed(evt);
});
getContentPane().add(jButton3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(350, 580, 110, 40));
jLabel8.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/images/White
background.jpg"))); // NOI18N
getContentPane().add(jLabel8, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1020, 680));
pack();
}// </editor-fold>
}
private void jTextField6ActionPerformed(java.awt.event.ActionEvent evt) {
try
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/hotel", "root",
"root");
st.setString(1,jTextField1.getText());
//execute Query
ResultSet rs=st.executeQuery();
if(rs.next())
{
jTextField2.setText(rs.getString(1));
jTextField3.setText(rs.getString(2));
jTextField4.setText(rs.getString(3));
jTextField5.setText(rs.getString(4));
jTextField6.setText(rs.getString(5));
else
jTextField1.setText("");
catch(Exception e)
}
}
// System.exit(0);
dispose();
try
Class.forName("com.mysql.jdbc.Driver");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost/hotel", "root",
"root");
st.setString(1,jTextField1.getText());
//execute Query
st.executeUpdate();
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
jTextField4.setText("");
jTextField5.setText("");
jTextField6.setText("");
con.close();
//Catch Started
catch(Exception e1)
}
}
/**
*/
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
java.util.logging.Logger.getLogger(Search_Employee.class.getName()).log(java.util
.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Search_Employee.class.getName()).log(java.util
.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Search_Employee.class.getName()).log(java.util
.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Search_Employee.class.getName()).log(java.util
.logging.Level.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
});
DEC, 2021
Prakash Singh
Saurabh Vishwakarma