You are on page 1of 39

Words seem to count short in number, when I get to acknowledge all those who

have helped me in the process of the development of this project. Their fruitful
guidance, encouragement, support and supervision had given me a positive
dimension for the initiation and completion of this project.
First and foremost, I would like to thank Mrs. (Principal Director, Seedling
Group of Schools), Mr. (C.E.O. & Director, Seedling Group of Schools) and
Mrs. (Principal, Seedling Public School) for providing me with an opportunity
to study in this esteemed institution.
I would also like to thank Mr. Pankaj Chadha, Coordinator, Department of
Computers, Seedling Public School, for being a true mentor and by providing
great support throughout the project.
I also take this opportunity to express my deep gratitude to Mr. Gaurav Patni,
our Informatics Practices teacher for his help at all phases of project
development.
I would also like to express my gratitude towards Mr, the Hardware Engineer
for his time to time help extended towards me.
Above all, I would like to thank my school, who always inspired me always in
all endeavors.

Thanks everyone!

Harsh Vardhan Bhatnagar

(Class: XII - )

Seedling Public School




This is to certify that Harsh Vardhan Bhatnagar of Class XII
- has successfully completed his/her project work on “ Library
Management ” in Informatics Practices (Code 065) and hereby
submitting his/her report as an evidence of the project work for
the session 2013 - 2014.




Signature

Signature
()

()
Coordinator, Informatics Practices Principal Director
Seedling Public School Seedling Public School
TABLE OF CONTENTS


1. COVER PAGE
2. ACKNOWLEDGEMENT
3. LABORATORY CERTIFICATE
4. TABLE OF CONTENTS
5. INTRODUCTION TO CURRENT MANUAL SYSTEM
6. PROBLEMS OF CURRENT MANUAL SYSTEM
7. BENEFITS OF THE COMPUTERIZED SYSTEM
8. STRUCTURE OF TABLES (CREATED IN MySQL)
9. SAMPLE DATA OF TABLES
10. SOURCE CODE (NetBeans)
11. OUTPUT SCREEN LAYOUTS
12. BIBLIOGRAPHY (OPTIONAL)





7 Introduction to current manually
operated Library management system.

A computerized system enhanced our lifestyle; the society has made a very real
commitment to computer, an electronic device design to manipulate and used to
store data and information. We must admit that companies and people in the
business world have reached the point of no return in its dependence on
computer. Most of the companies are experiencing problems in their manual
system that’s why most of them are engaging with computerized system to
eliminate problems in transactions.
The main purpose of library is to provide conductive learning tool and place for
the students and other clients in order to attain good and high quality education.
The library system’s main purpose is to help the librarian to maintain library
transactions so that nothing will affect the smooth flow of it. One way is
converting manual system into a computerized system

6 Problem of current manually operated
Library management System

Many library systems are operated manually by group of people. In such
situations manypeople involved in the process of managing the library such a
way that to keep recordsregarding the books & students (borrowers), check the
books manually, keep records onissued books etc. all these things have to be carried out
manually & if the library is large incontent handling is also a problem. On the other hand
keeping large amount of maintenanceworkers may cost a lot & it will not be efficient
for a library. Manual record keeping is alsonot a reliable method as people tend to
forget things.On the borrower
’s

point of view, in manual system borrower can’t find a book exactly at
once as they are not ordered well. Sometimes user might be searching for a
book that is notavailable in the library in such situations people get annoyed or depressed.
Therefore thereshould be a reliable way to manage the library system.

7 BENEFITS OF THE COMPUTERIZED
SYSTEM
 Easy to understand user friendly environment.
 Less time consuming for searching the books.
 Minimum staffs required in the library.
 Every person easily know the capacity of library.
 Categorisation of books easily shown.
 We can easily check the issued book and the person details.

8 Structure of Tables {Created in My SQL}


