VINAY Cover
VINAY Cover
VINAY Cover
1
CERTIFICATE .
Date : Date :
2
ID – SHEET
Roll No : ………………………….
Phone No : 7909801516
3
ACKNOWLEDGEMENT
Ankit Kumar
4
TABLE OF CONTENTS
Introduction
Java Details
Priliminary Design
Form Layouts
Database Design
Implementation
Bibliography
Teacher Remarks
5
INTRODUCTION
project.
6
What is java?
Java is a general purpose object oriented programming language . It is the first programming
language that is not tied to any particular hardware or operating system .The language is
based on the concept of an object. Java is highly derived from C++ . Most striking feature of
the language is that it is platform neutral language.
There were five primary goals in the creation of the Java language:
Java tools
In order to write java application or applets ,one need more than a language . The tools that
lets one to write , test , debug programs.
Java features
● Compiler and Interpreted
● Platform independent
● Simple
● Secure
● Familiar
● Portable
● Object-Oriented
● Robust
● Multithreaded
● High performance
● Distributed
● Dynamic
Compiler and Interpreted -There is a java compiler , named javac . The java compiler
takes input source code files (these files typically have the ext.java) and converts them into
compiled bytecode files.The java Interpreter known as javac can be used to execute java
application .The interpreter translates bytecode directly into program actions.
Platform independent- Java programs can be easily moved from one computer to
another, anywhere and anytime.Changes and upgradesmade in operatingsystems,
processors and system resources will not force any changes in java programs.
Simple - Java is designed to be easy for programmer to learn and use efficiently.
Secure- When we use a java compatible web browser, we can safely download java applets
without fear of virus infection. Java achieves this protection by confining a java program to
java execution environment and not allowing it access to other parts of the computer.
Object-Oriented - Java is a true object-oriented language. All program code and data
reside within objects and classes.
Robust -It provides many safeguards to ensure reliable code. It has strict compile time and
run time checking for data types. Designed as a garbage-collected language relieving the
programmers and also incorpates the concept of exception handling which captures series
errors.
Distributed- It has ability to share both data and programs. Java applications can open and
access remote objects on internet which enables multiple programmers at multiple remote
locations to collaborate and work together on single project.
Dynamic - Java is capable of dynamically in new class libraries , methods and objects .It
supports functions written in other languages like C,C++ called as native methods.
Automatic garbage collection -One idea behind Java's automatic memory management
model is that programmers should be spared the burden of having to perform manual
memory management. In some languages the programmer allocates memory to create any
object stored on the heap and is responsible for later manually deallocating that memory to
delete any such objects. If a programmer forgets to de-allocate memory or writes code that
fails to do so in a timely fashion, a memory leak can occur: the program will consume a
potentially arbitrarily large amount of memory. In addition, if a region of memory is de-
allocated twice, the program can become unstable and may crash.
In Java, this potential problem is avoided by automatic garbage collection. The programmer
determines when objects are created and the Java runtime is responsible for managing the
objects' lifecycle. The program or other objects can reference an object by holding a
reference to it (which, from a low-level point of view, is its address on the heap). When no
references to an object remain, the Java garbage collector automatically deletes the
unreachable object, freeing memory and preventing a memory leak. Memory leaks may still
occur if a programmer's code holds a reference to an object that is no longer needed—in
other words, they can still occur but at higher conceptual levels.
Comparing Java and C++, it is possible in C++ to implement similar functionality (for
example, a memory management model for specific classes can be designed in C++ to
improve speed and lower memory fragmentation considerably), with the possibly cost of
extra development time and some application complexity. In Java, garbage collection is built
8
in and virtually invisible to the developer. That is, developers may have no notion of when
garbage collection will take place as it may not necessarily correlate with any actions being
explicitly performed by the code they write. Depending on intended application, this can be
beneficial or disadvantageous: the programmer is freed from performing low-level tasks but
at the same time lose the option of writing lower level code.
Objects and Classes -An object is a software bundle of variables and related methods.
Objects are key to understanding object-oriented technology. Real-world objects share two
characteristics: They all have state and behavior.
Software objects are modeled after real-world objects in that they too have state and
behaviorClasses can also define class variables. A class variable contains information that is
shared by all instances of the class .A class can also declare class methods. You can invoke a
class method directly from the class, whereas you must invoke instance methods on a
particular instance.
Inheritance - Inheritance is the process by which objects of one class acquire the property
of objects of another class. Each subclass inherits state .However, subclasses are not limited
9
to the states and behaviors provided to them by their superclass. Subclasses can add
variables and methods to the ones they inherit from the superclass. It supports the concept
of hierarchical classification it also provides the use of reusability. .
Polymorphism - This means the ability to take more than one form. An operation may
exhibit different behaviour in different instances. The behaviour depends upon the types of
data used in the operation. It plays an important role in allowing objects having different
internal structures to share external interface.
The Java Database Connectivity (JDBC) API is the industry standard for database-
independent connectivity between the Java programming language and a wide range of
databases – SQL databases and other tabular data sources, such as spreadsheets or flat files.
The JDBC API provides a call-level API for SQL-based database access.
JDBC technology allows you to use the Java programming language to exploit "Write Once,
Run Anywhere" capabilities for applications that require access to enterprise data. With a
JDBC technology-enabled driver, you can connect all corporate data even in a
heterogeneous environment.
Driver
Database
Database
The JDBC architecture is based on a collection of java interfaces and classes that together enable you
to connect to data sources , to create and execute SQL statements and to retrieve and modify data in
a database.
The JDBC-ODBC Bridge –“sun.jdbc.odbc.jdbcodbcDriver”-is included with JDK and it enables Java
applications to access data through drivers written to the ODBC standard. The driver bridge is useful
for accessing data in data sources for which no pure JDBC drivers exist. The bridge works by
translating the JDBC methods into ODBC function calls.
● Data Defination Language (DDL) – DDL statements are used to describe the tables
and the data they contain. The subset of SQL statements used for modeling the structure
(rather than the contents) of a database or cube. The DDL gives you the ability to create,
modify, and remove databases and database objects.
● Data Manipulation Language (DML) – DML statements that are used to operate on
data in the database. These are statements that allow you to create or alter objects (such as
11
tables, indexes, views, and so on) in the database. The subset of SQL statements used to
retrieve and manipulate data. DML can be further divided into 2 groups:-
SELECT - SQL statement used to request a selection, projection, join, query, and so on,
from a SQL Server database.
Primary key – Primary key constraints identify the column or set of columns whose values
uniquely identify a row in a table. No two rows in a table can have the same primary key
value. You cannot enter a NULL value for any column in a primary key.
Insert- The Insert logical operator inserts each row from its input into the object specified
in the Argument column. To insert the data into a relation we either specify a tuple to be
inserted or write a query.
Delete- The Delete logical operator deletes from an object rows that satisfy the optional
predicate in the Argument column. We can delete only whole tuples; we cannot delete
values on only particular attributes.
Update- The Update logical operator updates each row from its input in the object
specified in the Argument column. It provides a way of modifying existing data in a table.
SWING
SWING is a set of classes that provides powerful and flexible functionality. In addition with
several components provided by AWT, swing supplies several exciting additions, including
tabbed panes, scroll panes, trees and tables. It also changes the images as the state of any
component changes. Swing is built upon the foundation of the AWT. Swing components are
written entirely in Java and therefore are Platform-independent .Swing is also termed also
light-weight and provide pluggable look and feel.
There are 2 Swing classes that are quite important:
Jframe and Component – Jframe extends the AWT class Frame. It contains additional
features that enable it to support Swing components. JComponent extends the AWT
component and Container classes. It is the top level class for all Swing components and
provides Swing pluggable look and feel.
Here are some of the Swing component classes:
12
CLASS DESCRIPTION
Abstract Button Abstract super class for Swing buttons.
Button Group Encapsulates a mutually exclusive set of
buttons.
Image Icon Encapsulates an icon.
JApplet The SWING version of APPLET.
JButton The SWING push button class.
JCheckBox The SWING check box class.
JComboBox Encapsulates a combo box .
JLabels The SWING version of a label.
JRadioButton The SWING version of a radio button.
JScrollPane Encapsulates a scrollable window.
JTabbedPane Encapsulates a tabbed window.
JTextField The SWING version of Text field.
JTree Encapsulates a tree based-control.
● Icons – Icons are encapsulated by the Image Icon class, which paints an icon from an
image.
● JLabel – Labels are the instances of the JLabel class which extends JComponent. It can
display text or icon. These are passive controls that do not support any interaction with the
user.
● JButton – JButton class provides the functionality of a push button. JButton allows an
icon of string to be associated with the push button.
13
● JComboBox– It is provided through the JComboBox class. It normally displays one entry
and can also display a drop down list that allows a user to select a different entry.
● JTree - It is a component that presents a hierarchical view of data. A user has ability to
expand individual subtrees. These are implemented in Swing by JTree class.
1. It provides more powerful and more flexible components possible in AWT package.
For e.g. JButton can have both image as well as text field associated with it which is
not possible in awt package.
3. Further the Swing components can provide pluggable look and feel, which means
that it is easy to substitute another appearance and behavior for an element.
PRELIMINARY
DESIGN
14
(User Interface)
FORM
LAYOUTS
15
16
17
18
19
DATABASE
DESIGN
20
21
IMPLEMENTATION jTextField1 = new javax.swing.JTextField();
*****************************
jPasswordField1 = new
javax.swing.JPasswordField();
LOGIN jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
***************************** jButton3 = new javax.swing.JButton();
import java.sql.*;
import java.awt.Color; setDefaultCloseOperation(javax.swing.WindowCon
import javax.swing.ImageIcon; stants.EXIT_ON_CLOSE);
import javax.swing.JOptionPane; setBounds(new java.awt.Rectangle(100, 100,
0, 0));
public class login extends javax.swing.JFrame { setCursor(new
java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSO
Connection con; R));
Statement stmt,smt1; setIconImage(new
ResultSet rs; ImageIcon("F:\\IP\\Hotel\\src\\cbsecsnip.jpg").get
java.util.Date dt1; Image());
//Border bor=new setResizable(false);
TitledBorder(null,"Check",2,0);
//jPanel1.setBorder(bor); org.jdesktop.beansbinding.Binding binding =
public login() { org.jdesktop.beansbinding.Bindings.createAutoBin
initComponents(); ding(org.jdesktop.beansbinding.AutoBinding.Upda
try teStrategy.READ_WRITE, this,
{ org.jdesktop.beansbinding.ELProperty.create("Hot
Class .forName("com.mysql.jdbc.Driver"); el Reservation System || www.ezindagi.in ||"),
con = this,
DriverManager.getConnection("jdbc:mysql://local org.jdesktop.beansbinding.BeanProperty.create("ti
host:3306/hotel","root","root"); tle"));
} bindingGroup.addBinding(binding);
catch(Exception e)
{ addWindowListener(new
System.out.println(e.getMessage()); java.awt.event.WindowAdapter() {
} public void
} windowOpened(java.awt.event.WindowEvent evt)
{
@SuppressWarnings("unchecked") formWindowOpened(evt);
// <editor-fold defaultstate="collapsed" }
desc="Generated Code"> });
private void initComponents() { getContentPane().setLayout(new
bindingGroup = new org.netbeans.lib.awtextra.AbsoluteLayout());
org.jdesktop.beansbinding.BindingGroup();
jPanel3.setBackground(new
jPanel3 = new javax.swing.JPanel(); java.awt.Color(255, 255, 255));
jLabel1 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel(); jLabel1.setIcon(new
jPanel1 = new javax.swing.JPanel(); javax.swing.ImageIcon(getClass().getResource("/to
jLabel3 = new javax.swing.JLabel(); p-aboutus.png"))); // NOI18N
jLabel4 = new javax.swing.JLabel();
22
jLabel1.setPreferredSize(new }
java.awt.Dimension(704, 162)); });
jLabel1.setRequestFocusEnabled(false); jPanel1.add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(110
jLabel5.setIcon(new , 90, 90, -1));
javax.swing.ImageIcon(getClass().getResource("/H
otel_reception.jpg"))); // NOI18N jButton2.setText("Cancel");
jButton2.addActionListener(new
jPanel1.setBackground(new java.awt.event.ActionListener() {
java.awt.Color(255, 255, 255)); public void
actionPerformed(java.awt.event.ActionEvent evt) {
jPanel1.setBorder(javax.swing.BorderFactory.creat jButton2ActionPerformed(evt);
eMatteBorder(1, 1, 1, 1, new java.awt.Color(218, }
138, 138))); });
jPanel1.setLayout(new jPanel1.add(jButton2, new
org.netbeans.lib.awtextra.AbsoluteLayout()); org.netbeans.lib.awtextra.AbsoluteConstraints(210
, 90, 90, -1));
jLabel3.setFont(new java.awt.Font("Tahoma",
1, 14)); jButton3.setIcon(new
jLabel3.setText("<html><font javax.swing.ImageIcon(getClass().getResource("/lo
face=\"Californian FB\" size=\"5\">User gin.jpg"))); // NOI18N
Name</font></html>"); jButton3.setBorder(null);
jPanel1.add(jLabel3, new jButton3.addMouseListener(new
org.netbeans.lib.awtextra.AbsoluteConstraints(10, java.awt.event.MouseAdapter() {
20, -1, -1)); public void
mouseEntered(java.awt.event.MouseEvent evt) {
jLabel4.setFont(new java.awt.Font("Tahoma", jButton3MouseEntered(evt);
1, 14)); }
jLabel4.setText("<html><font public void
face=\"Californian FB\" mouseExited(java.awt.event.MouseEvent evt) {
size=\"5\">Password</font></html>"); jButton3MouseExited(evt);
jPanel1.add(jLabel4, new }
org.netbeans.lib.awtextra.AbsoluteConstraints(20, });
50, -1, -1)); jButton3.addActionListener(new
java.awt.event.ActionListener() {
jTextField1.setFont(new public void
java.awt.Font("Tahoma", 1, 12)); actionPerformed(java.awt.event.ActionEvent evt) {
jTextField1.setForeground(new jButton3ActionPerformed(evt);
java.awt.Color(0, 0, 51)); }
jPanel1.add(jTextField1, new });
org.netbeans.lib.awtextra.AbsoluteConstraints(110 jPanel1.add(jButton3, new
, 20, 190, -1)); org.netbeans.lib.awtextra.AbsoluteConstraints(100
, 30, 120, 60));
jPasswordField1.setFont(new
java.awt.Font("Webdings", 1, 14)); javax.swing.GroupLayout jPanel3Layout = new
jPasswordField1.setForeground(new javax.swing.GroupLayout(jPanel3);
java.awt.Color(0, 0, 51)); jPanel3.setLayout(jPanel3Layout);
jPanel1.add(jPasswordField1, new jPanel3Layout.setHorizontalGroup(
org.netbeans.lib.awtextra.AbsoluteConstraints(110
, 50, 190, -1)); jPanel3Layout.createParallelGroup(javax.swing.Gr
oupLayout.Alignment.LEADING)
jButton1.setText("Login");
jButton1.addActionListener(new .addGroup(jPanel3Layout.createSequentialGroup()
java.awt.event.ActionListener() { .addGap(51, 51, 51)
public void
actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(jPanel3Layout.createParallelGroup(java
jButton1ActionPerformed(evt); x.swing.GroupLayout.Alignment.LEADING)
1
.addComponent(jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 623,
javax.swing.GroupLayout.PREFERRED_SIZE) Color c=new Color(240, 153, 153);
Color c1=new Color(170, 119, 98);
.addGroup(jPanel3Layout.createSequentialGroup() jButton3.setBackground(c1);
.addGap(28, 28, 28)
.addComponent(jPanel1, jLabel3.setVisible(false);
javax.swing.GroupLayout.PREFERRED_SIZE, 316, jLabel4.setVisible(false);
javax.swing.GroupLayout.PREFERRED_SIZE) jTextField1.setVisible(false);
.addGap(30, 30, 30) jPasswordField1.setVisible(false);
.addComponent(jLabel5))) jButton1.setVisible(false);
.addContainerGap(76, jButton2.setVisible(false);
Short.MAX_VALUE)) }
);
jPanel3Layout.setVerticalGroup( private void
jButton3ActionPerformed(java.awt.event.ActionEv
jPanel3Layout.createParallelGroup(javax.swing.Gr ent evt) {
oupLayout.Alignment.LEADING)
//Point but=new Point(0,250);
.addGroup(jPanel3Layout.createSequentialGroup() //jButton3.setLocation(but);
.addGap(31, 31, 31) //Point
.addComponent(jLabel1, y=jButton3.getLocation();System.out.println(y);
javax.swing.GroupLayout.PREFERRED_SIZE, jButton3.setVisible(false);
javax.swing.GroupLayout.DEFAULT_SIZE, //Point pan=new Point(400,250);
javax.swing.GroupLayout.PREFERRED_SIZE) //jPanel1.setLocation(pan);
.addGap(18, 18, 18) //Point
x=jPanel1.getLocation();System.out.println(x);
.addGroup(jPanel3Layout.createParallelGroup(java jPanel1.setVisible(true);
x.swing.GroupLayout.Alignment.LEADING) jLabel3.setVisible(true);
.addComponent(jLabel5) jLabel4.setVisible(true);
jTextField1.setVisible(true);
.addGroup(jPanel3Layout.createSequentialGroup() jPasswordField1.setVisible(true);
.addGap(54, 54, 54) jButton1.setVisible(true);
.addComponent(jPanel1, jButton2.setVisible(true);
javax.swing.GroupLayout.PREFERRED_SIZE, 127,
javax.swing.GroupLayout.PREFERRED_SIZE))) //x=jPanel1.getLocation();System.out.println(x);
.addContainerGap(105, }
Short.MAX_VALUE))
); private void
jButton3MouseExited(java.awt.event.MouseEvent
getContentPane().add(jPanel3, new evt) {
org.netbeans.lib.awtextra.AbsoluteConstraints(0, Color c1=new Color(170, 119, 98);
0, 750, 530)); jButton3.setBackground(c1);
}
bindingGroup.bind();
private void
java.awt.Dimension screenSize = jButton3MouseEntered(java.awt.event.MouseEve
java.awt.Toolkit.getDefaultToolkit().getScreenSize( nt evt) {
); Color c1=new Color(170, 119, 98);
setBounds((screenSize.width-750)/2, jButton3.setBackground(c1);
(screenSize.height-530)/2, 750, 530); }
}// </editor-fold>
private void
private void jButton2ActionPerformed(java.awt.event.ActionEv
formWindowOpened(java.awt.event.WindowEven ent evt) {
t evt) { jLabel3.setVisible(false);
jPanel1.setOpaque(true); jLabel4.setVisible(false);
2
jTextField1.setVisible(false);
jPasswordField1.setVisible(false); javax.swing.UIManager.setLookAndFeel(info.getCl
jButton1.setVisible(false); assName());
jButton2.setVisible(false); break;
jButton3.setVisible(true); }
} }
} catch (ClassNotFoundException ex) {
private void
jButton1ActionPerformed(java.awt.event.ActionEv java.util.logging.Logger.getLogger(login.class.getN
ent evt) { ame()).log(java.util.logging.Level.SEVERE, null, ex);
try{ } catch (InstantiationException ex) {
int flag=0;
String sql="Select * from login;"; java.util.logging.Logger.getLogger(login.class.getN
smt1=con.createStatement(); ame()).log(java.util.logging.Level.SEVERE, null, ex);
rs=smt1.executeQuery(sql); } catch (IllegalAccessException ex) {
String log=jTextField1.getText();
String pass =new java.util.logging.Logger.getLogger(login.class.getN
String(jPasswordField1.getPassword()); ame()).log(java.util.logging.Level.SEVERE, null, ex);
while(rs.next()) { } catch
if(log.equals(rs.getString(1)) && (javax.swing.UnsupportedLookAndFeelException
pass.equals(rs.getString(2))) { ex) {
flag=1;
break; java.util.logging.Logger.getLogger(login.class.getN
} ame()).log(java.util.logging.Level.SEVERE, null, ex);
} }
if(flag==1) {
jLabel3.setEnabled(false); java.awt.EventQueue.invokeLater(new
jLabel4.setEnabled(false); Runnable() {
jTextField1.setEnabled(false);
jPasswordField1.setEnabled(false); public void run() {
jButton1.setEnabled(false); new login().setVisible(true);
jButton2.setEnabled(false); }
NavigationFrame nf=new });
NavigationFrame(this); }
nf.setVisible(true); // Variables declaration - do not modify
} else { private javax.swing.JButton jButton1;
JOptionPane.showMessageDialog(this, private javax.swing.JButton jButton2;
"Incorrect Password", "Contact Mritunjay Singh private javax.swing.JButton jButton3;
Khichi",JOptionPane.ERROR_MESSAGE); private javax.swing.JLabel jLabel1;
} private javax.swing.JLabel jLabel3;
} catch(Exception ex){ private javax.swing.JLabel jLabel4;
} private javax.swing.JLabel jLabel5;
} private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel3;
/** private javax.swing.JPasswordField
* @param args the command line arguments jPasswordField1;
*/ private javax.swing.JTextField jTextField1;
public static void main(String args[]) { private org.jdesktop.beansbinding.BindingGroup
bindingGroup;
try { // End of variables declaration
for }
(javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()
){
if ("THEME".equals(info.getName())) { BOOK ROOM
3
***************************** }
4
jPanel5.add(jTextField1, new
setDefaultCloseOperation(javax.swing.WindowCon org.netbeans.lib.awtextra.AbsoluteConstraints(130
stants.DISPOSE_ON_CLOSE); , 50, 170, -1));
setBounds(new java.awt.Rectangle(250, 60, 0,
0)); jLabel18.setFont(new
setResizable(false); java.awt.Font("Tahoma", 0, 12));
jLabel18.setForeground(new
org.jdesktop.beansbinding.Binding binding = java.awt.Color(255, 255, 255));
org.jdesktop.beansbinding.Bindings.createAutoBin jLabel18.setText("City");
ding(org.jdesktop.beansbinding.AutoBinding.Upda jPanel5.add(jLabel18, new
teStrategy.READ_WRITE, this, org.netbeans.lib.awtextra.AbsoluteConstraints(30,
org.jdesktop.beansbinding.ELProperty.create("Hot 110, -1, -1));
el Reservation System || www.ezindagi.in ||"), jPanel5.add(jTextField2, new
this, org.netbeans.lib.awtextra.AbsoluteConstraints(130
org.jdesktop.beansbinding.BeanProperty.create("ti , 80, 170, -1));
tle"));
bindingGroup.addBinding(binding); jLabel19.setFont(new
java.awt.Font("Tahoma", 0, 12));
addWindowListener(new jLabel19.setForeground(new
java.awt.event.WindowAdapter() { java.awt.Color(255, 255, 255));
public void jLabel19.setText("State");
windowOpened(java.awt.event.WindowEvent evt) jPanel5.add(jLabel19, new
{ org.netbeans.lib.awtextra.AbsoluteConstraints(30,
formWindowOpened(evt); 140, -1, -1));
} jPanel5.add(jTextField3, new
}); org.netbeans.lib.awtextra.AbsoluteConstraints(130
, 110, 170, -1));
jPanel4.setBackground(new jPanel5.add(jTextField4, new
java.awt.Color(241, 241, 255)); org.netbeans.lib.awtextra.AbsoluteConstraints(130
jPanel4.setLayout(new , 140, 170, -1));
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel20.setFont(new
jPanel5.setBackground(new java.awt.Font("Tahoma", 0, 12));
java.awt.Color(153, 153, 153)); jLabel20.setForeground(new
java.awt.Color(255, 255, 255));
jPanel5.setBorder(javax.swing.BorderFactory.creat jLabel20.setText("Country");
eEtchedBorder()); jPanel5.add(jLabel20, new
jPanel5.setLayout(new org.netbeans.lib.awtextra.AbsoluteConstraints(30,
org.netbeans.lib.awtextra.AbsoluteLayout()); 170, -1, -1));
jPanel5.add(jTextField5, new
jLabel16.setFont(new org.netbeans.lib.awtextra.AbsoluteConstraints(130
java.awt.Font("Tahoma", 0, 12)); , 170, 170, -1));
jLabel16.setForeground(new
java.awt.Color(255, 255, 255)); jLabel21.setFont(new
jLabel16.setText("Address"); java.awt.Font("Tahoma", 0, 12));
jPanel5.add(jLabel16, new jLabel21.setForeground(new
org.netbeans.lib.awtextra.AbsoluteConstraints(30, java.awt.Color(255, 255, 255));
80, -1, -1)); jLabel21.setText("Phone");
jPanel5.add(jLabel21, new
jLabel17.setFont(new org.netbeans.lib.awtextra.AbsoluteConstraints(30,
java.awt.Font("Tahoma", 0, 12)); 200, -1, -1));
jLabel17.setForeground(new jPanel5.add(jTextField6, new
java.awt.Color(255, 255, 255)); org.netbeans.lib.awtextra.AbsoluteConstraints(130
jLabel17.setText("Customer Name"); , 200, 170, -1));
jPanel5.add(jLabel17, new
org.netbeans.lib.awtextra.AbsoluteConstraints(30, jLabel22.setFont(new
50, -1, -1)); java.awt.Font("Tahoma", 0, 12));
5
jLabel22.setForeground(new
java.awt.Color(255, 255, 255)); jLabel27.setFont(new
jLabel22.setText("Nationality"); java.awt.Font("Tahoma", 0, 12));
jPanel5.add(jLabel22, new jLabel27.setForeground(new
org.netbeans.lib.awtextra.AbsoluteConstraints(340 java.awt.Color(255, 255, 255));
, 20, -1, -1)); jLabel27.setText("No of Minor");
jPanel5.add(jTextField7, new jPanel5.add(jLabel27, new
org.netbeans.lib.awtextra.AbsoluteConstraints(420 org.netbeans.lib.awtextra.AbsoluteConstraints(340
, 50, 140, -1)); , 110, -1, -1));
jPanel5.add(jTextField12, new
jLabel23.setFont(new org.netbeans.lib.awtextra.AbsoluteConstraints(420
java.awt.Font("Tahoma", 0, 12)); , 110, 140, -1));
jLabel23.setForeground(new
java.awt.Color(255, 255, 255)); jLabel29.setFont(new
jLabel23.setText("Purpose"); java.awt.Font("Tahoma", 0, 12));
jPanel5.add(jLabel23, new jLabel29.setForeground(new
org.netbeans.lib.awtextra.AbsoluteConstraints(340 java.awt.Color(255, 255, 255));
, 140, -1, -1)); jLabel29.setText("Marital Status");
jPanel5.add(jTextField8, new jPanel5.add(jLabel29, new
org.netbeans.lib.awtextra.AbsoluteConstraints(420 org.netbeans.lib.awtextra.AbsoluteConstraints(30,
, 140, 140, -1)); 230, -1, -1));
jPanel5.add(jTextField14, new
jLabel24.setFont(new org.netbeans.lib.awtextra.AbsoluteConstraints(130
java.awt.Font("Tahoma", 0, 12)); , 230, 170, -1));
jLabel24.setForeground(new
java.awt.Color(255, 255, 255)); jLabel30.setFont(new
jLabel24.setText("ID Proof"); java.awt.Font("Tahoma", 1, 13));
jPanel5.add(jLabel24, new jLabel30.setForeground(new
org.netbeans.lib.awtextra.AbsoluteConstraints(340 java.awt.Color(204, 204, 0));
, 50, -1, -1)); jLabel30.setText("Bill (tax 12%)");
jPanel5.add(jTextField9, new jPanel5.add(jLabel30, new
org.netbeans.lib.awtextra.AbsoluteConstraints(420 org.netbeans.lib.awtextra.AbsoluteConstraints(320
, 20, 140, -1)); , 200, 90, -1));
jLabel25.setFont(new jTextField15.setEnabled(false);
java.awt.Font("Tahoma", 0, 12)); jPanel5.add(jTextField15, new
jLabel25.setForeground(new org.netbeans.lib.awtextra.AbsoluteConstraints(420
java.awt.Color(255, 255, 255)); , 200, 140, -1));
jLabel25.setText("Customer Id");
jPanel5.add(jLabel25, new jButton1.setFont(new
org.netbeans.lib.awtextra.AbsoluteConstraints(30, java.awt.Font("Tahoma", 1, 14));
20, -1, -1)); jButton1.setText("Book Room");
jPanel5.add(jTextField10, new jButton1.addActionListener(new
org.netbeans.lib.awtextra.AbsoluteConstraints(130 java.awt.event.ActionListener() {
, 20, 170, -1)); public void
actionPerformed(java.awt.event.ActionEvent evt) {
jLabel26.setFont(new jButton1ActionPerformed(evt);
java.awt.Font("Tahoma", 0, 12)); }
jLabel26.setForeground(new });
java.awt.Color(255, 255, 255)); jPanel5.add(jButton1, new
jLabel26.setText("No of Adult"); org.netbeans.lib.awtextra.AbsoluteConstraints(330
jPanel5.add(jLabel26, new , 240, 160, 30));
org.netbeans.lib.awtextra.AbsoluteConstraints(340
, 80, -1, -1)); jLabel28.setFont(new
jPanel5.add(jTextField11, new java.awt.Font("Tahoma", 0, 12));
org.netbeans.lib.awtextra.AbsoluteConstraints(420 jLabel28.setForeground(new
, 80, 140, -1)); java.awt.Color(255, 255, 255));
6
jLabel28.setText("No of days"); jPanel4.add(jLabel6, new
jPanel5.add(jLabel28, new org.netbeans.lib.awtextra.AbsoluteConstraints(180
org.netbeans.lib.awtextra.AbsoluteConstraints(340 , 190, 90, -1));
, 170, -1, -1));
jLabel7.setFont(new java.awt.Font("Tahoma",
jTextField13.setEnabled(false); 0, 14));
jPanel5.add(jTextField13, new jLabel7.setText("Bed Type");
org.netbeans.lib.awtextra.AbsoluteConstraints(420 jPanel4.add(jLabel7, new
, 170, 140, -1)); org.netbeans.lib.awtextra.AbsoluteConstraints(300
, 160, -1, -1));
jButton3.setFont(new
java.awt.Font("Tahoma", 1, 14)); jLabel8.setFont(new java.awt.Font("Tahoma",
jButton3.setText("Close"); 1, 14));
jButton3.addActionListener(new jLabel8.setForeground(new java.awt.Color(0,
java.awt.event.ActionListener() { 102, 0));
public void jLabel8.setText("Bed Type");
actionPerformed(java.awt.event.ActionEvent evt) { jPanel4.add(jLabel8, new
jButton3ActionPerformed(evt); org.netbeans.lib.awtextra.AbsoluteConstraints(380
} , 160, 100, -1));
});
jPanel5.add(jButton3, new jLabel9.setFont(new java.awt.Font("Tahoma",
org.netbeans.lib.awtextra.AbsoluteConstraints(500 0, 14));
, 240, 80, 30)); jLabel9.setText("Tariff");
jPanel4.add(jLabel9, new
jPanel4.add(jPanel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(510
org.netbeans.lib.awtextra.AbsoluteConstraints(80, , 160, -1, -1));
220, 610, 280));
jLabel10.setFont(new
jLabel3.setFont(new java.awt.Font("Tahoma", java.awt.Font("Tahoma", 1, 14));
1, 14)); jLabel10.setForeground(new java.awt.Color(0,
jLabel3.setForeground(new java.awt.Color(0, 102, 0));
102, 0)); jLabel10.setText("Tariff");
jLabel3.setText("Room No."); jPanel4.add(jLabel10, new
jPanel4.add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(550
org.netbeans.lib.awtextra.AbsoluteConstraints(180 , 160, 90, -1));
, 160, -1, -1));
jLabel11.setFont(new
jLabel4.setFont(new java.awt.Font("Tahoma", java.awt.Font("Tahoma", 0, 14));
0, 14)); jLabel11.setText("Check In");
jLabel4.setText("Room No."); jPanel4.add(jLabel11, new
jPanel4.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(300
org.netbeans.lib.awtextra.AbsoluteConstraints(110 , 190, 60, -1));
, 160, -1, 20));
jLabel12.setFont(new
jLabel5.setFont(new java.awt.Font("Tahoma", java.awt.Font("Tahoma", 1, 14));
0, 14)); jLabel12.setForeground(new java.awt.Color(0,
jLabel5.setText("Room Type"); 102, 0));
jPanel4.add(jLabel5, new jLabel12.setText("Check In");
org.netbeans.lib.awtextra.AbsoluteConstraints(100 jPanel4.add(jLabel12, new
, 190, -1, -1)); org.netbeans.lib.awtextra.AbsoluteConstraints(380
, 190, 110, -1));
jLabel6.setFont(new java.awt.Font("Tahoma",
1, 14)); jLabel13.setFont(new
jLabel6.setForeground(new java.awt.Color(0, java.awt.Font("Tahoma", 0, 14));
102, 0)); jLabel13.setText("Check Out");
jLabel6.setText("Room Type");
7
jPanel4.add(jLabel13, new
org.netbeans.lib.awtextra.AbsoluteConstraints(490 String bidsql="select book_id from
, 190, 70, -1)); bookingtable;";
smt3=con.createStatement();
jLabel14.setFont(new rs=smt3.executeQuery(bidsql);
java.awt.Font("Tahoma", 1, 14)); int row=0;
jLabel14.setForeground(new java.awt.Color(0, int bid=0;
102, 0)); while(rs.next()){
jLabel14.setText("Check Out");
jPanel4.add(jLabel14, new bid=rs.getInt(1);
org.netbeans.lib.awtextra.AbsoluteConstraints(550
, 190, 110, -1)); row++;
}
jLabel1.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/to
p-aboutus.png"))); // NOI18N if(row==0)
jPanel4.add(jLabel1, new {
org.netbeans.lib.awtextra.AbsoluteConstraints(60, bid++;
0, -1, 160)); }
else
javax.swing.GroupLayout layout = new {
javax.swing.GroupLayout(getContentPane()); rs.last();
getContentPane().setLayout(layout); bid=rs.getInt(1);
layout.setHorizontalGroup(
bid=bid+1;
layout.createParallelGroup(javax.swing.GroupLayo
ut.Alignment.LEADING) }
.addGroup(layout.createSequentialGroup() bookid=bid;
.addComponent(jPanel4, jLabel3.setText(roomno);
javax.swing.GroupLayout.PREFERRED_SIZE, 747, jLabel6.setText(bed);
javax.swing.GroupLayout.PREFERRED_SIZE) jLabel8.setText(roomt);
jLabel10.setText(rate);
.addContainerGap(javax.swing.GroupLayout.DEFA jLabel12.setText(strdtver1);
ULT_SIZE, Short.MAX_VALUE)) jLabel14.setText(strdtver2);
);
layout.setVerticalGroup( jTextField13.setText(diffd+" day(s)");
int r=Integer.parseInt(rate);
layout.createParallelGroup(javax.swing.GroupLayo int day=Integer.parseInt(diffd);
ut.Alignment.LEADING) int tax=(r*day)*12/100;
.addComponent(jPanel4, amt=(r*day)+tax;
javax.swing.GroupLayout.DEFAULT_SIZE, 510,
Short.MAX_VALUE) jTextField15.setText(Integer.toString(amt)+".00");
); }
catch(Exception ex)
bindingGroup.bind(); {
ex.printStackTrace();
java.awt.Dimension screenSize = }
java.awt.Toolkit.getDefaultToolkit().getScreenSize( }
);
setBounds((screenSize.width-750)/2, private void
(screenSize.height-548)/2, 750, 548); jButton1ActionPerformed(java.awt.event.ActionEv
}// </editor-fold> ent evt) {
try
private void {
formWindowOpened(java.awt.event.WindowEven cno=jTextField10.getText();
t evt) { cname=jTextField1.getText();
try{ cadd=jTextField2.getText();
8
ccity=jTextField3.getText(); private void
cstat=jTextField4.getText(); jButton3ActionPerformed(java.awt.event.ActionEv
ccoun=jTextField5.getText(); ent evt) {
cph=jTextField6.getText(); dispose();
cmars=jTextField14.getText(); }
cnation=jTextField9.getText();
cproof=jTextField7.getText(); /**
cadult=jTextField11.getText(); * @param args the command line arguments
cchild=jTextField12.getText();
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new
Runnable() {
cpur=jTextField8.getText();
int public void run() {
code=JOptionPane.showConfirmDialog(this,"Room new BookRoom().setVisible(true);
No. " + roomno + " is booked for " + cname + "" }
+ });
"!","Confirmation",JOptionPane.YES_NO_CANCEL_ }*/
OPTION,JOptionPane.INFORMATION_MESSAGE); // Variables declaration - do not modify
if(code==JOptionPane.YES_NO_OPTION) private javax.swing.JButton jButton1;
{ private javax.swing.JButton jButton3;
String insqlcust="insert into custdetail private javax.swing.JLabel jLabel1;
(Cust_no,Cust_name,Cust_add,Cust_city,Cust_stat private javax.swing.JLabel jLabel10;
e,Cust_country,Cust_ph,Cust_proof,Cust_mar_stat private javax.swing.JLabel jLabel11;
,Cust_nation,Cust_adult,Cust_child,Cust_purpos,b private javax.swing.JLabel jLabel12;
ook_id,cust_bill) " private javax.swing.JLabel jLabel13;
+ "values ('" + cno + "','" + cname + private javax.swing.JLabel jLabel14;
"','" + cadd + "','" + ccity + "','" + cstat + "','" + private javax.swing.JLabel jLabel16;
ccoun + "','" + cph + "','" + cproof private javax.swing.JLabel jLabel17;
+ "','" + cmars + "','" + cnation + "','" private javax.swing.JLabel jLabel21;
+ cadult + "','" + cchild + "','" + cpur + "'," + bookid private javax.swing.JLabel jLabel22;
+ ",'" + amt + "');"; private javax.swing.JLabel jLabel23;
smt1=con.createStatement(); private javax.swing.JLabel jLabel24;
int ins=smt1.executeUpdate(insqlcust); private javax.swing.JLabel jLabel25;
String insqlbook="insert into private javax.swing.JLabel jLabel26;
bookingtable private javax.swing.JLabel jLabel27;
(book_id,room_no,date_fro,date_to,no_of_day) private javax.swing.JLabel jLabel28;
values( '" private javax.swing.JLabel jLabel29;
+ bookid + "','" + roomno + "','" + dt1 private javax.swing.JTextField jTextField1;
+ "','" + dt2 + "','" + diffd + "');"; private javax.swing.JTextField jTextField10;
smt2=con.createStatement(); private javax.swing.JTextField jTextField11;
int ins1=smt1.executeUpdate(insqlbook); private javax.swing.JTextField jTextField12;
JOptionPane.showMessageDialog( private javax.swing.JTextField jTextField13;
this,"Room Booked...!"); private javax.swing.JTextField jTextField14;
} private javax.swing.JTextField jTextField15;
else private javax.swing.JTextField jTextField2;
{ private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
} private javax.swing.JTextField jTextField5;
} private javax.swing.JTextField jTextField6;
catch(Exception ex) private org.jdesktop.beansbinding.BindingGroup
{ bindingGroup;
ex.printStackTrace(); // End of variables declaration
} }
}
*****************************
9
CUSTOMER DETAILS jLabel8 = new javax.swing.JLabel();
jLabel10 = new javax.swing.JLabel();
jLabel13 = new javax.swing.JLabel();
***************************** jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel();
import java.sql.*;
jLabel14 = new javax.swing.JLabel();
import javax.swing.JOptionPane;
jTextField12 = new javax.swing.JTextField();
public class CustomerMang extends
jTextField11 = new javax.swing.JTextField();
javax.swing.JFrame {
jTextField10 = new javax.swing.JTextField();
jTextField9 = new javax.swing.JTextField();
Connection con;
jTextField1 = new javax.swing.JTextField();
Statement smt,smt1;
jTextField2 = new javax.swing.JTextField();
ResultSet rs,rs1,rs2;
jTextField3 = new javax.swing.JTextField();
String
jTextField4 = new javax.swing.JTextField();
Cust_no,Cust_name,Cust_add,Cust_city,Cust_state
jTextField5 = new javax.swing.JTextField();
,Cust_country,Cust_ph,Cust_proof,Cust_mar_stat,
jTextField6 = new javax.swing.JTextField();
Cust_nation,Cust_adult,Cust_child,Cust_purpos,bo
jTextField7 = new javax.swing.JTextField();
ok_id,Cust_bill;
jTextField8 = new javax.swing.JTextField();
jLabel16 = new javax.swing.JLabel();
public CustomerMang() {
jLabel15 = new javax.swing.JLabel();
initComponents();
jTextField16 = new javax.swing.JTextField();
disableTextF();
jTextField15 = new javax.swing.JTextField();
try
jButton5 = new javax.swing.JButton();
{
jButton7 = new javax.swing.JButton();
Class.forName("com.mysql.jdbc.Driver");
jButton6 = new javax.swing.JButton();
con =
jButton8 = new javax.swing.JButton();
DriverManager.getConnection("jdbc:mysql://local
jLabel19 = new javax.swing.JLabel();
host:3306/hotel","root","root");
jLabel20 = new javax.swing.JLabel();
String query = "SELECT * FROM custdetail
jTextField18 = new javax.swing.JTextField();
ORDER BY Cust_No;";
jTextField19 = new javax.swing.JTextField();
smt=con.createStatement();
jLabel25 = new javax.swing.JLabel();
rs=smt.executeQuery(query);
jButton1 = new javax.swing.JButton();
rs.next();
jButton2 = new javax.swing.JButton();
displayRecord();
jTextField13 = new javax.swing.JTextField();
}
jLabel9 = new javax.swing.JLabel();
catch(Exception e)
{
e.printStackTrace();
setDefaultCloseOperation(javax.swing.WindowCon
System.out.println(e.getMessage());
stants.DISPOSE_ON_CLOSE);
}
setBounds(new java.awt.Rectangle(250, 50, 0,
}
0));
@SuppressWarnings("unchecked")
org.jdesktop.beansbinding.Binding binding =
// <editor-fold defaultstate="collapsed"
org.jdesktop.beansbinding.Bindings.createAutoBin
desc="Generated Code">
ding(org.jdesktop.beansbinding.AutoBinding.Upda
private void initComponents() {
teStrategy.READ_WRITE, this,
bindingGroup = new
org.jdesktop.beansbinding.ELProperty.create("Hot
org.jdesktop.beansbinding.BindingGroup();
el Reservation System || www.ezindagi.in ||"),
this,
jPanel1 = new javax.swing.JPanel();
org.jdesktop.beansbinding.BeanProperty.create("ti
jLabel1 = new javax.swing.JLabel();
tle"));
jLabel2 = new javax.swing.JLabel();
bindingGroup.addBinding(binding);
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jPanel1.setBackground(new
jLabel5 = new javax.swing.JLabel();
java.awt.Color(241, 241, 255));
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
10
jLabel1.setIcon(new jTextField6.setBackground(new
javax.swing.ImageIcon(getClass().getResource("/to java.awt.Color(250, 250, 255));
p-aboutus.png"))); // NOI18N
jTextField7.setBackground(new
jLabel2.setText("Visitor Name"); java.awt.Color(250, 250, 255));
11
});
.addGroup(jPanel1Layout.createParallelGroup(java
jButton8.setFont(new x.swing.GroupLayout.Alignment.LEADING)
java.awt.Font("Tahoma", 0, 12)); .addComponent(jLabel1,
jButton8.setText("Last >>"); javax.swing.GroupLayout.Alignment.TRAILING)
jButton8.addActionListener(new
java.awt.event.ActionListener() { .addGroup(javax.swing.GroupLayout.Alignment.TR
public void AILING, jPanel1Layout.createSequentialGroup()
actionPerformed(java.awt.event.ActionEvent evt) { .addGap(21, 21, 21)
jButton8ActionPerformed(evt);
} .addGroup(jPanel1Layout.createParallelGroup(java
}); x.swing.GroupLayout.Alignment.LEADING)
12
.addComponent(jTextField3,
javax.swing.GroupLayout.DEFAULT_SIZE, 172, .addComponent(jLabel19)
Short.MAX_VALUE)
.addComponent(jTextField4, .addComponent(jLabel20))
javax.swing.GroupLayout.DEFAULT_SIZE, 172, .addGap(18, 18, 18)
Short.MAX_VALUE)
.addComponent(jTextField5, .addGroup(jPanel1Layout.createParallelGroup(java
javax.swing.GroupLayout.DEFAULT_SIZE, 172, x.swing.GroupLayout.Alignment.TRAILING)
Short.MAX_VALUE)
.addComponent(jTextField6, .addComponent(jTextField19,
javax.swing.GroupLayout.DEFAULT_SIZE, 172, javax.swing.GroupLayout.DEFAULT_SIZE, 167,
Short.MAX_VALUE) Short.MAX_VALUE)
.addComponent(jTextField7,
javax.swing.GroupLayout.DEFAULT_SIZE, 172, .addComponent(jTextField18,
Short.MAX_VALUE) javax.swing.GroupLayout.Alignment.LEADING,
.addComponent(jTextField13, javax.swing.GroupLayout.DEFAULT_SIZE, 167,
javax.swing.GroupLayout.DEFAULT_SIZE, 172, Short.MAX_VALUE)))))
Short.MAX_VALUE)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(javax.swing.GroupLayout.Alignment.TR .addGap(74, 74, 74)
AILING, jPanel1Layout.createSequentialGroup() .addComponent(jLabel25))
.addComponent(jLabel10)
.addGap(41, 41, 41) .addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jTextField8,
javax.swing.GroupLayout.PREFERRED_SIZE, 172, .addGroup(jPanel1Layout.createParallelGroup(java
javax.swing.GroupLayout.PREFERRED_SIZE))) x.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createParallelGroup(java .addGroup(javax.swing.GroupLayout.Alignment.LE
x.swing.GroupLayout.Alignment.LEADING) ADING, jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(java
.addGap(37, 37, 37) x.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(java .addComponent(jLabel13)
x.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel14))
.addGroup(jPanel1Layout.createSequentialGroup() .addGap(14, 14, 14)
.addGap(23, 23, 23)
.addGroup(jPanel1Layout.createParallelGroup(java
.addGroup(jPanel1Layout.createParallelGroup(java x.swing.GroupLayout.Alignment.LEADING, false)
x.swing.GroupLayout.Alignment.LEADING)
.addComponent(jTextField12)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jTextField9,
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 143,
javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)))
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18) .addGroup(javax.swing.GroupLayout.Alignment.LE
ADING, jPanel1Layout.createSequentialGroup()
.addComponent(jButton2,
javax.swing.GroupLayout.PREFERRED_SIZE, 93, .addGroup(jPanel1Layout.createParallelGroup(java
javax.swing.GroupLayout.PREFERRED_SIZE)) x.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel16)
.addGroup(jPanel1Layout.createParallelGroup(java .addComponent(jLabel15))
x.swing.GroupLayout.Alignment.TRAILING) .addGap(45, 45, 45)
13
.addComponent(jLabel1,
.addGroup(jPanel1Layout.createParallelGroup(java javax.swing.GroupLayout.PREFERRED_SIZE, 162,
x.swing.GroupLayout.Alignment.LEADING, false) javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField15) .addPreferredGap(javax.swing.LayoutStyle.Compo
nentPlacement.UNRELATED)
.addComponent(jTextField16,
javax.swing.GroupLayout.DEFAULT_SIZE, 143, .addGroup(jPanel1Layout.createParallelGroup(java
Short.MAX_VALUE)))) x.swing.GroupLayout.Alignment.LEADING)
.addPreferredGap(javax.swing.LayoutStyle.Compo .addGroup(jPanel1Layout.createSequentialGroup()
nentPlacement.RELATED, 10, Short.MAX_VALUE))) .addGap(4, 4, 4)
.addGap(8, 8, 8))
.addGroup(jPanel1Layout.createParallelGroup(java
.addGroup(javax.swing.GroupLayout.Alignment.TR x.swing.GroupLayout.Alignment.BASELINE)
AILING, jPanel1Layout.createSequentialGroup() .addComponent(jTextField13,
javax.swing.GroupLayout.PREFERRED_SIZE,
.addPreferredGap(javax.swing.LayoutStyle.Compo javax.swing.GroupLayout.DEFAULT_SIZE,
nentPlacement.RELATED) javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel9))
.addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.LEADING, false) .addPreferredGap(javax.swing.LayoutStyle.Compo
.addComponent(jButton5, nentPlacement.UNRELATED)
javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, .addGroup(jPanel1Layout.createParallelGroup(java
javax.swing.GroupLayout.DEFAULT_SIZE, x.swing.GroupLayout.Alignment.BASELINE)
Short.MAX_VALUE) .addComponent(jLabel2)
.addComponent(jButton7, .addComponent(jTextField1,
javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)) javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.Compo .addPreferredGap(javax.swing.LayoutStyle.Compo
nentPlacement.RELATED) nentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(java .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.LEADING, false) x.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton6, .addComponent(jLabel3)
javax.swing.GroupLayout.DEFAULT_SIZE, .addComponent(jTextField2,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE,
Short.MAX_VALUE) javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(jButton8, javax.swing.GroupLayout.PREFERRED_SIZE))
javax.swing.GroupLayout.PREFERRED_SIZE, 102,
javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.Compo
.addGap(33, 33, 33))))) nentPlacement.RELATED)
.addGap(64, 64, 64))
); .addGroup(jPanel1Layout.createParallelGroup(java
jPanel1Layout.setVerticalGroup( x.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
jPanel1Layout.createParallelGroup(javax.swing.Gr .addComponent(jTextField3,
oupLayout.Alignment.LEADING) javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
.addGroup(javax.swing.GroupLayout.Alignment.TR javax.swing.GroupLayout.PREFERRED_SIZE))
AILING, jPanel1Layout.createSequentialGroup()
.addGap(11, 11, 11) .addPreferredGap(javax.swing.LayoutStyle.Compo
nentPlacement.RELATED)
14
.addGroup(jPanel1Layout.createParallelGroup(java .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.BASELINE) x.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5) .addComponent(jLabel11)
.addComponent(jTextField4, .addComponent(jTextField10,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)) javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.Compo .addPreferredGap(javax.swing.LayoutStyle.Compo
nentPlacement.RELATED) nentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(java .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.BASELINE) x.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6) .addComponent(jLabel12)
.addComponent(jTextField5, .addComponent(jTextField11,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)) javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(7, 7, 7))
.addPreferredGap(javax.swing.LayoutStyle.Compo
nentPlacement.RELATED) .addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(java .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.BASELINE) x.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7)
.addComponent(jTextField6, .addGroup(jPanel1Layout.createSequentialGroup()
javax.swing.GroupLayout.PREFERRED_SIZE, .addGap(52, 52, 52)
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.BASELINE)
.addPreferredGap(javax.swing.LayoutStyle.Compo .addComponent(jLabel16)
nentPlacement.RELATED) .addComponent(jTextField15,
javax.swing.GroupLayout.PREFERRED_SIZE,
.addGroup(jPanel1Layout.createParallelGroup(java javax.swing.GroupLayout.DEFAULT_SIZE,
x.swing.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jLabel8)
.addComponent(jTextField7, .addGroup(jPanel1Layout.createSequentialGroup()
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, .addGroup(jPanel1Layout.createParallelGroup(java
javax.swing.GroupLayout.PREFERRED_SIZE)) x.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel13)
.addPreferredGap(javax.swing.LayoutStyle.Compo .addComponent(jTextField9,
nentPlacement.RELATED) javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
.addGroup(jPanel1Layout.createParallelGroup(java javax.swing.GroupLayout.PREFERRED_SIZE))
x.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10) .addPreferredGap(javax.swing.LayoutStyle.Compo
.addComponent(jTextField8, nentPlacement.RELATED)
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, .addGroup(jPanel1Layout.createParallelGroup(java
javax.swing.GroupLayout.PREFERRED_SIZE)) x.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel14)
.addPreferredGap(javax.swing.LayoutStyle.Compo .addComponent(jTextField12,
nentPlacement.UNRELATED) javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))))
15
.addGap(10, 10, 10) .addComponent(jButton2,
javax.swing.GroupLayout.DEFAULT_SIZE, 31,
.addGroup(jPanel1Layout.createParallelGroup(java Short.MAX_VALUE))))
x.swing.GroupLayout.Alignment.TRAILING) .addContainerGap())
.addComponent(jTextField16, );
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout layout = new
javax.swing.GroupLayout.PREFERRED_SIZE) javax.swing.GroupLayout(getContentPane());
.addComponent(jLabel15)) getContentPane().setLayout(layout);
.addGap(18, 18, 18) layout.setHorizontalGroup(
.addGroup(jPanel1Layout.createParallelGroup(java layout.createParallelGroup(javax.swing.GroupLayo
x.swing.GroupLayout.Alignment.BASELINE) ut.Alignment.LEADING)
.addComponent(jButton7) .addGroup(layout.createSequentialGroup()
.addComponent(jButton6)) .addComponent(jPanel1,
javax.swing.GroupLayout.PREFERRED_SIZE,
.addPreferredGap(javax.swing.LayoutStyle.Compo javax.swing.GroupLayout.DEFAULT_SIZE,
nentPlacement.RELATED) javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(java .addContainerGap(javax.swing.GroupLayout.DEFA
x.swing.GroupLayout.Alignment.BASELINE) ULT_SIZE, Short.MAX_VALUE))
.addComponent(jButton8) );
.addComponent(jButton5)) layout.setVerticalGroup(
.addGap(11, 11, 11)
layout.createParallelGroup(javax.swing.GroupLayo
.addGroup(jPanel1Layout.createParallelGroup(java ut.Alignment.LEADING)
x.swing.GroupLayout.Alignment.TRAILING) .addComponent(jPanel1,
javax.swing.GroupLayout.DEFAULT_SIZE,
.addGroup(jPanel1Layout.createSequentialGroup() javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(jLabel25) Short.MAX_VALUE)
.addGap(26, 26, 26)) );
.addGroup(jPanel1Layout.createParallelGroup(java bindingGroup.bind();
x.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel19) java.awt.Dimension screenSize =
.addComponent(jTextField18, java.awt.Toolkit.getDefaultToolkit().getScreenSize(
javax.swing.GroupLayout.PREFERRED_SIZE, );
javax.swing.GroupLayout.DEFAULT_SIZE, setBounds((screenSize.width-750)/2,
javax.swing.GroupLayout.PREFERRED_SIZE))) (screenSize.height-534)/2, 750, 534);
}// </editor-fold>
.addPreferredGap(javax.swing.LayoutStyle.Compo
nentPlacement.RELATED) private void
jButton2ActionPerformed(java.awt.event.ActionEv
.addGroup(jPanel1Layout.createParallelGroup(java ent evt) {
x.swing.GroupLayout.Alignment.BASELINE) // TODO add your handling code here:
.addComponent(jLabel20) dispose();
.addComponent(jTextField19, }
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, private void
javax.swing.GroupLayout.PREFERRED_SIZE)) jButton1ActionPerformed(java.awt.event.ActionEv
.addGap(18, 18, 18) ent evt) {
// TODO add your handling code here:
.addGroup(jPanel1Layout.createParallelGroup(java }
x.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1, private void
javax.swing.GroupLayout.PREFERRED_SIZE, 31, jButton8ActionPerformed(java.awt.event.ActionEv
javax.swing.GroupLayout.PREFERRED_SIZE) ent evt) {
16
try {
rs.last(); jTextField13.setText(Integer.toString(rs.getInt(1)));
if (rs.isLast()) { jTextField1.setText(rs.getString(2));
rs.last(); jTextField2.setText(rs.getString(3));
} jTextField3.setText(rs.getString(4));
displayRecord(); jTextField4.setText(rs.getString(5));
} catch (Exception ex) { jTextField5.setText(rs.getString(6));
} jTextField6.setText(rs.getString(7));
} jTextField7.setText(rs.getString(8));
jTextField8.setText(rs.getString(9));
private void jTextField9.setText(rs.getString(10));
jButton6ActionPerformed(java.awt.event.ActionEv jTextField10.setText(rs.getString(11));
ent evt) { jTextField11.setText(rs.getString(12));
try { jTextField12.setText(rs.getString(13));
rs.previous(); jTextField15.setText(rs.getString(14));
if (rs.isFirst()) { jTextField16.setText(rs.getString(15));
rs.first(); }
} catch(Exception ec)
displayRecord(); {}
} catch (Exception ex) { }
}
} //DISABLE TEXT FIELDS AND AREA
private void disableTextF(){
private void jTextField1.setEditable(false);
jButton7ActionPerformed(java.awt.event.ActionEv jTextField2.setEditable(false);
ent evt) { jTextField3.setEditable(false);
try { jTextField4.setEditable(false);
rs.next(); jTextField5.setEditable(false);
if (rs.isLast()) { jTextField6.setEditable(false);
rs.last(); jTextField7.setEditable(false);
} jTextField8.setEditable(false);
displayRecord(); jTextField9.setEditable(false);
} catch (Exception ex) { jTextField10.setEditable(false);
} jTextField11.setEditable(false);
} jTextField12.setEditable(false);
jTextField13.setEditable(false);
private void jTextField15.setEditable(false);
jButton5ActionPerformed(java.awt.event.ActionEv jTextField16.setEditable(false);
ent evt) { }
try { /**
rs.first(); * @param args the command line arguments
if (rs.isFirst()) { */
rs.first(); public static void main(String args[]) {
} java.awt.EventQueue.invokeLater(new
displayRecord(); Runnable() {
} catch (Exception ex) { @Override
} public void run() {
} new CustomerMang().setVisible(true);
}
private void });
jTextField15ActionPerformed(java.awt.event.Actio }
nEvent evt) {
// TODO add your handling code here: // Variables declaration - do not modify
} private javax.swing.JButton jButton1;
public final void displayRecord(){ private javax.swing.JButton jButton2;
try private javax.swing.JButton jButton5;
{ private javax.swing.JButton jButton6;
17
private javax.swing.JButton jButton7; Connection con;
private javax.swing.JButton jButton8; Statement smt,smt1;
private javax.swing.JLabel jLabel1; ResultSet rs,rs1,rs2;
private javax.swing.JLabel jLabel10; String
private javax.swing.JLabel jLabel11; sid,spass,sfname,slname,sdesig,sadd,snum;
private javax.swing.JLabel jLabel12; /*CONSTRUCTOR OF CLASS WHERE DATABASE
private javax.swing.JLabel jLabel13; CONNECTION IS MADE AND
private javax.swing.JLabel jLabel14; OBJECT OF RESULTSET AND STATEMENT IS
private javax.swing.JLabel jLabel15; CREATED*/
private javax.swing.JLabel jLabel16; public StaffMang() {
private javax.swing.JLabel jLabel19; initComponents();
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel20; try
private javax.swing.JLabel jLabel25; {
private javax.swing.JLabel jLabel3; Class.forName("com.mysql.jdbc.Driver");
private javax.swing.JLabel jLabel4; con =
private javax.swing.JLabel jLabel5; DriverManager.getConnection("jdbc:mysql://local
private javax.swing.JLabel jLabel6; host:3306/hotel","root","root");
private javax.swing.JLabel jLabel7; String query = "SELECT * FROM login ORDER
private javax.swing.JLabel jLabel8; BY userid;";
private javax.swing.JLabel jLabel9; smt=con.createStatement();
private javax.swing.JPanel jPanel1; rs=smt.executeQuery(query);
private javax.swing.JTextField jTextField1; rs.next();
private javax.swing.JTextField jTextField10; displayRecord();
private javax.swing.JTextField jTextField11; }
private javax.swing.JTextField jTextField12; catch(Exception e)
private javax.swing.JTextField jTextField13; {
private javax.swing.JTextField jTextField15; e.printStackTrace();
private javax.swing.JTextField jTextField16; System.out.println(e.getMessage());
private javax.swing.JTextField jTextField18; }
private javax.swing.JTextField jTextField19; }
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3; @SuppressWarnings("unchecked")
private javax.swing.JTextField jTextField4; // <editor-fold defaultstate="collapsed"
private javax.swing.JTextField jTextField5; desc="Generated Code">
private javax.swing.JTextField jTextField6; private void initComponents() {
private javax.swing.JTextField jTextField7; bindingGroup = new
private javax.swing.JTextField jTextField8; org.jdesktop.beansbinding.BindingGroup();
private javax.swing.JTextField jTextField9;
private org.jdesktop.beansbinding.BindingGroup jPanel2 = new javax.swing.JPanel();
bindingGroup; jLabel1 = new javax.swing.JLabel();
// End of variables declaration jPanel1 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
} jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
***************************** jButton4 = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
STAFF DETAILS jLabel3 = new javax.swing.JLabel();
***************************** jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
import java.sql.*; jLabel7 = new javax.swing.JLabel();
import javax.swing.JOptionPane; jLabel8 = new javax.swing.JLabel();
jButton5 = new javax.swing.JButton();
public class StaffMang extends javax.swing.JFrame jButton6 = new javax.swing.JButton();
{ jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton();
18
jTextField1 = new javax.swing.JTextField(); jButton1.setText("New");
jTextField2 = new javax.swing.JTextField(); jButton1.addActionListener(new
jTextField3 = new javax.swing.JTextField(); java.awt.event.ActionListener() {
jTextField4 = new javax.swing.JTextField(); public void
jTextField5 = new javax.swing.JTextField(); actionPerformed(java.awt.event.ActionEvent evt) {
jTextField6 = new javax.swing.JTextField(); jButton1ActionPerformed(evt);
jScrollPane1 = new javax.swing.JScrollPane(); }
jTextArea1 = new javax.swing.JTextArea(); });
jLabel9 = new javax.swing.JLabel();
jTextField7 = new javax.swing.JTextField(); jButton2.setFont(new
jTextField8 = new javax.swing.JTextField(); java.awt.Font("Tahoma", 1, 14));
jTextField9 = new javax.swing.JTextField(); jButton2.setText("Edit");
jLabel10 = new javax.swing.JLabel(); jButton2.addActionListener(new
jLabel11 = new javax.swing.JLabel(); java.awt.event.ActionListener() {
jLabel12 = new javax.swing.JLabel(); public void
jButton9 = new javax.swing.JButton(); actionPerformed(java.awt.event.ActionEvent evt) {
jButton10 = new javax.swing.JButton(); jButton2ActionPerformed(evt);
}
});
setDefaultCloseOperation(javax.swing.WindowCon
stants.DISPOSE_ON_CLOSE); jButton3.setFont(new
setBounds(new java.awt.Rectangle(100, 50, 0, java.awt.Font("Tahoma", 1, 14));
0)); jButton3.setText("Delete");
setResizable(false); jButton3.addActionListener(new
java.awt.event.ActionListener() {
org.jdesktop.beansbinding.Binding binding = public void
org.jdesktop.beansbinding.Bindings.createAutoBin actionPerformed(java.awt.event.ActionEvent evt) {
ding(org.jdesktop.beansbinding.AutoBinding.Upda jButton3ActionPerformed(evt);
teStrategy.READ_WRITE, this, }
org.jdesktop.beansbinding.ELProperty.create("Hot });
el Reservation System || www.ezindagi.in ||"),
this, jButton4.setFont(new
org.jdesktop.beansbinding.BeanProperty.create("ti java.awt.Font("Tahoma", 1, 14));
tle")); jButton4.setText("Search");
bindingGroup.addBinding(binding); jButton4.addActionListener(new
java.awt.event.ActionListener() {
addWindowListener(new public void
java.awt.event.WindowAdapter() { actionPerformed(java.awt.event.ActionEvent evt) {
public void jButton4ActionPerformed(evt);
windowOpened(java.awt.event.WindowEvent evt) }
{ });
formWindowOpened(evt);
} jLabel2.setFont(new java.awt.Font("Tahoma",
}); 0, 12));
jLabel2.setText("Enter User ID");
jPanel2.setBackground(new
java.awt.Color(241, 241, 255)); jLabel3.setFont(new java.awt.Font("Tahoma",
0, 12));
jLabel1.setIcon(new jLabel3.setText("Enter Password");
javax.swing.ImageIcon(getClass().getResource("/to
p-aboutus.png"))); // NOI18N jLabel4.setFont(new java.awt.Font("Tahoma",
0, 12));
jPanel1.setBackground(new jLabel4.setText("Re Enter Password");
java.awt.Color(241, 241, 255));
jLabel5.setFont(new java.awt.Font("Tahoma",
jButton1.setFont(new 0, 12));
java.awt.Font("Tahoma", 1, 14)); jLabel5.setText("Enter First Name");
19
jTextField1.setEditable(false);
jLabel6.setFont(new java.awt.Font("Tahoma", jTextField1.setFont(new
0, 12)); java.awt.Font("Tahoma", 0, 12));
jLabel6.setText("Enter Last Name");
jTextField2.setEditable(false);
jLabel7.setFont(new java.awt.Font("Tahoma", jTextField2.setFont(new
0, 12)); java.awt.Font("Tahoma", 0, 12));
jLabel7.setText("Enter Contact No.");
jTextField3.setEditable(false);
jLabel8.setFont(new java.awt.Font("Tahoma", jTextField3.setFont(new
0, 12)); java.awt.Font("Tahoma", 0, 12));
jLabel8.setText("Enter Address");
jTextField4.setEditable(false);
jButton5.setFont(new jTextField4.setFont(new
java.awt.Font("Tahoma", 0, 12)); java.awt.Font("Tahoma", 0, 12));
jButton5.setText("First <<");
jButton5.addActionListener(new jTextField5.setEditable(false);
java.awt.event.ActionListener() { jTextField5.setFont(new
public void java.awt.Font("Tahoma", 0, 12));
actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt); jTextField6.setEditable(false);
} jTextField6.setFont(new
}); java.awt.Font("Tahoma", 0, 12));
jButton6.setFont(new jTextArea1.setColumns(20);
java.awt.Font("Tahoma", 0, 12)); jTextArea1.setEditable(false);
jButton6.setText("Previous <"); jTextArea1.setFont(new
jButton6.addActionListener(new java.awt.Font("Tahoma", 0, 12));
java.awt.event.ActionListener() { jTextArea1.setRows(5);
public void jScrollPane1.setViewportView(jTextArea1);
actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt); jLabel9.setFont(new java.awt.Font("Tahoma",
} 0, 12));
}); jLabel9.setText("Enter Designation");
jButton7.setFont(new jTextField7.setEditable(false);
java.awt.Font("Tahoma", 0, 12));
jButton7.setText("Next >"); jLabel10.setFont(new
jButton7.addActionListener(new java.awt.Font("Tahoma", 1, 11));
java.awt.event.ActionListener() { jLabel10.setText("Search Specific Staff by ");
public void
actionPerformed(java.awt.event.ActionEvent evt) { jLabel11.setText("User ID");
jButton7ActionPerformed(evt);
} jLabel12.setText(" Name");
});
jButton9.setFont(new
jButton8.setFont(new java.awt.Font("Tahoma", 1, 11));
java.awt.Font("Tahoma", 0, 12)); jButton9.setText("Close");
jButton8.setText("Last >>"); jButton9.addActionListener(new
jButton8.addActionListener(new java.awt.event.ActionListener() {
java.awt.event.ActionListener() { public void
public void actionPerformed(java.awt.event.ActionEvent evt) {
actionPerformed(java.awt.event.ActionEvent evt) { jButton9ActionPerformed(evt);
jButton8ActionPerformed(evt); }
} });
});
jButton10.setText("Search");
20
jButton10.addActionListener(new .addComponent(jTextField1,
java.awt.event.ActionListener() { javax.swing.GroupLayout.DEFAULT_SIZE, 194,
public void Short.MAX_VALUE)
actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(jTextField2,
jButton10ActionPerformed(evt); javax.swing.GroupLayout.DEFAULT_SIZE, 194,
} Short.MAX_VALUE)
}); .addComponent(jTextField3,
javax.swing.GroupLayout.DEFAULT_SIZE, 194,
javax.swing.GroupLayout jPanel1Layout = new Short.MAX_VALUE))
javax.swing.GroupLayout(jPanel1); .addComponent(jTextField4,
jPanel1.setLayout(jPanel1Layout); javax.swing.GroupLayout.Alignment.TRAILING,
jPanel1Layout.setHorizontalGroup( javax.swing.GroupLayout.PREFERRED_SIZE, 194,
javax.swing.GroupLayout.PREFERRED_SIZE)))
jPanel1Layout.createParallelGroup(javax.swing.Gr
oupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(javax.swing.GroupLayout.Alignment.TR .addGroup(jPanel1Layout.createParallelGroup(java
AILING, jPanel1Layout.createSequentialGroup() x.swing.GroupLayout.Alignment.LEADING)
.addGap(55, 55, 55) .addComponent(jLabel8)
.addComponent(jLabel7)
.addGroup(jPanel1Layout.createParallelGroup(java .addComponent(jLabel6))
x.swing.GroupLayout.Alignment.TRAILING)
.addPreferredGap(javax.swing.LayoutStyle.Compo
.addGroup(jPanel1Layout.createSequentialGroup() nentPlacement.RELATED, 21, Short.MAX_VALUE)
.addComponent(jLabel5)
.addGroup(jPanel1Layout.createParallelGroup(java
.addPreferredGap(javax.swing.LayoutStyle.Compo x.swing.GroupLayout.Alignment.LEADING, false)
nentPlacement.RELATED, 30, Short.MAX_VALUE) .addComponent(jScrollPane1,
.addComponent(jTextField5, javax.swing.GroupLayout.DEFAULT_SIZE, 194,
javax.swing.GroupLayout.PREFERRED_SIZE, 194, Short.MAX_VALUE)
javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jTextField6,
javax.swing.GroupLayout.DEFAULT_SIZE, 194,
.addGroup(jPanel1Layout.createSequentialGroup() Short.MAX_VALUE)
.addComponent(jTextField7))
.addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.TRAILING) .addPreferredGap(javax.swing.LayoutStyle.Compo
nentPlacement.RELATED)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(java
.addGroup(jPanel1Layout.createParallelGroup(java x.swing.GroupLayout.Alignment.TRAILING)
x.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2) .addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)
.addComponent(jLabel9)) .addPreferredGap(javax.swing.LayoutStyle.Compo
.addGap(24, 24, 24)) nentPlacement.RELATED)
.addComponent(jButton10,
.addGroup(jPanel1Layout.createSequentialGroup() javax.swing.GroupLayout.PREFERRED_SIZE, 76,
.addComponent(jLabel4) javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18))) .addGap(18, 18, 18)
.addComponent(jButton9,
.addGroup(jPanel1Layout.createParallelGroup(java javax.swing.GroupLayout.PREFERRED_SIZE, 73,
x.swing.GroupLayout.Alignment.LEADING) javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(java .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.TRAILING) x.swing.GroupLayout.Alignment.LEADING)
21
.addGroup(jPanel1Layout.createParallelGroup(java .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.LEADING) x.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel12)
.addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel11))
.addGap(32, 32, 32) .addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(java .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.TRAILING) x.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField9,
.addGroup(jPanel1Layout.createSequentialGroup() javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jTextField8,
.addGroup(jPanel1Layout.createParallelGroup(java javax.swing.GroupLayout.Alignment.TRAILING,
x.swing.GroupLayout.Alignment.LEADING) javax.swing.GroupLayout.PREFERRED_SIZE, 123,
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE))))
javax.swing.GroupLayout.DEFAULT_SIZE, 91,
Short.MAX_VALUE) .addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton3, .addGap(66, 66, 66)
javax.swing.GroupLayout.DEFAULT_SIZE, 91, .addComponent(jLabel10)
Short.MAX_VALUE)
.addComponent(jButton7, .addPreferredGap(javax.swing.LayoutStyle.Compo
javax.swing.GroupLayout.PREFERRED_SIZE, 91, nentPlacement.RELATED, 36,
javax.swing.GroupLayout.PREFERRED_SIZE)) javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGap(19, 19, 19))
.addPreferredGap(javax.swing.LayoutStyle.Compo );
nentPlacement.RELATED) jPanel1Layout.setVerticalGroup(
.addGroup(jPanel1Layout.createParallelGroup(java jPanel1Layout.createParallelGroup(javax.swing.Gr
x.swing.GroupLayout.Alignment.LEADING) oupLayout.Alignment.LEADING)
.addComponent(jButton2,
javax.swing.GroupLayout.PREFERRED_SIZE, 91, .addGroup(jPanel1Layout.createSequentialGroup()
javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()
.addComponent(jButton4,
javax.swing.GroupLayout.PREFERRED_SIZE, 91, .addGroup(jPanel1Layout.createParallelGroup(java
javax.swing.GroupLayout.PREFERRED_SIZE) x.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton8,
javax.swing.GroupLayout.PREFERRED_SIZE, 91, .addGroup(jPanel1Layout.createSequentialGroup()
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createParallelGroup(java
.addGroup(jPanel1Layout.createSequentialGroup() x.swing.GroupLayout.Alignment.LEADING)
.addComponent(jButton5,
javax.swing.GroupLayout.PREFERRED_SIZE, 91, .addGroup(jPanel1Layout.createSequentialGroup()
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(java
.addPreferredGap(javax.swing.LayoutStyle.Compo x.swing.GroupLayout.Alignment.BASELINE)
nentPlacement.RELATED) .addComponent(jTextField1,
.addComponent(jButton6))) javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
.addPreferredGap(javax.swing.LayoutStyle.Compo javax.swing.GroupLayout.PREFERRED_SIZE)
nentPlacement.RELATED, 17, .addComponent(jLabel2))
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.Compo
.addGroup(javax.swing.GroupLayout.Alignment.TR nentPlacement.RELATED)
AILING, jPanel1Layout.createSequentialGroup()
.addGap(25, 25, 25) .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
22
.addComponent(jTextField2, .addGap(10, 10, 10)
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, .addGroup(jPanel1Layout.createParallelGroup(java
javax.swing.GroupLayout.PREFERRED_SIZE)) x.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1,
.addPreferredGap(javax.swing.LayoutStyle.Compo javax.swing.GroupLayout.PREFERRED_SIZE, 30,
nentPlacement.RELATED) javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton2,
.addGroup(jPanel1Layout.createParallelGroup(java javax.swing.GroupLayout.PREFERRED_SIZE, 29,
x.swing.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTextField3,
javax.swing.GroupLayout.PREFERRED_SIZE, .addPreferredGap(javax.swing.LayoutStyle.Compo
javax.swing.GroupLayout.DEFAULT_SIZE, nentPlacement.UNRELATED)
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4)) .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.BASELINE)
.addPreferredGap(javax.swing.LayoutStyle.Compo .addComponent(jButton3,
nentPlacement.RELATED) javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(java .addComponent(jButton4,
x.swing.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.PREFERRED_SIZE, 30,
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE))
javax.swing.GroupLayout.PREFERRED_SIZE, .addGap(8, 8, 8)))
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createParallelGroup(java
.addComponent(jLabel9)) x.swing.GroupLayout.Alignment.LEADING)
.addPreferredGap(javax.swing.LayoutStyle.Compo .addGroup(jPanel1Layout.createSequentialGroup()
nentPlacement.RELATED) .addGap(27, 27, 27)
.addGroup(jPanel1Layout.createParallelGroup(java .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.BASELINE) x.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField5, .addComponent(jTextField7,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE) javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))) .addComponent(jLabel7))
.addGroup(javax.swing.GroupLayout.Alignment.TR .addPreferredGap(javax.swing.LayoutStyle.Compo
AILING, jPanel1Layout.createSequentialGroup() nentPlacement.RELATED)
.addPreferredGap(javax.swing.LayoutStyle.Compo .addGroup(jPanel1Layout.createParallelGroup(java
nentPlacement.RELATED, 2, x.swing.GroupLayout.Alignment.LEADING)
javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel8)
.addComponent(jScrollPane1,
.addGroup(jPanel1Layout.createParallelGroup(java javax.swing.GroupLayout.PREFERRED_SIZE, 98,
x.swing.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jButton6)
.addComponent(jButton5)) .addGroup(jPanel1Layout.createSequentialGroup()
.addGap(34, 34, 34)
.addPreferredGap(javax.swing.LayoutStyle.Compo .addComponent(jLabel10)
nentPlacement.RELATED)
.addPreferredGap(javax.swing.LayoutStyle.Compo
.addGroup(jPanel1Layout.createParallelGroup(java nentPlacement.UNRELATED)
x.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton7) .addGroup(jPanel1Layout.createParallelGroup(java
.addComponent(jButton8)) x.swing.GroupLayout.Alignment.BASELINE)
23
.addComponent(jTextField8, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1,
.addComponent(jLabel11)) javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.PREFERRED_SIZE, 626,
.addPreferredGap(javax.swing.LayoutStyle.Compo javax.swing.GroupLayout.PREFERRED_SIZE))
nentPlacement.RELATED) .addContainerGap(73,
Short.MAX_VALUE))
.addGroup(jPanel1Layout.createParallelGroup(java );
x.swing.GroupLayout.Alignment.BASELINE) jPanel2Layout.setVerticalGroup(
.addComponent(jTextField9,
javax.swing.GroupLayout.PREFERRED_SIZE, jPanel2Layout.createParallelGroup(javax.swing.Gr
javax.swing.GroupLayout.DEFAULT_SIZE, oupLayout.Alignment.LEADING)
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel12)) .addGroup(jPanel2Layout.createSequentialGroup()
.addGap(18, 18, 18) .addComponent(jLabel1)
.addGroup(jPanel1Layout.createParallelGroup(java .addPreferredGap(javax.swing.LayoutStyle.Compo
x.swing.GroupLayout.Alignment.BASELINE) nentPlacement.RELATED)
.addComponent(jButton9) .addComponent(jPanel1,
.addComponent(jButton10))))) javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
.addGroup(javax.swing.GroupLayout.Alignment.TR javax.swing.GroupLayout.PREFERRED_SIZE)
AILING, jPanel1Layout.createSequentialGroup() .addContainerGap(343,
Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.Compo );
nentPlacement.RELATED, 138,
javax.swing.GroupLayout.PREFERRED_SIZE) javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
.addGroup(jPanel1Layout.createParallelGroup(java getContentPane().setLayout(layout);
x.swing.GroupLayout.Alignment.BASELINE) layout.setHorizontalGroup(
.addComponent(jTextField6,
javax.swing.GroupLayout.PREFERRED_SIZE, layout.createParallelGroup(javax.swing.GroupLayo
javax.swing.GroupLayout.DEFAULT_SIZE, ut.Alignment.LEADING)
javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(layout.createSequentialGroup()
.addComponent(jLabel6)) .addComponent(jPanel2,
.addGap(135, 135, 135))) javax.swing.GroupLayout.PREFERRED_SIZE,
.addContainerGap(44, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)) javax.swing.GroupLayout.PREFERRED_SIZE)
);
.addContainerGap(javax.swing.GroupLayout.DEFA
javax.swing.GroupLayout jPanel2Layout = new ULT_SIZE, Short.MAX_VALUE))
javax.swing.GroupLayout(jPanel2); );
jPanel2.setLayout(jPanel2Layout); layout.setVerticalGroup(
jPanel2Layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayo
jPanel2Layout.createParallelGroup(javax.swing.Gr ut.Alignment.LEADING)
oupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup()
.addComponent(jPanel2,
.addGroup(jPanel2Layout.createSequentialGroup() javax.swing.GroupLayout.PREFERRED_SIZE,
.addGap(49, 49, 49) javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.TRAILING, false) .addContainerGap(javax.swing.GroupLayout.DEFA
.addComponent(jPanel1, ULT_SIZE, Short.MAX_VALUE))
javax.swing.GroupLayout.Alignment.LEADING, );
24
public void fetchFromTextF(){
bindingGroup.bind(); sid=jTextField1.getText();
spass=jTextField2.getText();
java.awt.Dimension screenSize = sdesig=jTextField4.getText();
java.awt.Toolkit.getDefaultToolkit().getScreenSize( sfname=jTextField5.getText();
); slname=jTextField6.getText();
setBounds((screenSize.width-750)/2, snum=jTextField7.getText();
(screenSize.height-530)/2, 750, 530); sadd=jTextArea1.getText();
}// </editor-fold> }
//FETCH THE VALUES FROM DATABASE TO TEXT //EDIT STAFF RECORD
FIELDS AND TEXT AREA private void
public final void displayRecord(){ jButton2ActionPerformed(java.awt.event.ActionEv
try ent evt) {
{ enableTextF();
jTextField1.setText(rs.getString(1)); jTextField1.setEnabled(false);
jTextField2.setText(rs.getString(2)); jTextField2.setText(spass);
jTextField4.setText(rs.getString(3)); try{
jTextField5.setText(rs.getString(4));
jTextField6.setText(rs.getString(5)); if(evt.getActionCommand().equals("Update"))
jTextField7.setText(rs.getString(6)); {
jTextArea1.setText(rs.getString(7)); fetchFromTextF();
} int
catch(Exception ec) code=JOptionPane.showConfirmDialog(this,"Infor
{} mation of " + sfname + " will change in
} database.","Confirmation",JOptionPane.YES_NO_C
//ENABLE TEXT FIELDS AND AREA ANCEL_OPTION,JOptionPane.INFORMATION_MES
public void enableTextF(){ SAGE);
jTextField1.setEditable(true); if(code==JOptionPane.YES_OPTION)
jTextField2.setEditable(true); {
jTextField3.setEditable(true); String updatequery="update login set
jTextField4.setEditable(true); userid =
jTextField5.setEditable(true); '"+sid+"',password='"+spass+"',Staffdesig='"+sdesi
jTextField6.setEditable(true); g+"',StaffFName='"+sfname+"',StaffLName='"+slna
jTextField7.setEditable(true); me+"',StaffAdd='"+sadd+"',StaffContactNo='"+snu
jTextArea1.setEditable(true); m+"' where userid like '"+sid+"';";
} smt=con.createStatement();
//DISABLE TEXT FIELDS AND AREA int
public void disableTextF(){ success=smt.executeUpdate(updatequery);
if(success>0)
} {
//CLEAR TEXT FIELDS AND AREA
public void clearTextF(){ JOptionPane.showMessageDialog(this, "Record
try Modified");
{ jButton1.setText("Edit");
jTextField1.setText(null); }
jTextField2.setText(null); else
jTextField4.setText(null); {
jTextField5.setText(null);
jTextField6.setText(null); JOptionPane.showMessageDialog(this, "Problem in
jTextField7.setText(null); mofifying. Retry");
jTextArea1.setText(null); }
} }
catch(Exception ec) else
{} { }
} }
//GET THE VALUES FROM TEXT FIELDS AND else
AREA if(evt.getActionCommand().equals("Edit"))
25
{ displayRecord();
JOptionPane.showMessageDialog(this, }
"You are about to change the existing information catch(Exception ex)
of current selected staff"); {
jButton2.setText("Update"); ex.printStackTrace();
} }
} }
catch(Exception ex) else if((!seaID.equals("")) &&
{ seaFN.equals("") && (!seaLN.equals("")))
ex.printStackTrace(); {
} try{
} String query = "SELECT * FROM login
//SEARCH STAFF RECORD where userid LIKE '"+seaID+"' AND StaffLName
private void LIKE '"+seaLN+"';";
jButton4ActionPerformed(java.awt.event.ActionEv smt=con.createStatement();
ent evt) { rs=smt.executeQuery(query);
disableTextF(); rs.next();
String seaID=jTextField8.getText(); displayRecord();
String seaFN=jTextField9.getText(); }
String seaLN=jTextField9.getText(); catch(Exception ex)
{
if(seaID.equals("")&&seaFN.equals("")&&seaLN.eq ex.printStackTrace();
uals("")) }
{ }
JOptionPane.showMessageDialog(this, else if(seaID.equals("") &&
"Select at least 1 option for search"); (!seaFN.equals("")) && (!seaLN.equals("")))
} {
else try{
{ String query = "SELECT * FROM login
if((!seaID.equals("")) && (!seaFN.equals("")) where StaffFName LIKE '"+seaFN+"' AND
&& (!seaLN.equals(""))) StaffLName LIKE '"+seaLN+"';";
{ smt=con.createStatement();
try{ rs=smt.executeQuery(query);
String query = "SELECT * FROM login rs.next();
where userid LIKE '"+seaID+"' AND StaffFName displayRecord();
LIKE '"+seaFN+"' AND StaffLName LIKE }
'"+seaLN+"';"; catch(Exception ex)
smt=con.createStatement(); {
rs=smt.executeQuery(query); ex.printStackTrace();
rs.next(); }
displayRecord(); }
} else if((!seaID.equals("")) &&
catch(Exception ex) seaFN.equals("") && seaLN.equals(""))
{ {
ex.printStackTrace(); try{
} String query = "SELECT * FROM login
} where userid LIKE '"+seaID+"';";
else if((!seaID.equals("")) && smt=con.createStatement();
(!seaFN.equals("")) && seaLN.equals("")) rs=smt.executeQuery(query);
{ rs.next();
try{ displayRecord();
String query = "SELECT * FROM login }
where userid LIKE '"+seaID+"' AND StaffFName catch(Exception ex)
LIKE '"+seaFN+"';"; {
smt=con.createStatement(); ex.printStackTrace();
rs=smt.executeQuery(query); }
rs.next(); }
26
else if(seaID.equals("") && }
(!seaFN.equals("")) && seaLN.equals("")) catch(Exception ex) {}
{ }
try{ //MOVE ON FIRST RECORD
String query = "SELECT * FROM login private void
where StaffFName LIKE '"+seaFN+"';"; jButton5ActionPerformed(java.awt.event.ActionEv
smt=con.createStatement(); ent evt) {
rs=smt.executeQuery(query); try
rs.next(); {
displayRecord(); rs.first();
} if(rs.isFirst())
catch(Exception ex) rs.first();
{ displayRecord();
ex.printStackTrace(); }
} catch(Exception ex) {}
} }
else if(seaID.equals("") && seaFN.equals("") //MOVE ON NEXT RECORD
&& (!seaLN.equals(""))) private void
{ jButton7ActionPerformed(java.awt.event.ActionEv
try{ ent evt) {
String query = "SELECT * FROM login try
where StaffLName LIKE '"+seaLN+"';"; {
smt=con.createStatement(); rs.next();
rs=smt.executeQuery(query); if(rs.isLast())
rs.next(); rs.last();
displayRecord(); displayRecord();
} }
catch(Exception ex) catch(Exception ex) {}
{ }
ex.printStackTrace(); //TOOL TIPS SETTING
} private void
} formWindowOpened(java.awt.event.WindowEven
} t evt) {
} jTextField1.setToolTipText("This is an Unique
//MOVE ON LAST RECORD ID");
private void jTextField3.setToolTipText("Re Enter the same
jButton8ActionPerformed(java.awt.event.ActionEv Password");
ent evt) { jButton4.setToolTipText("First select the
try option for searching");
{ jTextField8.setToolTipText("User ID is case
rs.last(); sensitive");
if(rs.isLast()) jTextField9.setToolTipText("First Name is case
rs.last(); sensitive");
displayRecord(); jTextField9.setToolTipText("Last Name is case
} sensitive");
catch(Exception ex) {} jButton3.setToolTipText("Current Selected
} Staff Record will be DELETED");
//MOVE ON PREVIOUS RECORD jButton9.setToolTipText("Close Window");
private void }
jButton6ActionPerformed(java.awt.event.ActionEv //ADD RECORD OF STAFF
ent evt) { private void
try jButton1ActionPerformed(java.awt.event.ActionEv
{ ent evt) {
rs.previous(); try{
if(rs.isFirst()) clearTextF();
rs.first(); enableTextF();
displayRecord();
27
String query = "SELECT * FROM login where JOptionPane.showMessageDialog(this,"User
userid like '"+jTextField1.getText()+"';"; ID already taken, Give another User ID");
smt=con.createStatement(); }
rs1=smt.executeQuery(query); catch(Exception ex)
if(!rs1.next()){ { }
try{ }
//DELETE RECORD OF STAFF
if(evt.getActionCommand().equals("Save")) private void
{ jButton3ActionPerformed(java.awt.event.ActionEv
fetchFromTextF(); ent evt) {
int jTextField3.setText(spass);
code=JOptionPane.showConfirmDialog(this,"Infor try{
mation of " + sfname + " will be added in
database.","Confirmation",JOptionPane.YES_NO_C if(evt.getActionCommand().equals("Confirm"))
ANCEL_OPTION,JOptionPane.INFORMATION_MES {
SAGE); fetchFromTextF();
if(code==JOptionPane.YES_OPTION) int
{ code=JOptionPane.showConfirmDialog(this,"Infor
String insertquery="insert into mation of " + sfname + " will be deleted from
login(userid,password,Staffdesig,StaffFName,StaffL database.","Confirmation",JOptionPane.YES_NO_C
Name,StaffAdd,StaffContactNo)values('"+sid+"','"+ ANCEL_OPTION,JOptionPane.INFORMATION_MES
spass+"','"+sdesig+"','"+sfname+"','"+slname+"','"+ SAGE);
sadd+"','"+snum+"');"; if(code==JOptionPane.YES_OPTION)
smt=con.createStatement(); {
int String updatequery="DELETE from login
success=smt.executeUpdate(insertquery); where userid like '"+sid+"';";
if(success>0) smt=con.createStatement();
{ int
success=smt.executeUpdate(updatequery);
JOptionPane.showMessageDialog(this, "Record if(success>0)
Saved"); {
jButton1.setText("New");
} JOptionPane.showMessageDialog(this, "Record
else Deleted");
{ jButton1.setText("Delete");
}
JOptionPane.showMessageDialog(this, "Problem in else
Saving. Retry"); {
}
} JOptionPane.showMessageDialog(this, "Problem in
else deletion. Retry");
{ } }
} }
else else
if(evt.getActionCommand().equals("New")) { }
{ }
clearTextF(); else
jButton1.setText("Save"); if(evt.getActionCommand().equals("Delete"))
} {
} JOptionPane.showMessageDialog(this,
catch(Exception ex) "Your confirmation will delete the record of
{ current selected staff");
ex.printStackTrace(); jButton2.setText("Confirm");
} }
} }
else catch(Exception ex)
{
28
ex.printStackTrace();
} *****************************
}
//CLOSE BUTTON ROOM DETAILS
private void *****************************
jButton9ActionPerformed(java.awt.event.ActionEv
ent evt) { import java.sql.*;
this.dispose(); import javax.swing.JOptionPane;
} public class RoomMang extends
javax.swing.JFrame {
private void
jButton10ActionPerformed(java.awt.event.ActionE Connection con;
vent evt) { Statement smt,smt1;
// TODO add your handling code here: ResultSet rs,rs1,rs2;
} String rno,rtype,rbed;
int rrate;
// Variables declaration - do not modify public RoomMang() {
private javax.swing.JButton jButton1; initComponents();
private javax.swing.JButton jButton10; try
private javax.swing.JButton jButton2; {
private javax.swing.JButton jButton3; Class.forName("com.mysql.jdbc.Driver");
private javax.swing.JButton jButton4; con =
private javax.swing.JButton jButton5; DriverManager.getConnection("jdbc:mysql://local
private javax.swing.JButton jButton6; host:3306/hotel","root","root");
private javax.swing.JButton jButton7; String query = "SELECT * FROM roomdetail
private javax.swing.JButton jButton8; ORDER BY room_no;";
private javax.swing.JButton jButton9; smt=con.createStatement();
private javax.swing.JLabel jLabel1; rs=smt.executeQuery(query);
private javax.swing.JLabel jLabel10; rs.next();
private javax.swing.JLabel jLabel11; displayRecord();
private javax.swing.JLabel jLabel12; }
private javax.swing.JLabel jLabel2; catch(Exception e)
private javax.swing.JLabel jLabel3; {
private javax.swing.JLabel jLabel4; e.printStackTrace();
private javax.swing.JLabel jLabel5; System.out.println(e.getMessage());
private javax.swing.JLabel jLabel6; }
private javax.swing.JLabel jLabel7; }
private javax.swing.JLabel jLabel8; //FETCH THE VALUES FROM DATABASE TO TEXT
private javax.swing.JLabel jLabel9; FIELDS AND TEXT AREA
private javax.swing.JPanel jPanel1; public final void displayRecord(){
private javax.swing.JPanel jPanel2; try
private javax.swing.JScrollPane jScrollPane1; {
private javax.swing.JTextArea jTextArea1; jTextField1.setText(rs.getString(1));
private javax.swing.JTextField jTextField1; jTextField2.setText(rs.getString(2));
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3; jTextField3.setText(Integer.toString(rs.getInt(3)));
private javax.swing.JTextField jTextField4; jTextField4.setText(rs.getString(4));
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6; }
private javax.swing.JTextField jTextField7; catch(Exception ec)
private javax.swing.JTextField jTextField8; {}
private javax.swing.JTextField jTextField9; }
private org.jdesktop.beansbinding.BindingGroup //GET THE VALUES FROM TEXT FIELDS AND
bindingGroup; AREA
// End of variables declaration public void fetchFromTextF(){
} rno=jTextField1.getText();
29
rtype=jTextField2.getText();
rrate=Integer.parseInt(jTextField3.getText());
rbed=jTextField4.getText(); setDefaultCloseOperation(javax.swing.WindowCon
} stants.DISPOSE_ON_CLOSE);
//DISABLE TEXT FIELDS AND AREA setBounds(new java.awt.Rectangle(250, 60, 0,
public void disableTextF(){ 0));
jTextField1.setEditable(false); setResizable(false);
jTextField2.setEditable(false);
jTextField3.setEditable(false); org.jdesktop.beansbinding.Binding binding =
jTextField4.setEditable(false); org.jdesktop.beansbinding.Bindings.createAutoBin
} ding(org.jdesktop.beansbinding.AutoBinding.Upda
//CLEAR TEXT FIELDS AND AREA teStrategy.READ_WRITE, this,
public void clearTextF(){ org.jdesktop.beansbinding.ELProperty.create("Hot
try el Reservation System || www.ezindagi.in ||"),
{ this,
jTextField1.setText(null); org.jdesktop.beansbinding.BeanProperty.create("ti
jTextField2.setText(null); tle"));
jTextField3.setText(null); bindingGroup.addBinding(binding);
jTextField4.setText(null);
} jPanel1.setBackground(new
catch(Exception ec) java.awt.Color(241, 241, 255));
{}
} jLabel2.setFont(new java.awt.Font("Tahoma",
//ENABLE TEXT FIELDS AND AREA 0, 12));
public void enableTextF(){ jLabel2.setText("Room No.");
jTextField1.setEditable(true);
jTextField2.setEditable(true); jLabel3.setFont(new java.awt.Font("Tahoma",
jTextField3.setEditable(true); 0, 12));
jTextField4.setEditable(true); jLabel3.setText("<html>Room Type (AC/NON
} AC)</html>");
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" jLabel4.setFont(new java.awt.Font("Tahoma",
desc="Generated Code"> 0, 12));
private void initComponents() { jLabel4.setText("Room Rate");
bindingGroup = new
org.jdesktop.beansbinding.BindingGroup(); jLabel5.setFont(new java.awt.Font("Tahoma",
0, 12));
jPanel1 = new javax.swing.JPanel(); jLabel5.setText("<html>Bed Type
jLabel2 = new javax.swing.JLabel(); (Single/Double)</html>");
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel(); jTextField1.setFont(new
jLabel5 = new javax.swing.JLabel(); java.awt.Font("Tahoma", 0, 12));
jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField(); jTextField2.setFont(new
jButton5 = new javax.swing.JButton(); java.awt.Font("Tahoma", 0, 12));
jButton7 = new javax.swing.JButton();
jButton8 = new javax.swing.JButton(); jButton5.setFont(new
jButton6 = new javax.swing.JButton(); java.awt.Font("Tahoma", 0, 12));
jTextField3 = new javax.swing.JTextField(); jButton5.setText("First <<");
jTextField4 = new javax.swing.JTextField(); jButton5.addActionListener(new
jButton4 = new javax.swing.JButton(); java.awt.event.ActionListener() {
jTextField5 = new javax.swing.JTextField(); public void
jButton1 = new javax.swing.JButton(); actionPerformed(java.awt.event.ActionEvent evt) {
jButton2 = new javax.swing.JButton(); jButton5ActionPerformed(evt);
jButton3 = new javax.swing.JButton(); }
jLabel1 = new javax.swing.JLabel(); });
jButton9 = new javax.swing.JButton();
30
jButton7.setFont(new });
java.awt.Font("Tahoma", 0, 12));
jButton7.setText("Next >"); jButton2.setFont(new
jButton7.addActionListener(new java.awt.Font("Tahoma", 1, 12));
java.awt.event.ActionListener() { jButton2.setText("Update");
public void jButton2.addActionListener(new
actionPerformed(java.awt.event.ActionEvent evt) { java.awt.event.ActionListener() {
jButton7ActionPerformed(evt); public void
} actionPerformed(java.awt.event.ActionEvent evt) {
}); jButton2ActionPerformed(evt);
}
jButton8.setFont(new });
java.awt.Font("Tahoma", 0, 12));
jButton8.setText("Last >>"); jButton3.setFont(new
jButton8.addActionListener(new java.awt.Font("Tahoma", 1, 12));
java.awt.event.ActionListener() { jButton3.setText("Delete");
public void jButton3.addActionListener(new
actionPerformed(java.awt.event.ActionEvent evt) { java.awt.event.ActionListener() {
jButton8ActionPerformed(evt); public void
} actionPerformed(java.awt.event.ActionEvent evt) {
}); jButton3ActionPerformed(evt);
}
jButton6.setFont(new });
java.awt.Font("Tahoma", 0, 12));
jButton6.setText("Previous <"); jLabel1.setIcon(new
jButton6.addActionListener(new javax.swing.ImageIcon(getClass().getResource("/to
java.awt.event.ActionListener() { p-aboutus.png"))); // NOI18N
public void
actionPerformed(java.awt.event.ActionEvent evt) { jButton9.setFont(new
jButton6ActionPerformed(evt); java.awt.Font("Tahoma", 1, 11));
} jButton9.setText("CLOSE");
}); jButton9.addActionListener(new
java.awt.event.ActionListener() {
jTextField3.setFont(new public void
java.awt.Font("Tahoma", 0, 12)); actionPerformed(java.awt.event.ActionEvent evt) {
jButton9ActionPerformed(evt);
jTextField4.setFont(new }
java.awt.Font("Tahoma", 0, 12)); });
31
.addGroup(jPanel1Layout.createParallelGroup(java .addPreferredGap(javax.swing.LayoutStyle.Compo
x.swing.GroupLayout.Alignment.TRAILING) nentPlacement.RELATED)
.addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.LEADING)
.addPreferredGap(javax.swing.LayoutStyle.Compo
nentPlacement.RELATED, 451, .addGroup(jPanel1Layout.createSequentialGroup()
javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButton5,
.addComponent(jButton9, javax.swing.GroupLayout.PREFERRED_SIZE, 91,
javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.Compo
.addGroup(jPanel1Layout.createSequentialGroup() nentPlacement.UNRELATED)
.addGap(11, 11, 11) .addComponent(jButton6))
.addGroup(jPanel1Layout.createParallelGroup(java .addGroup(jPanel1Layout.createSequentialGroup()
x.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5) .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jPanel1Layout.createParallelGroup(java .addComponent(jButton4,
x.swing.GroupLayout.Alignment.TRAILING) javax.swing.GroupLayout.Alignment.LEADING,
.addComponent(jLabel4) javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(jLabel3) javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(jLabel2))) Short.MAX_VALUE)
.addGap(24, 24, 24) .addComponent(jButton7,
javax.swing.GroupLayout.Alignment.LEADING,
.addGroup(jPanel1Layout.createParallelGroup(java javax.swing.GroupLayout.PREFERRED_SIZE, 91,
x.swing.GroupLayout.Alignment.LEADING) javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTextField4,
javax.swing.GroupLayout.DEFAULT_SIZE, 108, .addPreferredGap(javax.swing.LayoutStyle.Compo
Short.MAX_VALUE) nentPlacement.UNRELATED)
.addComponent(jTextField3,
javax.swing.GroupLayout.Alignment.TRAILING, .addGroup(jPanel1Layout.createParallelGroup(java
javax.swing.GroupLayout.DEFAULT_SIZE, 108, x.swing.GroupLayout.Alignment.LEADING, false)
Short.MAX_VALUE)
.addComponent(jTextField1, .addComponent(jTextField5)
javax.swing.GroupLayout.DEFAULT_SIZE, 108, .addComponent(jButton8,
Short.MAX_VALUE) javax.swing.GroupLayout.PREFERRED_SIZE, 91,
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE))))))
javax.swing.GroupLayout.DEFAULT_SIZE, 108, .addGap(33, 33, 33)))
Short.MAX_VALUE)) .addGap(73, 73, 73))
.addGap(34, 34, 34) );
jPanel1Layout.setVerticalGroup(
.addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.LEADING, false) jPanel1Layout.createParallelGroup(javax.swing.Gr
.addComponent(jButton3, oupLayout.Alignment.LEADING)
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, .addGroup(jPanel1Layout.createSequentialGroup()
Short.MAX_VALUE) .addGap(21, 21, 21)
.addComponent(jButton1, .addComponent(jLabel1,
javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 162,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
javax.swing.GroupLayout.DEFAULT_SIZE, .addGap(68, 68, 68)
Short.MAX_VALUE)
.addComponent(jButton2, .addGroup(jPanel1Layout.createParallelGroup(java
javax.swing.GroupLayout.Alignment.TRAILING)) x.swing.GroupLayout.Alignment.LEADING)
32
.addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.BASELINE)
.addGroup(jPanel1Layout.createParallelGroup(java .addComponent(jButton7)
x.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton8)
.addComponent(jTextField1, .addComponent(jButton2))
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, .addPreferredGap(javax.swing.LayoutStyle.Compo
javax.swing.GroupLayout.PREFERRED_SIZE) nentPlacement.RELATED)
.addComponent(jLabel2))
.addGroup(jPanel1Layout.createParallelGroup(java
.addPreferredGap(javax.swing.LayoutStyle.Compo x.swing.GroupLayout.Alignment.BASELINE)
nentPlacement.UNRELATED) .addComponent(jButton3)
.addComponent(jButton4)
.addGroup(jPanel1Layout.createParallelGroup(java .addComponent(jTextField5,
x.swing.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.PREFERRED_SIZE,
.addComponent(jLabel3) javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE))))
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, .addPreferredGap(javax.swing.LayoutStyle.Compo
javax.swing.GroupLayout.PREFERRED_SIZE)) nentPlacement.RELATED, 69, Short.MAX_VALUE)
.addComponent(jButton9)
.addPreferredGap(javax.swing.LayoutStyle.Compo .addGap(32, 32, 32))
nentPlacement.UNRELATED) );
33
setBounds((screenSize.width-750)/2, private void
(screenSize.height-530)/2, 750, 530); jButton1ActionPerformed(java.awt.event.ActionEv
}// </editor-fold> ent evt) {
//MOVE ON FIRST ROOM try {
private void clearTextF();
jButton5ActionPerformed(java.awt.event.ActionEv enableTextF();
ent evt) { String query = "SELECT * FROM roomdetail
try { where room_no like '" + jTextField1.getText() +
rs.first(); "';";
if (rs.isFirst()) { smt = con.createStatement();
rs.first(); rs1 = smt.executeQuery(query);
} if (!rs1.next()) {
displayRecord(); try {
} catch (Exception ex) { if
} (evt.getActionCommand().equals("Save")) {
} fetchFromTextF();
//MOVE ON NEXT ROOM int code =
private void JOptionPane.showConfirmDialog(this,
jButton7ActionPerformed(java.awt.event.ActionEv "Information of Room No." + rno + " will be added
ent evt) { in database.", "Confirmation",
try { JOptionPane.YES_NO_CANCEL_OPTION,
rs.next(); JOptionPane.INFORMATION_MESSAGE);
if (rs.isLast()) { if (code == JOptionPane.YES_OPTION)
rs.last(); {
} String insertquery = "insert into
displayRecord(); roomdetail(room_no,room_type,room_rate,room
} catch (Exception ex) { _bed)values('" + jTextField1.getText() + "','" +
} jTextField2.getText() + "'," + jTextField3.getText() +
} ",'" + jTextField4.getText() + "');";
//MOVE ON LAST ROOM smt = con.createStatement();
private void int success =
jButton8ActionPerformed(java.awt.event.ActionEv smt.executeUpdate(insertquery);
ent evt) { if (success > 0) {
try {
rs.last(); JOptionPane.showMessageDialog(this, "Record
if (rs.isLast()) { Saved");
rs.last(); jButton1.setText("New");
} } else {
displayRecord();
} catch (Exception ex) { JOptionPane.showMessageDialog(this, "Problem in
} Saving. Retry");
} }
//MOVE ON PREVIOUS ROOM } else {
private void }
jButton6ActionPerformed(java.awt.event.ActionEv } else if
ent evt) { (evt.getActionCommand().equals("New")) {
try { clearTextF();
rs.previous(); jButton1.setText("Save");
if (rs.isFirst()) { }
rs.first(); } catch (Exception ex) {
} ex.printStackTrace();
displayRecord(); }
} catch (Exception ex) { } else {
} JOptionPane.showMessageDialog(this,
} "Room No. already used, Give another Room
//ADD NEW ROOM No.");
}
34
} catch (Exception ex) { fetchFromTextF();
} int code =
} JOptionPane.showConfirmDialog(this, "Room No"
//EDIT AND UPDATE EXISTING ROOM + rno + " will be deleted from database.",
private void "Confirmation",
jButton2ActionPerformed(java.awt.event.ActionEv JOptionPane.YES_NO_CANCEL_OPTION,
ent evt) { JOptionPane.INFORMATION_MESSAGE);
enableTextF(); if (code == JOptionPane.YES_OPTION) {
jTextField1.setEnabled(false); String updatequery = "DELETE from
try { roomdetail where room_no like '" + rno + "';";
if smt = con.createStatement();
(evt.getActionCommand().equals("Update")) { int success =
fetchFromTextF(); smt.executeUpdate(updatequery);
int code = if (success > 0) {
JOptionPane.showConfirmDialog(this,
"Information of Room No." + rno + " will change in JOptionPane.showMessageDialog(this, "Record
database.", "Confirmation", Deleted");
JOptionPane.YES_NO_CANCEL_OPTION, jButton1.setText("Delete");
JOptionPane.INFORMATION_MESSAGE); } else {
if (code == JOptionPane.YES_OPTION) {
String updatequery = "update JOptionPane.showMessageDialog(this, "Problem in
roomdetail set room_no = '" + rno + deletion. Retry");
"',room_type='" + rtype + "',room_rate=" + rrate + }
",room_bed='" + rbed + "';"; } else {
smt = con.createStatement(); }
int success = } else if
smt.executeUpdate(updatequery); (evt.getActionCommand().equals("Delete")) {
if (success > 0) { JOptionPane.showMessageDialog(this,
"Your confirmation will delete the record of
JOptionPane.showMessageDialog(this, "Record current selected room");
Modified"); jButton2.setText("Confirm");
jButton1.setText("Edit"); }
} else { } catch (Exception ex) {
ex.printStackTrace();
JOptionPane.showMessageDialog(this, "Problem in }
mofifying. Retry"); }
} //SEARCH ROOM NO
} else { private void
} jButton4ActionPerformed(java.awt.event.ActionEv
} else if ent evt) {
(evt.getActionCommand().equals("Edit")) { disableTextF();
JOptionPane.showMessageDialog(this, String srno=jTextField5.getText();
"You are about to change the existing information if(rno.equals(""))
of current selected room"); {
jButton2.setText("Update"); JOptionPane.showMessageDialog(this,
} "Enter Room No. you want to search");
} catch (Exception ex) { }
ex.printStackTrace(); else if(!rno.equals(""))
} {
} try{
//DELETE EXISTING ROOM String query = "SELECT * FROM roomdetail
private void where room_no LIKE '"+srno+"';";
jButton3ActionPerformed(java.awt.event.ActionEv smt=con.createStatement();
ent evt) { rs=smt.executeQuery(query);
try { rs.next();
if displayRecord();
(evt.getActionCommand().equals("Confirm")) { }
35
catch(Exception ex) try
{ {
ex.printStackTrace(); Class.forName("com.mysql.jdbc.Driver");
} con =
} DriverManager.getConnection("jdbc:mysql://local
} host:3306/hotel","root","root");
String query = "SELECT * FROM
private void bookingtable ORDER BY book_id;";
jButton9ActionPerformed(java.awt.event.ActionEv smt=con.createStatement();
ent evt) { rs=smt.executeQuery(query);
// TODO add your handling code here: rs.next();
dispose(); displayRecord();
} }
catch(Exception e)
// Variables declaration - do not modify {
private javax.swing.JButton jButton1; e.printStackTrace();
private javax.swing.JButton jButton2; System.out.println(e.getMessage());
private javax.swing.JButton jButton3; }
private javax.swing.JButton jButton4; }
private javax.swing.JButton jButton5;
private javax.swing.JButton jButton6; public final void displayRecord(){
private javax.swing.JButton jButton7; try
private javax.swing.JButton jButton8; {
private javax.swing.JButton jButton9;
private javax.swing.JLabel jLabel1; jTextField1.setText(Integer.toString(rs.getInt(1)));
private javax.swing.JLabel jLabel2; jTextField2.setText(rs.getString(2));
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4; jTextField4.setText(Integer.toString(rs.getInt(5)));
private javax.swing.JLabel jLabel5; jTextField5.setText(rs.getString(3));
private javax.swing.JPanel jPanel1; jTextField6.setText(rs.getString(4));
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2; }
private javax.swing.JTextField jTextField3; catch(Exception e)
private javax.swing.JTextField jTextField4; {
private javax.swing.JTextField jTextField5;
private org.jdesktop.beansbinding.BindingGroup }
bindingGroup; }
// End of variables declaration @SuppressWarnings("unchecked")
} // <editor-fold defaultstate="collapsed"
desc="Generated Code">
private void initComponents() {
bindingGroup = new
***************************** org.jdesktop.beansbinding.BindingGroup();
BOOKING DETAILS
jPanel1 = new javax.swing.JPanel();
***************************** jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
import java.sql.*; jLabel5 = new javax.swing.JLabel();
import javax.swing.JOptionPane; jLabel6 = new javax.swing.JLabel();
public class BookingMang extends jLabel7 = new javax.swing.JLabel();
javax.swing.JFrame { jTextField1 = new javax.swing.JTextField();
jTextField2 = new javax.swing.JTextField();
Connection con; jTextField4 = new javax.swing.JTextField();
Statement smt,smt1,smt10; jTextField5 = new javax.swing.JTextField();
ResultSet rs,rs1,rs2,rs10; jTextField6 = new javax.swing.JTextField();
public BookingMang() { jButton5 = new javax.swing.JButton();
initComponents(); jButton7 = new javax.swing.JButton();
36
jButton8 = new javax.swing.JButton(); jTextField5.setFont(new
jButton6 = new javax.swing.JButton(); java.awt.Font("Tahoma", 0, 12));
jButton2 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel(); jTextField6.setFont(new
jButton9 = new javax.swing.JButton(); java.awt.Font("Tahoma", 0, 12));
jButton5.setFont(new
setDefaultCloseOperation(javax.swing.WindowCon java.awt.Font("Tahoma", 0, 12));
stants.DISPOSE_ON_CLOSE); jButton5.setText("First <<");
setBounds(new java.awt.Rectangle(250, 70, 0, jButton5.addActionListener(new
0)); java.awt.event.ActionListener() {
setResizable(false); public void
actionPerformed(java.awt.event.ActionEvent evt) {
org.jdesktop.beansbinding.Binding binding = jButton5ActionPerformed(evt);
org.jdesktop.beansbinding.Bindings.createAutoBin }
ding(org.jdesktop.beansbinding.AutoBinding.Upda });
teStrategy.READ_WRITE, this,
org.jdesktop.beansbinding.ELProperty.create("Hot jButton7.setFont(new
el Reservation System || www.ezindagi.in ||"), java.awt.Font("Tahoma", 0, 12));
this, jButton7.setText("Next >");
org.jdesktop.beansbinding.BeanProperty.create("ti jButton7.addActionListener(new
tle")); java.awt.event.ActionListener() {
bindingGroup.addBinding(binding); public void
actionPerformed(java.awt.event.ActionEvent evt) {
jPanel1.setBackground(new jButton7ActionPerformed(evt);
java.awt.Color(241, 241, 255)); }
});
jLabel2.setFont(new java.awt.Font("Tahoma",
0, 12)); jButton8.setFont(new
jLabel2.setText("Book ID"); java.awt.Font("Tahoma", 0, 12));
jButton8.setText("Last >>");
jLabel3.setFont(new java.awt.Font("Tahoma", jButton8.addActionListener(new
0, 12)); java.awt.event.ActionListener() {
jLabel3.setText("Room No."); public void
actionPerformed(java.awt.event.ActionEvent evt) {
jLabel5.setFont(new java.awt.Font("Tahoma", jButton8ActionPerformed(evt);
0, 12)); }
jLabel5.setText("No. of Days"); });
jTextField2.setFont(new jButton2.setFont(new
java.awt.Font("Tahoma", 0, 12)); java.awt.Font("Tahoma", 1, 12));
jButton2.setText("Cancel Booking");
jTextField4.setFont(new jButton2.addActionListener(new
java.awt.Font("Tahoma", 0, 12)); java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
37
jButton2ActionPerformed(evt);
} .addPreferredGap(javax.swing.LayoutStyle.Compo
}); nentPlacement.RELATED)
jLabel1.setIcon(new .addGroup(jPanel1Layout.createParallelGroup(java
javax.swing.ImageIcon(getClass().getResource("/to x.swing.GroupLayout.Alignment.LEADING)
p-aboutus.png"))); // NOI18N .addComponent(jTextField2,
javax.swing.GroupLayout.Alignment.TRAILING)
jButton9.setFont(new .addComponent(jTextField4,
java.awt.Font("Tahoma", 1, 11)); javax.swing.GroupLayout.Alignment.TRAILING,
jButton9.setText("CLOSE"); javax.swing.GroupLayout.DEFAULT_SIZE, 182,
jButton9.addActionListener(new Short.MAX_VALUE)
java.awt.event.ActionListener() { .addComponent(jTextField1,
public void javax.swing.GroupLayout.Alignment.TRAILING,
actionPerformed(java.awt.event.ActionEvent evt) { javax.swing.GroupLayout.DEFAULT_SIZE, 182,
jButton9ActionPerformed(evt); Short.MAX_VALUE)))
} .addComponent(jTextField5))
}); .addGap(44, 44, 44)
.addGroup(jPanel1Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.Compo
.addContainerGap(57, Short.MAX_VALUE) nentPlacement.UNRELATED)
.addComponent(jButton6))
.addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton7,
.addGroup(javax.swing.GroupLayout.Alignment.TR javax.swing.GroupLayout.PREFERRED_SIZE, 91,
AILING, jPanel1Layout.createSequentialGroup() javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(java .addPreferredGap(javax.swing.LayoutStyle.Compo
x.swing.GroupLayout.Alignment.LEADING) nentPlacement.UNRELATED)
.addComponent(jButton8,
.addGroup(javax.swing.GroupLayout.Alignment.TR javax.swing.GroupLayout.PREFERRED_SIZE, 91,
AILING, jPanel1Layout.createSequentialGroup() javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jButton2,
.addGroup(jPanel1Layout.createParallelGroup(java javax.swing.GroupLayout.DEFAULT_SIZE,
x.swing.GroupLayout.Alignment.LEADING) javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(jLabel6) Short.MAX_VALUE))
.addComponent(jLabel7) .addGap(103, 103, 103))
.addComponent(jLabel5))
.addGap(16, 16, 16)) .addGroup(javax.swing.GroupLayout.Alignment.TR
.addComponent(jLabel2) AILING, jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)) .addComponent(jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 636,
.addGroup(jPanel1Layout.createParallelGroup(java javax.swing.GroupLayout.PREFERRED_SIZE)
x.swing.GroupLayout.Alignment.LEADING, false) .addGap(41, 41, 41))
.addComponent(jTextField6)
.addGroup(javax.swing.GroupLayout.Alignment.TR
.addGroup(javax.swing.GroupLayout.Alignment.TR AILING, jPanel1Layout.createSequentialGroup()
AILING, jPanel1Layout.createSequentialGroup()
38
.addComponent(jButton9,
javax.swing.GroupLayout.PREFERRED_SIZE, 77, .addGroup(jPanel1Layout.createParallelGroup(java
javax.swing.GroupLayout.PREFERRED_SIZE) x.swing.GroupLayout.Alignment.BASELINE)
.addGap(28, 28, 28)))) .addComponent(jLabel6)
); .addComponent(jTextField5,
jPanel1Layout.setVerticalGroup( javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
jPanel1Layout.createParallelGroup(javax.swing.Gr javax.swing.GroupLayout.PREFERRED_SIZE))
oupLayout.Alignment.LEADING)
.addPreferredGap(javax.swing.LayoutStyle.Compo
.addGroup(javax.swing.GroupLayout.Alignment.TR nentPlacement.RELATED)
AILING, jPanel1Layout.createSequentialGroup()
.addGap(23, 23, 23) .addGroup(jPanel1Layout.createParallelGroup(java
.addComponent(jLabel1, x.swing.GroupLayout.Alignment.BASELINE)
javax.swing.GroupLayout.PREFERRED_SIZE, 162, .addComponent(jLabel7)
javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField6,
javax.swing.GroupLayout.PREFERRED_SIZE,
.addPreferredGap(javax.swing.LayoutStyle.Compo javax.swing.GroupLayout.DEFAULT_SIZE,
nentPlacement.RELATED, 67, Short.MAX_VALUE) javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel1Layout.createParallelGroup(java .addGroup(jPanel1Layout.createSequentialGroup()
x.swing.GroupLayout.Alignment.LEADING) .addGap(8, 8, 8)
.addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.BASELINE)
.addGroup(jPanel1Layout.createParallelGroup(java .addComponent(jButton5)
x.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton6))
.addComponent(jLabel2)
.addComponent(jTextField1, .addPreferredGap(javax.swing.LayoutStyle.Compo
javax.swing.GroupLayout.PREFERRED_SIZE, nentPlacement.RELATED)
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createParallelGroup(java
x.swing.GroupLayout.Alignment.BASELINE)
.addPreferredGap(javax.swing.LayoutStyle.Compo .addComponent(jButton7)
nentPlacement.RELATED) .addComponent(jButton8))
.addGap(29, 29, 29)
.addGroup(jPanel1Layout.createParallelGroup(java .addComponent(jButton2,
x.swing.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.PREFERRED_SIZE, 31,
.addComponent(jLabel3) javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jTextField2, .addGap(50, 50, 50)
javax.swing.GroupLayout.PREFERRED_SIZE, .addComponent(jButton9,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE, 31,
javax.swing.GroupLayout.PREFERRED_SIZE)) javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(25, 25, 25))
.addPreferredGap(javax.swing.LayoutStyle.Compo );
nentPlacement.UNRELATED)
javax.swing.GroupLayout layout = new
.addGroup(jPanel1Layout.createParallelGroup(java javax.swing.GroupLayout(getContentPane());
x.swing.GroupLayout.Alignment.BASELINE) getContentPane().setLayout(layout);
.addComponent(jLabel5) layout.setHorizontalGroup(
.addComponent(jTextField4,
javax.swing.GroupLayout.PREFERRED_SIZE, layout.createParallelGroup(javax.swing.GroupLayo
javax.swing.GroupLayout.DEFAULT_SIZE, ut.Alignment.LEADING)
javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jPanel1,
javax.swing.GroupLayout.DEFAULT_SIZE,
.addPreferredGap(javax.swing.LayoutStyle.Compo javax.swing.GroupLayout.DEFAULT_SIZE,
nentPlacement.RELATED) Short.MAX_VALUE)
39
); } catch (Exception ex) {
layout.setVerticalGroup( }
}
layout.createParallelGroup(javax.swing.GroupLayo
ut.Alignment.LEADING) private void
.addComponent(jPanel1, jButton6ActionPerformed(java.awt.event.ActionEv
javax.swing.GroupLayout.DEFAULT_SIZE, ent evt) {
javax.swing.GroupLayout.DEFAULT_SIZE, try {
Short.MAX_VALUE) rs.previous();
); if (rs.isFirst()) {
rs.first();
bindingGroup.bind(); }
displayRecord();
java.awt.Dimension screenSize = } catch (Exception ex) {
java.awt.Toolkit.getDefaultToolkit().getScreenSize( }
); }
setBounds((screenSize.width-750)/2,
(screenSize.height-530)/2, 750, 530); private void
}// </editor-fold> jButton9ActionPerformed(java.awt.event.ActionEv
ent evt) {
// TODO add your handling code here:
dispose();
private void }
jButton5ActionPerformed(java.awt.event.ActionEv
ent evt) { private void
try { jButton2ActionPerformed(java.awt.event.ActionEv
rs.first(); ent evt) {
if (rs.isFirst()) {
rs.first(); int a = JOptionPane.showConfirmDialog(null,
} "Wana Cancel booking for Sure ?");
displayRecord(); if (a == JOptionPane.YES_OPTION) {
} catch (Exception ex) { try {
} smt10 = con.createStatement();
} String qry = "DELETE FROM bookingtable
WHERE book_id = " + jTextField1.getText() + ";";
private void smt10.executeUpdate(qry);
jButton7ActionPerformed(java.awt.event.ActionEv JOptionPane.showMessageDialog(null,
ent evt) { "Booking Cancelled SucessFully");
try { } catch (Exception e) {
rs.next(); JOptionPane.showMessageDialog(null,
if (rs.isLast()) { "Error Occured During Cancelation !");
rs.last(); }
} }
displayRecord(); jTextField1.setText(null);
} catch (Exception ex) { jTextField2.setText(null);
} jTextField4.setText(null);
} jTextField5.setText(null);
jTextField6.setText(null);
private void
jButton8ActionPerformed(java.awt.event.ActionEv
ent evt) { }
try {
rs.last(); // Variables declaration - do not modify
if (rs.isLast()) { private javax.swing.JButton jButton2;
rs.last(); private javax.swing.JButton jButton5;
} private javax.swing.JButton jButton6;
displayRecord(); private javax.swing.JButton jButton7;
40
private javax.swing.JButton jButton8; setBounds(new java.awt.Rectangle(100, 100,
private javax.swing.JButton jButton9; 0, 0));
private javax.swing.JLabel jLabel1; setResizable(false);
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3; org.jdesktop.beansbinding.Binding binding =
private javax.swing.JLabel jLabel5; org.jdesktop.beansbinding.Bindings.createAutoBin
private javax.swing.JLabel jLabel6; ding(org.jdesktop.beansbinding.AutoBinding.Upda
private javax.swing.JLabel jLabel7; teStrategy.READ_WRITE, this,
private javax.swing.JPanel jPanel1; org.jdesktop.beansbinding.ELProperty.create("Hot
private javax.swing.JTextField jTextField1; el Reservation System || www.ezindagi.in ||"),
private javax.swing.JTextField jTextField2; this,
private javax.swing.JTextField jTextField4; org.jdesktop.beansbinding.BeanProperty.create("ti
private javax.swing.JTextField jTextField5; tle"));
private javax.swing.JTextField jTextField6; bindingGroup.addBinding(binding);
private org.jdesktop.beansbinding.BindingGroup
bindingGroup; addWindowListener(new
// End of variables declaration java.awt.event.WindowAdapter() {
} public void
windowOpened(java.awt.event.WindowEvent evt)
{
***************************** formWindowOpened(evt);
}
NAVIGATION FRAME });
*****************************
jPanel2.setBackground(new
public class NavigationFrame extends java.awt.Color(241, 241, 255));
javax.swing.JFrame {
/** jLabel1.setIcon(new
* Creates new form NavigationFrame javax.swing.ImageIcon(getClass().getResource("/to
*/ p-aboutus.png"))); // NOI18N
setDefaultCloseOperation(javax.swing.WindowCon jButton2.setFont(new
stants.EXIT_ON_CLOSE); java.awt.Font("Tahoma", 1, 14));
jButton2.setText("Room Management");
41
jButton2.addActionListener(new
java.awt.event.ActionListener() { .addGroup(jPanel2Layout.createParallelGroup(java
public void x.swing.GroupLayout.Alignment.TRAILING)
actionPerformed(java.awt.event.ActionEvent evt) { .addComponent(jButton4,
jButton2ActionPerformed(evt); javax.swing.GroupLayout.Alignment.LEADING,
} javax.swing.GroupLayout.DEFAULT_SIZE, 428,
}); Short.MAX_VALUE)
.addComponent(jButton5,
jButton5.setFont(new javax.swing.GroupLayout.Alignment.LEADING,
java.awt.Font("Tahoma", 1, 14)); javax.swing.GroupLayout.DEFAULT_SIZE, 428,
jButton5.setText("Visitor Management"); Short.MAX_VALUE)
jButton5.addActionListener(new .addComponent(jButton1,
java.awt.event.ActionListener() { javax.swing.GroupLayout.Alignment.LEADING,
public void javax.swing.GroupLayout.DEFAULT_SIZE, 428,
actionPerformed(java.awt.event.ActionEvent evt) { Short.MAX_VALUE)
jButton5ActionPerformed(evt); .addComponent(jButton2,
} javax.swing.GroupLayout.Alignment.LEADING,
}); javax.swing.GroupLayout.DEFAULT_SIZE, 428,
Short.MAX_VALUE)
jButton4.setFont(new .addComponent(jButton6,
java.awt.Font("Tahoma", 1, 14)); javax.swing.GroupLayout.Alignment.LEADING,
jButton4.setText("Exit Application"); javax.swing.GroupLayout.DEFAULT_SIZE, 428,
jButton4.addActionListener(new Short.MAX_VALUE)
java.awt.event.ActionListener() { .addComponent(jButton3,
public void javax.swing.GroupLayout.DEFAULT_SIZE, 428,
actionPerformed(java.awt.event.ActionEvent evt) { Short.MAX_VALUE))
jButton4ActionPerformed(evt); .addGap(174, 174, 174))
} );
}); jPanel2Layout.setVerticalGroup(
jButton6.setFont(new jPanel2Layout.createParallelGroup(javax.swing.Gr
java.awt.Font("Tahoma", 1, 14)); oupLayout.Alignment.LEADING)
jButton6.setText("Booking Management");
jButton6.addActionListener(new .addGroup(jPanel2Layout.createSequentialGroup()
java.awt.event.ActionListener() { .addContainerGap()
public void .addComponent(jLabel1)
actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt); .addPreferredGap(javax.swing.LayoutStyle.Compo
} nentPlacement.UNRELATED)
}); .addComponent(jButton3,
javax.swing.GroupLayout.PREFERRED_SIZE, 34,
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout.PREFERRED_SIZE)
javax.swing.GroupLayout(jPanel2); .addGap(18, 18, 18)
jPanel2.setLayout(jPanel2Layout); .addComponent(jButton6,
jPanel2Layout.setHorizontalGroup( javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)
jPanel2Layout.createParallelGroup(javax.swing.Gr .addGap(18, 18, 18)
oupLayout.Alignment.LEADING) .addComponent(jButton2,
javax.swing.GroupLayout.PREFERRED_SIZE, 34,
.addGroup(jPanel2Layout.createSequentialGroup() javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(72, 72, 72) .addGap(18, 18, 18)
.addComponent(jLabel1) .addComponent(jButton1,
.addGap(80, 80, 80)) javax.swing.GroupLayout.PREFERRED_SIZE, 34,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.TR .addGap(18, 18, 18)
AILING, jPanel2Layout.createSequentialGroup()
.addGap(177, 177, 177)
42
.addComponent(jButton5, jButton2.setToolTipText("Add/ Edit/Remove
javax.swing.GroupLayout.PREFERRED_SIZE, 35, Hotel Room");
javax.swing.GroupLayout.PREFERRED_SIZE) jButton3.setToolTipText("Check Room is
.addGap(18, 18, 18) Available or Not");
.addComponent(jButton4, jButton4.setToolTipText("Close the
javax.swing.GroupLayout.PREFERRED_SIZE, 33, application");
javax.swing.GroupLayout.PREFERRED_SIZE) }
.addContainerGap(181,
Short.MAX_VALUE)) private void
); jButton1ActionPerformed(java.awt.event.ActionEv
ent evt) {
javax.swing.GroupLayout layout = new StaffMang sm=new StaffMang();
javax.swing.GroupLayout(getContentPane()); sm.setVisible(true);
getContentPane().setLayout(layout); }
layout.setHorizontalGroup(
private void
layout.createParallelGroup(javax.swing.GroupLayo jButton2ActionPerformed(java.awt.event.ActionEv
ut.Alignment.LEADING) ent evt) {
.addGroup(layout.createSequentialGroup() RoomMang rm=new RoomMang();
.addComponent(jPanel2, rm.setVisible(true);
javax.swing.GroupLayout.PREFERRED_SIZE, }
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE) private void
jButton3ActionPerformed(java.awt.event.ActionEv
.addContainerGap(javax.swing.GroupLayout.DEFA ent evt) {
ULT_SIZE, Short.MAX_VALUE)) Availability avail=new Availability();
); avail.setVisible(true);
layout.setVerticalGroup( }
43
private javax.swing.JPanel jPanel2; // End of variables declaration
private org.jdesktop.beansbinding.BindingGroup }
bindingGroup;
BIBILOGRAPHY
Writtten by:
2. Oxford 12th IP
44