mysql> Create table base (Sno int (5),picloc varchar(200), Member_Name
varchar(30) , Address varchar(60),Email_ID varchar(30) , Mobile_No
int(16) , issue int(16), issued_bookname varchar (100
, Password varchar(10) );

mysql> desc base;
+-----------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+--------------+------+-----+---------+-------+
| Sno | int(5) | NO | PRI | 0 | |
| picloc | varchar(200) | YES | | NULL | |
| Member_name | varchar(30) | YES | | NULL | |
| Address | varchar(60) | YES | | NULL | |
| Email_ID | varchar(30) | YES | | NULL | |
| Mobile_No | int(16) | YES | | NULL | |
| issue | varchar(10) | YES | | NULL | |
| issued_bookname | varchar(100) | YES | | NULL | |
| Password | varchar(10) | YES | | NULL | |
+-----------------+--------------+------+-----+---------+-------+

mysql> create table Book_Detail ( Sno int(5),Book_Title
varchar(30),Book_Author
varchar(30),Book_Publisher varchar(30),Book_Price int(5));
Query OK
mysql> desc Book_Details;
+----------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------------+-------------+------+-----+---------+-------+
| Sno | int(5) | YES | | NULL | |
| Book_Title | varchar(30) | YES | | NULL | |
| Book_Author | varchar(30) | YES | | NULL | |
| Book_Publisher | varchar(30) | YES | | NULL | |
| Book_Price | int(5) | YES | | NULL | |
+----------------+-------------+------+-----+---------+-------+
mysql> create table users ( Sno int(3),Member_Name varchar(30),Password
varchar(
10));
Query OK
mysql> alter table users add(Last_name varchar(10));
Query OK
mysql> Create table admin (Sno int(5) , Password varchar(20) ) ;
Query OK
9 SAMPLE DATA OF TABLES

mysql> Select * from base;
+-----+--------------------------------------------+-------------+-------------------+-------
----------------+-----------+-------+-----------------+----------+
| Sno | picloc | Member_name | Address | Email_ID
| Mobile_No | issue | issued_bookname | Password |
+-----+--------------------------------------------+-------------+-------------------+-------
----------------+-----------+-------+-----------------+----------+
| 1 | NULL | Harsh | Kapoor apartments | harshgar
| 992562040 | NULL | NULL | NULL |
| 2 | C:UsersspsDocumentshoney singhPenguins.jpg | Ritwik | Sindhi colony
| bangbangbang@gmail.co | 789456123 | NULL | NULL | bang |
| 4 | C:UsersspsDocumentshoney singhPenguins.jpg | qwerty | qwertyuiop
| qwertyuiop@gmail.com | 123456789 | NULL | NULL | qwerty |
| 5 | | Brick | wall street | street@yahoo.co.in
| 992804854 | NULL | NULL | harhar |
+-----+--------------------------------------------+-------------+-------------------+-------
----------------+-----------+-------+-----------------+----------+
mysql> Select * from admin;
+-----+----------+
| Sno | Password |
+-----+----------+
| 1 | qazwsx |
+-----+----------+
mysql> Select * from book_detail;
+-----+----------------------+--------------+---------------------+------------+
| Sno | Book_Title | Book_Author | Book_Publisher | Book_Price |
+-----+----------------------+--------------+---------------------+------------+
| 1 | Black beauty | J.K. rowling | haboo | 45 |
| 2 | SPACE | Buzz Aldrin | National geographic | 10000 |
| 3 | What Dreams May Come | Hecki | United Publishers | 1000 |
| 77 | Harish | Hanish | Ramesh | 500 |
+-----+----------------------+--------------+---------------------+------------+


10 Source Code { Net Beans }

First Page

private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to close the application
System.exit(0);

}

private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Navigate to aad_new_book() form
new aad_new_book().setVisible(true);
dispose();
}

private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Navigate to Membership_status form
new Membership_stats().setVisible(true);
dispose();
}

private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Navigate to Receive_book form
new Receive_book().setVisible(true);
dispose();
}

private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Navigate to search book form
new bokksearch().setVisible(true);
dispose();
}

private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Navigate to Tabular search book form
new searchbooks().setVisible(true);
dispose();
}

private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Navigate to Member_master form
new Member_Master().setVisible(true);
dispose();
}








Administrator Login

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Code for Administrator Login

String a=new String(p1.getPassword());
String b=new String(p2.getPassword());
String c=new String(p3.getPassword());
if(a == null ? ("") == null : a.equals(""))
{
JOptionPane.showMessageDialog(this,"Enter the old Password");
}
else if (b == null ? ("") == null : b.equals(""))
{
JOptionPane.showMessageDialog(this, "Enter the new password");
}
else if (c == null ? ("") == null : c.equals(""))
{
JOptionPane.showMessageDialog(this, "Enter the confirm password");
}
else {


try
{
Class.forName("java.sql.DriverManager");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_managem
ent","root","sps");
String password1=new String(p1.getPassword());
String password2=new String(p2.getPassword());
String password3=new String(p3.getPassword());
Statement st =con.createStatement();
String pass="";
String sql;
sql = "select * from admin";
ResultSet rs = st.executeQuery(sql);
if(rs.next())
pass = rs.getString("Password");
if(password2.equals(password3))
{
if(password1.equals(pass))
{
sql = "Update admin set password ='" + password2 + "' where
Password = '" + password1 + "'";

st.executeUpdate(sql);
JOptionPane.showMessageDialog(this,"Administrator password
updated" );
}
else
{
JOptionPane.showMessageDialog(this,"Invalid password entered");
}
}


}
catch(Exception e){
JOptionPane.showMessageDialog(this,e.getMessage());
}

}
}


















Display Records of all books

private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
//Code to Display all records of Books in Table

DefaultTableModel model=(DefaultTableModel)jTable1.getModel();
while(model.getRowCount()>0)
{
model.removeRow(0);
}

try {
Class.forName("java.sql.DriverManager");
Connection con
=DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_manage
ment","root","sps");
String sql ="Select * from book_detail order by Sno";
Statement st=con.createStatement();
ResultSet rs = st.executeQuery(sql);

while (rs.next())
{
String Sno=rs.getString("Sno");
String Title=rs.getString("Book_Title");
String Author=rs.getString("Book_Author");
String Publisher=rs.getString("Book_Publisher");
String Price=rs.getString("Book_Price");
model.addRow(new Object[]{Sno,Title,Author,Publisher,Price});
}
}
catch(Exception ae)
{
JOptionPane.showMessageDialog(this,ae.getMessage());
}





















Issue Book

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to issue a book to a Member

String no= jTextField1.getText();
String name= jTextField2.getText();
String id = jTextField3.getText();
String book = jTextField4.getText();
String a="Yes";
try {
Class.forName("java.sql.DriverManager");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_mana
gement","root","sps");
String sql;
sql ="Update base set issue ='"+id+"',issued_bookname='"+book+"' where
Sno="+no+";";
Statement st=(Statement)con.createStatement();
st.executeUpdate(sql);
JOptionPane.showMessageDialog(this,"Values saved");
}
catch (Exception e)
{JOptionPane.showMessageDialog(null, e.getMessage()); }


}


private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Code for Reset button
jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");
jTextField4.setText("");




















Member Details

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to display Member Name and Issued Book name by the Member
ID
int id =Integer.parseInt(jTextField1.getText());
try
{
Class.forName("java.sql.DriverManager");
Connection con=(Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_Managem
ent","root","sps");
Statement st = (Statement)con.createStatement();

String sql = "Select Member_Name,issued_bookname from base where
Sno="+id+";";
ResultSet rs = st.executeQuery(sql);
String name="",book="";
while(rs.next())
{
name = rs.getString("Member_name");
book = rs.getString("issued_bookname");
jTextField3.setText(book);
jTextField2.setText(name);
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
// Code for reset button

jTextField1.setText("");
jTextField2.setText("");
jTextField3.setText("");

Administrator Login

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Code for Administrator Login

try
{
Class.forName("java.sql.DriverManager");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_managem
ent","root","sps");
String password1=new String(jPasswordField1.getPassword());
String sql;
sql="Select Password from admin where Password ='"+password1+"';";
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(sql);
if(rs.next())
{
new firstpage().setVisible(true);
dispose(); } else {
JOptionPane.showMessageDialog(this,"Password Invalid ");
jTextField1.setText("");
jPasswordField1.setText("");
}
} catch(Exception e){
JOptionPane.showMessageDialog(this,e.getMessage());
}




















Member Master

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Upload photo of the Member in the form

p1.removeAll();
final JFileChooser dlg = new JFileChooser();
dlg.showOpenDialog(this);
final File f = dlg.getSelectedFile();

flname = f.getAbsolutePath();
char x = 92;
String fltext="";
for(int ii=0;ii<flname.length();ii++)
{
if(flname.charAt(ii)==92)
fltext = fltext +"\\\\";
else
fltext = fltext + flname.charAt(ii);
}



String photo = fltext.toString();
int h = photo.length();
String path = photo.substring(6,h);
String flext = flname.substring(flname.length()-3, flname.length());
if(flext.equalsIgnoreCase("jpg")== false &&
flext.equalsIgnoreCase("png")==false)
{
JOptionPane.showMessageDialog(null,"Not a valid file
Format","ERROR",JOptionPane.ERROR_MESSAGE);
}
else
{
final ImageIcon image = new ImageIcon(f.getAbsolutePath());

JLabel lq1 = new JLabel(){

public void paintComponent(Graphics g){
super.paintComponent(g);
g.drawImage(image.getImage(),0,0,getWidth(),getHeight(),null);
}

};
lq1.setBounds(5,5,p1.getWidth(),p1.getHeight());
p1.add(lq1);
p1.revalidate();
p1.repaint();
System.out.println(flname.length());
}

}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Create and Save New Member Details


int Sno=Integer.parseInt(jTextField2.getText());
String Name =jTextField1.getText();

String Address = jTextField3.getText();
String email=jTextField4.getText();
String Mobile = jTextField5.getText();
String pass = new String(jPasswordField1.getPassword());
String pass2 = new String(jPasswordField2.getPassword());


try {

Class.forName("java.sql.DriverManager");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/library_mana
gement","root","sps");
String sql;
sql ="Insert into base
values("+Sno+",'"+flname+"','"+Name+"','"+Address+"','"+email+"','"+Mobile+
"',NULL,NULL,'"+pass+"');";
Statement st=(Statement)con.createStatement();
st.executeUpdate(sql);
JOptionPane.showMessageDialog(this,"Member added");

}
catch (Exception e)
{JOptionPane.showMessageDialog(null, e.getMessage()); }
new firstpage().setVisible(true);
dispose();


}


private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Edit the Member Details by his ID

String Name =jTextField1.getText();
String id=jTextField2.getText();
String Address = jTextField3.getText();
String email=jTextField4.getText();
String Mobile = jTextField5.getText();

try {
Class.forName("java.sql.DriverManager");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_mana
gement","root","sps");
String sql;
sql ="Update base set Member_Name
='"+Name+"',Address='"+Address+"',Email_ID
='"+email+"',Mobile_No='"+Mobile+"' where Sno="+id+";";
Statement st=(Statement)con.createStatement();
st.executeUpdate(sql);
JOptionPane.showMessageDialog(this,"Values Updated");
}
catch (Exception e)
{JOptionPane.showMessageDialog(null, e.getMessage());
}























Member Details {Tabular}

private void formWindowOpened(java.awt.event.WindowEvent evt) {
// Code to Hide Label and TextField

jTextField1.setVisible(false);
jTextField2.setVisible(false);
jLabel1.setVisible(false);
jLabel2.setVisible(false);

private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Display Label and TextField

jLabel1.setVisible(true);
jTextField1.setVisible(true);

private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Display Label and TextField

jLabel2.setVisible(true);
jTextField2.setVisible(true);


private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {
//Code to Display Member Details by his ID

int Serial = Integer.parseInt(jTextField2.getText());

DefaultTableModel model=(DefaultTableModel)jTable1.getModel();
while(model.getRowCount()>0)
{
model.removeRow(0);
}

try {
Class.forName("java.sql.DriverManager");
Connection con
=DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_manage
ment","root","sps");
String sql ="Select * from base where Sno = "+Serial+" order by Sno ;";
Statement st=con.createStatement();
ResultSet rs = st.executeQuery(sql);

while (rs.next())
{
String Sno=rs.getString("Sno");
String MemberName=rs.getString("Member_name");
String Address =rs.getString("Address");
String EmailID=rs.getString("Email_ID");
String Mobilenumber=rs.getString("Mobile_No");
String Issuedate =rs.getString("issue");
String Bookname=rs.getString("issued_bookname");
model.addRow(new
Object[]{Sno,MemberName,Address,EmailID,Mobilenumber,Issuedate,Bookna
me});
}


}


catch(Exception ae)
{
JOptionPane.showMessageDialog(this,ae.getMessage());}
}

private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Diplay Member Details by his Name

String memb = jTextField1.getText();

DefaultTableModel model=(DefaultTableModel)jTable1.getModel();
while(model.getRowCount()>0)
{
model.removeRow(0);
}

try {
Class.forName("java.sql.DriverManager");
Connection con
=DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_manage
ment","root","sps");
String sql ="Select * from base where Member_name like
'"+memb+"%'; ";
Statement st=con.createStatement();
ResultSet rs = st.executeQuery(sql);

while (rs.next())
{
String Sno=rs.getString("Sno");
String MemberName=rs.getString("Member_name");
String Address =rs.getString("Address");
String EmailID=rs.getString("Email_ID");
String Mobilenumber=rs.getString("Mobile_No");
String Issuedate =rs.getString("issue");
String Bookname=rs.getString("issued_bookname");
model.addRow(new
Object[]{Sno,MemberName,Address,EmailID,Mobilenumber,Issuedate,Bookna
me});
}

}

catch(Exception ae)
{
JOptionPane.showMessageDialog(this,ae.getMessage()) ;
}






Receive Book
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Return the book

String no= jTextField1.getText();
String name= t2.getText();


String a="NULL";
try {
Class.forName("java.sql.DriverManager");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_mana
gement","root","sps");
String sql;
sql ="Update base set issue ='"+a+"',issued_bookname='"+a+"' where
Sno="+no+";";
Statement st=(Statement)con.createStatement();
st.executeUpdate(sql);
JOptionPane.showMessageDialog(this,"Book Received , Thank you ..!!");
}
catch (Exception e)
{JOptionPane.showMessageDialog(null, e.getMessage()); }

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to reset all the text field values

jTextField1.setText("");t2.setText(""); }
Add New Book

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to add new book to the Database

int Sno =Integer.parseInt(jTextField1.getText());
String Title = jTextField2.getText();
String Author = jTextField3.getText();
String Publisher = jTextField4.getText();
int MRP =Integer.parseInt(jTextField5.getText());
try {
Class.forName("java.sql.DriverManager");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_mana
gement","root","sps");
String sql;
sql ="Insert into book_detail
values("+Sno+",'"+Title+"','"+Author+"','"+Publisher+"',"+MRP+");";
Statement st=(Statement)con.createStatement();
st.executeUpdate(sql);
JOptionPane.showMessageDialog(this,"Book Details Saved");
}
catch (Exception e)
{JOptionPane.showMessageDialog(null, e.getMessage()) ;
}



Search Book

private void jButton9ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Search the book by its Serial number

int Sno =Integer.parseInt(jTextField1.getText());


try {
Class.forName("java.sql.DriverManager");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_Mana
gement","root","sps");
Statement st = (Statement)con.createStatement();

String sql = "Select Book_Title , Book_Author, Book_Publisher,
Book_Price from book_detail where Sno="+Sno+";";
ResultSet rs = st.executeQuery(sql);
String title="",Author="",Publisher="";
int price ;

while(rs.next()) {
title = rs.getString("Book_Title");
Author = rs.getString("Book_Author");
Publisher = rs.getString("Book_Publisher");
price = rs.getInt("Book_Price");

jTextField2.setText(title);
jTextField3.setText(Author);
jTextField4.setText(Publisher);
jTextField6.setText(""+price);
}
} catch(Exception e) {
JOptionPane.showMessageDialog(null, e.getMessage());
}

}


















Issue Book

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to Issue a book

String book=jTextField1.getText();
int id = Integer.parseInt(jTextField2.getText());
String name = jTextField3.getName();
String Date = jTextField5.getText();
try {
Class.forName("java.sql.DriverManager");
Connection
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_mana
gement","root","sps");
String sql;
sql ="Update base set issued_bookname ='"+book+"',issue= '"+Date+"' where
Sno="+id+";";
Statement st=(Statement)con.createStatement();
st.executeUpdate(sql);
JOptionPane.showMessageDialog(this,"Book Issued");
}
catch (Exception e)
{JOptionPane.showMessageDialog(null, e.getMessage()); }


}




Search Book {Tabular}

private void t1ActionPerformed(java.awt.event.ActionEvent evt) {
////Code to search book details by its serial number
int ID = Integer.parseInt(t1.getText());
String aTitle = t2.getText();

DefaultTableModel model=(DefaultTableModel)jTable1.getModel();
while(model.getRowCount()>0)
{
model.removeRow(0);
}

try {
Class.forName("java.sql.DriverManager");
Connection con
=DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_manage
ment","root","sps");
String sql ="Select * from book_detail where Sno = "+ID+" order by
Sno";
Statement st=con.createStatement();
ResultSet rs = st.executeQuery(sql);

while (rs.next())
{
String Sno=rs.getString("Sno");
String Title=rs.getString("Book_Title");
String Author=rs.getString("Book_Author");
String Publisher=rs.getString("Book_Publisher");
String Price=rs.getString("Book_Price");
model.addRow(new Object[]{Sno,Title,Author,Publisher,Price});
}


}


catch(Exception ae)
{
JOptionPane.showMessageDialog(this,ae.getMessage()); }

private void t2ActionPerformed(java.awt.event.ActionEvent evt) {
// Code to search book details by its Name
String aTitle = t2.getText();

DefaultTableModel model=(DefaultTableModel)jTable1.getModel();
while(model.getRowCount()>0)
{
model.removeRow(0);
}

try {
Class.forName("java.sql.DriverManager");
Connection con
=DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_manage
ment","root","sps");

String sql ="Select * from book_detail where Book_Title like
'"+aTitle+"%'; ";
Statement st=con.createStatement();
ResultSet rs = st.executeQuery(sql);

while (rs.next())
{
String Sno=rs.getString("Sno");
String Title=rs.getString("Book_Title");
String Author=rs.getString("Book_Author");
String Publisher=rs.getString("Book_Publisher");
String Price=rs.getString("Book_Price");
model.addRow(new Object[]{Sno,Title,Author,Publisher,Price});
}


}


catch(Exception ae)
{
JOptionPane.showMessageDialog(this,ae.getMessage());
}
}

private void formWindowOpened(java.awt.event.WindowEvent evt) {
//Code to Hide Label and TextField

t1.setVisible(false);
t2.setVisible(false);
jLabel3.setVisible(false);
jLabel2.setVisible(false);


private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) {
//Code to Display Label and TextField

t1.setVisible(true);
jLabel3.setVisible(true);

private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// //Code to Display Label and TextField

t2.setVisible(true);
jLabel2.setVisible(true);

}



CODES WHICH ARE COMMON TO ALL THE
FORMS

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
//Code to go back to first page
new firstpage().setVisible(true);
dispose();

private void formWindowActivated(java.awt.event.WindowEvent evt) {
// Code to Display Current date at the top of the page

try {
Class.forName("java.sql.DriverManager");
Connection con
=DriverManager.getConnection("jdbc:mysql://localhost:3306/Library_manage
ment","root","sps");
String sql ="Select sysdate();";
Statement st=con.createStatement();
ResultSet rs = st.executeQuery(sql);
if(rs.next())
{
String a = rs.getString("sysdate()").substring(0, 10);
jLabel4.setText(""+a);
}
}
catch(Exception e)
{ JOptionPane.showMessageDialog(null, e.getMessage());}