You are on page 1of 140

on

Submitted for the fulfillment of the requirement of the course for


the award of the Degree for

















Submitted by:

ENROLLMENT N0 : 520961019

NAME : NILU KUMARI

COURSE : BSCIT

SEMESTER : 6
th





















TITLE OF THE PROJECT






This is to certify that the project entitled Library Management
System submitted to Sikkim Manipal University in fulfillment of the
requirement for the award of (BSCIT), is an original work carried out by
MISS. NILU KUMARI, Enrollment NO. 520961019. Under the guidance
of Mr. G.S.PANDEY

The matter embodied in this project is a genuine work done by
the student and has been submitted whether to this University or to the
institute for the fulfillment of the requirement of any course of study.


.. ..

Signature of Student Signature of Guide

Name: NILU KUMARI Name: Mr. G.S.PANDEY
Course: BSCIT
Enrollment No.: 520961019






CERTIFICATE









I here by declare that the work which is being presented in the
project entitled Library Management System as part of the course
curriculum of ,BSCIT Sikkim Manipal University of Health, Medical &
Technological Sciences, Gangtok; is an authentic record of my own work
carried out under the supervision of MR. G.S.PANDEY.
I have not submitted the matter embodied in this project for the award of any
other degree.


Name: NILU KUMARI
Course: BSCIT
Enrollment No.: 520961019














DECLARATION








A As s a an ny y o on ne e w wh ho o h ha as s w wr ri it tt te en n a a p pr ro oj je ec ct t w wo or rk k, , o or r r re es se ea ar rc ch h w wo or rk k, , i it t i is s q qu ui it te e
i im mp po os ss si ib bl le e t to o a ac ck kn no ow wl le ed dg ge e b by y n na am me e e ev ve er ry y i in nd di iv vi id du ua al l w wh ho o h ha as s p pl la ay ye ed d s so om me e
p pa ar rt t i in n t th hi is s w wo or rk k. . I I f fe ee el l i it t i is s d di if ff fi ic cu ul lt t t to o e ex xp pr re es ss s i in n w wo or rd ds s m my y p pr ro of fo ou un nd d s se en ns se e
o of f g gr ra at ti it tu ud de e t to o m mo os st t r re es sp pe ec ct te ed d p pe er rs so on ns s w wh ho o h he el lp pe ed d m me e t to o m ma ak ke e t th hi is s w wo or rk k
p po os ss si ib bl le e. .

I I a ac ck kn no ow wl le ed dg ge e m my y g gr ra at ti it tu ud de e t to o r re es sp pe ec ct te ed d g gu ui id de e MR. G.S.PANDEY w wh ho o h ha as s
b be ee en n k ki in nd d e en no ou ug gh h t to o s su ug gg ge es st t i im mp pr ro ov ve em me en nt t o of f t th hi is s w wo or rk k a an nd d m ma ak ke es s i it t b br ro oa ad d, ,
b ba as se ed d. .




Name: NILU KUMARI
Course: BSCIT
Enrollment No.: 520961019








ACKNOWLEDGEMENT







Until a few years ago, there was only concept of stand-alone application
software. There were many problems for saving records, searching old
records, maintaining database and storing them. There was a major lack in
security and maintenance. All data either it is administrative use or user
related were stored in a single PC. Hence, there was a great possibility of
illegal access.

Then, two-tier was introduced. It was a major change in the Information
Technology world. The pattern of storing and accessing data was changes.
Information became more secure and reliable.

And now we are using three-tier architecture. It is a great turning point in
Information technology world. Storing and sharing of data become very easy
and secure. There is a large flexibility in accessing data or getting
information from the server placed in geographical dispersed area at one
place without going there.

My software is two-tier based; there is a user interface (front end) and
database (back end). The client system where software will be installed can
send request to database and establish connection and access database.


ABSTRACT






1. Introduction ---------------------------- 1-2
2. Objectives ----------------------------- 3-4
3. Problem Statement ---------------------------- 5
4. Requirement analysis ---------------------------- 6-18
a. Proposed system
b. System Requirement `
c. Software justification
d. E-R Diagram
e. Data Flow Diagram
f. Data Dictionary
5. Analysis and Design ----------------------------- 19-26
6. Coding ----------------------------- 27-118
7. Testing Procedures and Reports ----------------------------- 119-121
8. Documentation ----------------------------- 122-130
9. Future Application ----------------------------- 131
10. Conclusion ----------------------------- 132
11. Bibliography ----------------------------- 133




CONTENTS







Library Management System is the process to the Management of any
particular Library efficiently; it needs supportive phenomena to make
complex work easy and to perform related Activity with Smart way. Dealing
in Library and handling lots of books and members is not as easy as it seems
but its a complex task..
Therefore I have tried to handle with concern the problems as to perform
total Management of Library Management System. Now a days where all
Business, education, company work, designing work and other platforms are
being done in a short amount of time and provided least complexity due to
computerization, so we must consider this & use such a technique to handle
a large and complex operations which is being performed in a Library as
well as it would provide a best quality and easiest way for all, related to this
backing.

The main view of making of this project is to maintain the data that helps
Library to keep the right information about all the factors concerned with the
books and customers. The major factor that attracts all the management is its
durability and easy maintenance. This project is designed to acquire the
blessing of different types of work that is performed daily. It is basically a
group of modules, which makes the work easier to perform.

INTRODUCTION
As I have used the java programming so it helps me to create this project
having different modules. Those modules are connected in the group and
that becomes very easy to me to work together. Data structure helps to
maintain the record and modify it. It is also used to retrieve the data from the
Database and helps to update it. It is the next major and important tool which
is used in my project.

The present manual Library Management System for a Library requires
updating of a number of registers daily. It requires huge manpower, effort
and money. Even though, Maintenance of registers is not done properly.
This project results in transformation from conventional type system to
computerized system with day-to-day information. It deals with the whole
information of the Library like Member details, Book details, Staffs and
their Salaries, Fees etc. It takes a lot of space to keep the records. If one is
not very careful then there is a possibility of issuing more than one book to a
member on one card. When a member requests for a book, one has to
physically check for the presence of a book in the library. Different registers
have to be maintained for recording the different Book Details,
Student/member details and purchase details of different books present in
the library.

There is an increased risk of error in the manual system. Redundancy of data
creeps in the manual system and it becomes a time consuming process to
answer management queries and prepare management reports. The manual
registers and files to be maintained increases with the increase in the number
of Book Titles, and/or increase in the number of library member.

In view of the above, a proposed computerized Library Management
system application is strongly needed.



The objective of this Library Management System is to facilitate the ongoing
routine work of a Library. This project aims in developing an information
system to store, maintain, update and process the data related to Library
activities. It will also prepare various types of reports to aid in smooth and
speedy functioning of the Library activities.
The software Library Management System will give options for
providing full controllability to the user. It will have different options for all
the activities that are carried out by the Library management. The project
LIBRARY MANAGEMENT SYSTEM is developed to
achieve the objective of facilitating a Library with electronic data
management which can be accessible from any where in the Library
networking center. However the different label of securities is
maintained for unauthorized access.
.This project has designed to acquire the blessing of different types of
work that is performed daily. Broadly it has been synthesized to reach the
totally work approach. The major advantages of this project is, all the
information can be obtained by selecting one of the particular concerned
topic given on the top of the front page. It is basically a group of modules,
which makes the work easier to perform. Library Management System is
such kind of package used in the Libraries where there is a difficulty in
OBJECTIVE OF THE PROJECT
maintaining information about books and members. Library Department,
working for a long period, wants to change there manual working for a long
period, manual system to computer system.

The main objective of the project is listed below:
To keep details of every entry related to the Library like
member of Library , Director , No. of Books available , Book
issued , Book returned , Details of Book, etc.
To give the facility to the user so that they can access the data
at different level. For example - anyone can browse the catalogue
list, library records, list of books available etc.
Providing the facility to theocratic to maintain data electronically
from anywhere through networking no need to roam here and there.
Providing security of data and of course from the unauthorized
user.
Providing easier way to modify, view , search, remove, update and
generation of the important reports etc
To overcome from the problems faced in the manual system. For
example Data retrieval and access becomes much faster and easier
Providing automatic rectification of the mathematical, accounting and
logical errors










The existing System is not computerized and it is done manually. Here all
the details are stored in separate files. Therefore the storage and retrieval of
data becomes very tedious and requires lot of time and human effort.
Updating the data cannot be made easily. Retrieval of test details of patients
and case history were very hard. Debugging of errors is very difficult.

While retrieving the data or updating the data, the whole procedure has to be
remembered in the current system. Therefore, it has to switch on to a new
system that is advantageous and easier than this current system. There is no
security for the data.

Drawbacks:-
Since the existing system is manual, there are changes of
committing frequent errors.
Many staffs have to be appointed for this process.
In case of preparing any reports, the end user has to go through
every file.
The maintenance of documents in separate registers is very
difficult to handle.
There are changes of misusing the system.
Wastage of time and money due to manual system.

PROBLEM STATEMENT





a. PROPOSED SYSTEM :

All the above limitation was removed. The proposed system is capable of
helping the management to know that how many patients are treated and
how many tests are conducted by the clinic and the doctors to whom patients
are referred.
The proposed system satisfies its benefits by the way in which it
functions and satisfies the end user according their needs. The computer can
be operating at high speed, store and retrieve large volume of data very
quickly. The proposed system is a system using Java as Front End and
Oracle as Back End tool under Windows XP.

Effective Management
Calculating totals charges of tests
Printing the Invoice Quickly.
Instant verification of reports
Error Free and menu driven interface
Saves lot of time.




REQUIREMENT ANALYSIS




b. SYSTEM REQUIREMENTS :

Software Requirements :
Operating System : MS Windows XP / XP Professional
Front End : Java (JDK1.6)
Back End : Oracle 9i
Others : MS-word, Notepad, MS-paint


Hardware Requirement :
CPU : C2D 2.0 GHz
RAM : 1 GB
Hard Disk : 160 GB
MONITOR : LCD 15
PRINTER : Canon LaserJet
DVD R/W : 48X
UPS : 600VA








c. SOFTWARE JUSTIFICATION :

Microsoft Windows XP
The program is working in the Windows environment. Microsoft
Windows XP is the first operating system coming from Microsoft to
combine the advantages of the Windows NT core with the ease of use and
flexibility of the windows 9x series. Basically one can state that windows
XP is the fusion of the best of Windows 2000 & Windows Me. Microsoft
Windows XP is available in two different flavors:- The HOME and
Professional Edition. Behind the green or blue box lies exactly the same
operating System with a few minor feature differences. The Professional
edition adds some extra business oriented feature over the Home edition
with the support of SMP systems and IIS Web server, With its built-in
accessibility feature and compatibility with more than a dozen assistive
technology products, the Windows XP Operating System enhances
accessibility for user with specific vision, hearing, and mobility, cognitive
and seizure-related disabilities.

Java
Java is completely platform independent language. It is a solution of all
security and portability problems. The output of a java compiler is not
executable code. Rather, it is byte code. Byte code is a highly optimized set
of instructions designed to be executed by the Java run-time system, which
is called the Java Virtual Machine. Byte code makes it much easier to run a
program in a wide variety of environments because only the JVM needs to
be implemented for each platform.
The advantage of Java includes:
o Simple
o Secure
o Portable
o Object-oriented
o Robust
o Multithreaded
o Architecture-neutral
o Interpreted
o High performance
o Distributed
o Dynamic

Notepad
Notepad will be used to write codes and create Readme files. It is inbuilt
facility provided by operating system.

MS-Paint
ms-paint is the facility provided by the operating system itself and it is used
to draw the picture and image.

MS-Word
Ms-paint is provided by Microsoft in the built in pack of ms-office. It is used
to write codes, documents, read me files, tables, graphics etc



Oracle 9i
Oracle is one of the more sophisticated relational database
management system (RDBMSs), allows a great deal of flexibility in its
configuration and operation. The architecture of Oracle is configured in such
a way as to ensure that client requests for data retrieval and modification are
satisfied efficiently while maintaining database integrity. PL/SQL
(Procedural Language/SQL) is a procedural extension of Oracle-SQL that
offers language constructs which are necessary in order to implement
complex data structures and algorithms.
It includes:
o Centralized management
o Reliability
o Scalability
o Data dictionary
o Backup and Recovery
o Object oriented
o Automating tasks



Book
Library
Contain
Issue
Member
Return
Status of Return
Issue
Status of Issue
Member ID
Name
Addres
s
E-mail
ID
Book Issued ISBN No
Book Name
Member ID
Name
Addres
s
E-mail
ID
Book Issued ISBN No
Book Name
E-mail ID
Name Address
Ph_No
Email
Phone
No.No.
Address
Date_of_Expiry
Date_of_Joining
ISBN_NO
Book Name
Date of Arrival
Price
Rack No
Quentity
d. ER-DIAGRAM
Book Issue
Book Return
Stock Update
Stock Item Delete
Book Search
Stock Maintain
Report
e. DATA FLOW DIAGRAM:-















Admin



Library
Management
System
User
Login
New User Register
B
o
o
k

S
s
e
a
r
c
h
ISBN_NO
Book Name
Author
Date of Arrival
Price
Rack_No
Quantity
ISBN_NO
Book Name
Author
Date of Arrival
Price
Rack_No
Quantity

Top Level DFD
































Admin
1.0



Stock Update
Stock Update
Admin
1.0



Stock Item Delete
Stock Item Delete
Member_ID
Name
Address
Email Id
ISBN_No
Book_Status
Member_ID
Name
Address Email Id
ISBN No.
Book_Status






















Admin
Admin
1.0



Book Issue
Book Issue
1.0



Book Return
Book Return
Book Wise
ISBN_No Wise
Author Wise


User
1.0



Book Search
Book Search
Book Wise
ISBN_No Wise
Author Wise
ISBN_NO
Book Name
Author
Date of Arrival
Price
Rack_No
Quantity













Bottom Level DFD













User
1.0



Book Search
Book Search
Admin
1.0



Stock Maintain
Stock Detail
f. DATA TABLE (DICTIONARY):-


Login Table
COLUMN_NAME DATA_TYPE COMMENTS
UserName Varchar2 (30) Name of user
Password Varchar2 (30) Password
Login Type Varchar2 (20) Login type




Stock Maintain
COLUMN_NAME DATA_TYPE COMMENTS
Book Name Varchar2 (20) Stock Book Name
ISBN_NO Varchar2 (20) ISBN No
Author Varchar2 (20) Book Author
Year Number(20) Date of Publication
Quantity Number(20) Book Quantity
BookIssued Number(20) How many Book Issue
BookLeft Number(20) How many BookReturn
Remarks Varchar2(20) Status
Total Number(20) Total book in Stock






MemberShip
COLUMN_NAME DATA_TYPE COMMENTS
Name Varchar2 (15) Users Name
Password Varchar2(20) Users password
Address Varchar2 (20) Users Address
Phone_N0 Number(15) Users Ph_No
Email Id Varchar2(15) Users Email Id
Date of Joining Date Users joining
Date of Expiry Date Users expiry
MemberId Varchar2(20) Reg Member Id
IssuedBook Varchar2(20) Status
BookId Varchar2(20) ISBNNo.















The most creative and challenging phase of the life cycle is system
design. The term design describes a final system and the process by which it
is developed. It refers to the technical specifications that will be applied in
implementations of the candidate system. The design may be defined as the
process of applying various techniques and principles for the purpose of
defining a device, a process or a system with sufficient details to permit its
physical realization.
The designers goal is how the output is to be produced and in what
format. Samples of the output and input are also presented. Second input
data and database files have to be designed to meet the requirements of the
proposed output. The processing phases are handled through the program
Construction and Testing. Finally, details related to justification of the
system and an estimate of the impact of the candidate system on the user and
the organization are documented and evaluated by management as a step
toward implementation.
The importance of software design can be stated in a single word
Quality. Design provides us with representations of software that can be
assessed for quality. Design is the only way where we can accurately
translate a customers requirements into a complete software product or
system. Without design we risk building an unstable system that might fail if
small changes are made. It may as well be difficult to test, or could be one
whos quality cant be tested. So it is an essential phase in the development
of a software product.
ANALYSIS AND DESIGN
Module Description:
The aim of the project is to provide users a forum to become a member get
the details of the books available in the library. The administrator can use
this for their data update, modify, insert and details of the books as well as
details about the members.
The project is divided into seven main categories namely
1. STOCK MAINTAIN MODULE
2. BOOK SEARCH MODULE
3. BOOK ISSUE MODULE
4. BOOK RETURN MODULE
5. STOCK UPDATE MODULE
6. STOCK ITEM DELETE MODULE
7. REPORT MODULE

To implement the above modules a whole array of pages are made use
of. The first interface is the main page which provides access to the
administrator and the users. Second page is the administrator pages which
access the above modules. Each of the modules is explained as follows:

STOCK MAINTAIN: - It is the page which maintains the book details
its stock i.e. No. of books its price etc in the library and add the new
books available in the library, ISBN no. of the books details and its
price for further use.
BOOK SEARCH: - It is the page which searches books in the library
easily with the help of its ISBN no., book name and book author
without anyones help.
BOOK ISSUE: - It is the page which issue no. of books to the user
and member of the library and its details are added and quantities of
books are removed from the database.
BOOK RETURN: - It is the page through which book are returned by
the member from the library and its details and quantity of books are
added in the database
STOCK UPDATE: - It is the page which updates the quantity of the
books returned, books issued and available books in the database of
the library so that we should get accurate further details.
STOCK ITEM DELETE: -It is the page which deletes the books lost
or not required in the library from the database and it updates the
available no. of books.
REPORT: - It is the page which records all the items books available
members available, details of the book and no.of books issued to the
member.

Identification of the Need: Earlier Library employees did each and every
work manually. By doing the work manually, there were always great
chances of errors and dissatisfactions among management also. The manual
work is tedious and time consuming. It also get pressurize the employees
regarding their efficiency. Therefore there was always need for a kind of
software which can fulfill all the above requirement with accuracy in a
minimum amount of time and sorting all relevant problems using less afford.
Preliminary Investigation: Since all the works are done manually, thats
why there is more time requires for little job. Always there is queue of Party
waiting for their turn. The simple work looks like cumber some one. As a
result employees of the library get pressurize and members/students get
aggressive, because of suffering of a lot of time. This creates a little more
dissatisfaction among librarys employee. All either employees or
member/students want quick service, but this cant be done manually.
Therefore library management decides to convert manual system into
electronic i.e. computerization is required. By computerization any type of
query regarding details/update can be done instantly. customers get
information regarding any thing in which theyre required in few seconds.
Simultaneously, information can be viewed in graphical representation such
that easy for understanding. Storing and retrieval of information are so fast
that many jobs can be done in respectively lesser time. Computerization
makes information safer. Also, library management can generate several
reports, which will help him to plan future strategy for benefit of library
behalf.
Feasibility Study:
An important outcome of the preliminary investigation phase is that the
package required is feasible and meets the efficiency criterion, the
workability standard; also it meets the users needs. The various types of
feasibility are: -
Technical Feasibility:
This evaluation determines the following: -
Whether the technology needed for the proposed system is available
or not and the origination is capable to bear the cost for
implementation for this coming S/W or not.
How this technology integrated within the organization. Technical
evaluation must also assess whether the existing system can be
upgraded to use the new technology or the organization has expertise
to use it. In this case a totally new setup needed which obviously
suitable for proposed software..
Economic Feasibility:
This evaluation looks at the financial aspect of the project. To carry out an
economical study it is necessary to place actual money values against any
activities needed to implement the proposed system. It is also necessary to
place money values against any benefits that will come from a new system.
Such calculations are often described as cost benefit analysis. The proposed
software is economically feasible, as no big investment is required.
Schedule Feasibility:
It is the probability that the developer can complete the development of the
project within the scheduled time i.e.The time period is feasible or not.
Operational Feasibility:
Operational feasibility covers two aspects. The operational feasibility
determines how acceptable the software is within the organization. The
evaluation must then determine the general attitude and skills whether such
restructuring of the jobs will be acceptable to the users, are enough to run the
proposed budget, hence the system is supposed to be feasible regarding all
aspects of feasibility.
Over purpose to analyze the project to look at some of the steps taken to
develop a custom built system.

Data Gathering Aids:-
Some of the tool and technique used during data gathering operation are.
System flow chart: - These are use to record the flow of data in a current
procedure form the originating source, through a member of processing
operators and machines to the output report.
Data flow diagram:-This graphic used was used for defining inputs, process
and outputs, new symbols are used in there diagrams which may be placed
in rather in formal way.

SOFTWARE ENGINEERING PARADIGM APPLIED
Software engineering is the establishment and use of engineering principles
in order to obtain economically sound software that is reliable and works
efficiently on real machine. Software engineering is a layered technology.
An engineering approach (including software engineering) must rest on an
organizational commitment to quality.
The foundation for software engineering is the process layer. Software
engineering process is the glue that holds the technology layers together and
enables rational and timely development of software.












fig : Software Engineering Layers

TOOLS
METHODS
PROCESS
QUALITY FOCUS



A process model for software engineering is chosen based on the nature of
the project and application, the methods and tools to be used, and the
controls and deliverables that are required.
There are so many software engineering paradigm suggested by expert for
software development. Software paradigms are used on the nature of project.
These are:
Linear Sequential Model
The Prototype Model
The RAD Model
The Incremental Model
The Spiral Model
From the above all software paradigm I have suggested the Linear
sequential models as the requirement of project. For choosing this model I
have scan
The characteristic of the product
The project environment in which the software team works.
Linear Sequential model is also called Waterfall model. I have suggested
this model because it is easy in understanding and also easy in
implementation. In this model the software development phases are executed
in linear way. In this model there is no chance of rollback. For development
I have gone through the following steps as shown in the diagram:
By using Linear Sequential model I have gone through some difficulty also
because of Lack of flexibility (Rigid model) no chance of Roll backing.
In this model there is no option of Roll back. If any have gone forward they
can not come back.
It creates a cascade structure. By using Linear Sequential model I got so
many advantages because
It is the primary concept of software development life cycle.
It is applicable for those applications which are developed by highly
experience and expertise organization.
Project tracking of Waterfall model


Analysis
Design Coding Testing Implementation
System/
information
engineering
Analysis
Design
Coding
Testing
Implementation
Water fall model



MAIN FORM
LoginForm.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.sql.*;
import java.awt.image.*;
public class LoginForm extends JFrame implements ActionListener
{
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
JLabel l,l1,l2,l3,l4,l5,l6,l7,l8,l9;
JButton b1,b2,fimg,b3;
JTextField tf1;
JPasswordField jf1;
JPanel p1,p2,p3,p4;
JComboBox cb;
ImageIcon img;
Container conn;
Image icon=Toolkit.getDefaultToolkit().getImage("logo.gif");
public LoginForm()
CODING
{
super("Welcome to Khuda Bakhsh Oriental Public Library");
setIconImage(icon);
try
{
con=ConnectionOption.Connect();
stmt=con.createStatement();
}
catch(Exception e)
{
System.out.println("Error in connection");
}
conn=getContentPane();
conn.setLayout(null);
conn.setBackground(new Color(102,204,255));
p1=new JPanel();
p1.setLayout(null);
p1.setBackground(new Color(51,102,153));
p1.setBounds(300,300,250,120);
p2=new JPanel();
p2.setLayout(null);
p2.setBackground(new Color(51,102,153));
p2.setBounds(300,400,250,80);
p3=new JPanel();
p3.setLayout(null);
p3.setBackground(new Color(51,102,153));
p3.setBounds(60,20,480,200);
p4=new JPanel();
p4.setLayout(null);
p4.setBackground(new Color(102,204,255));
p4.setBounds(30,300,250,200);
ImageIcon img=new ImageIcon("library.jpg","Library image");
fimg=new JButton(img);
p3.add(fimg);
fimg.setBounds(5,5,470,190);
l=new JLabel("Already a member..! ");
l.setBounds(320,270,250,20);
l.setForeground(Color.magenta);
l.setFont(new Font("Arial",Font.BOLD+Font.ITALIC,20));
l4=new JLabel("Library was situated by");
l4.setBounds(10,10,250,20);
l4.setForeground(Color.magenta);
l4.setFont(new Font("Arial",Font.BOLD+Font.ITALIC,12));
l5=new JLabel("md.Khuda Bakhsh in 1891");
l5.setBounds(10,30,250,20);
l5.setForeground(Color.magenta);
l5.setFont(new Font("Arial",Font.BOLD+Font.ITALIC,12));
l6=new JLabel("'An Eastern Library' a book written");
l6.setBounds(10,60,250,20);
l6.setForeground(Color.magenta);
l6.setFont(new Font("Arial",Font.BOLD+Font.ITALIC,12));

l7=new JLabel("in the identity of Khuda Bakhsh");
l7.setBounds(10,80,250,20);
l7.setForeground(Color.magenta);
l7.setFont(new Font("Arial",Font.BOLD+Font.ITALIC,12));
l1=new JLabel("MemberID");
l1.setForeground(Color.orange);
tf1=new JTextField(20);
tf1.setBounds(125,10,100,20);
l2=new JLabel("Password");
l2.setForeground(Color.orange);
jf1=new JPasswordField(20);
jf1.setBounds(125,40,100,20);
l3=new JLabel("MemberType");
l3.setForeground(Color.orange);
l1.setBounds(10,10,100,22);
l2.setBounds(10,40,100,22);
l3.setBounds(10,70,100,22);
b1=new JButton("Login");
b1.setBounds(10,25,100,22);
b1.setForeground(Color.blue);
b1.addActionListener(this);
b2=new JButton("New User");
b2.setBounds(125,25,100,22);
b2.setForeground(Color.blue);
b3=new JButton("About Khuda Bakhsh");
b3.setBounds(20,130,160,20);
b3.setForeground(Color.blue);
b2.addActionListener(this);
b3.addActionListener(this);
cb=new JComboBox();
cb.setBounds(125,70,100,20);
cb.setForeground(Color.blue);
add(l);
conn.add(p1);
conn.add(p2);
conn.add(p3);
conn.add(p4);
p1.add(l1);
p1.add(l2);
p1.add(l3);
p1.add(tf1);
p1.add(jf1);
p1.add(cb);
p2.add(b1);
p2.add(b2);
p4.add(l4);
p4.add(l5);
p4.add(l6);
p4.add(l7);
p4.add(b3);
cb.addItem("SelectType");
cb.addItem("admin");
cb.addItem("user");
setLocation(300,100);
setResizable(false);
setSize(600,550);
b1.setMnemonic('L');
b2.setMnemonic('N');
b3.setMnemonic('A');
show();
addWindowListener(new win());
}
class win extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
System.exit(0);
}
}
public void actionPerformed(ActionEvent lbutton)
{
if(lbutton.getActionCommand().equals("Login"))
{
try
{
if(tf1.getText().length()>0 &&
jf1.getText().length()>0)
{
rs=stmt.executeQuery("select * from
login");
boolean b1=false;
while(rs.next() && b1==false)
{
if(tf1.getText().equals(rs.getString(1))
&& jf1.getText().equals(rs.getString(2)) &&
cb.getSelectedItem().equals("admin"))
{
b1=true;
setVisible(false);
new AdminLogin();
}
else{}

if(tf1.getText().equals(rs.getString(1))
&& jf1.getText().equals(rs.getString(2)) &&
cb.getSelectedItem().equals("user"))
{
b1=true;
setVisible(false);
new UserLogin();
}
else
{

//JOptionPane.showMessageDialog(this,"Error in login please enter your
correct memberid and password correctly or select your own membertype");
}
}
}
else
{

JOptionPane.showMessageDialog(this,"Error in login please enter your
memberid and password");
}
}
catch(Exception e)
{
System.out.println("Error in login");
}
}
if(lbutton.getActionCommand().equals("New User"))
{
setVisible(false);
new MemberForm();
}
if(lbutton.getActionCommand().equals("About Khuda
Bakhsh"))
{
setVisible(false);
new History();
}
}
public static void main(String args[])
{
LoginForm lg=new LoginForm();
lg.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
}

AdminLogin.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.sql.*;
import java.awt.image.*;
public class AdminLogin extends JFrame implements ActionListener
{
JMenuBar mb=new JMenuBar();
JButton m1=new JButton("BookStock");
JButton m2=new JButton("BookSearch");
JButton m3=new JButton("BookIssue");
JButton m4=new JButton("BookReturn");
JButton m5=new JButton("Update");
JButton m6=new JButton("Delete");
JButton m7=new JButton("Report");
JButton b1;
JPanel p=new JPanel();
JPanel p1=new JPanel();
JPanel p2=new JPanel();
JLabel l1=new JLabel("WELCOME ADMINISTRATOR");
ImageIcon img;
ImageIcon bimg;
JButton fimg;
Container con=getContentPane();
Image icon=Toolkit.getDefaultToolkit().getImage("logo.gif");
public AdminLogin()
{
setTitle("Welcome to admin login");
setIconImage(icon);
setSize(650,600);
setVisible(true);
setJMenuBar(mb);
p.setBounds(10,300,615,35);
l1.setBounds(160,180,400,200);
l1.setForeground(Color.magenta);
l1.setFont(new Font("Arial",Font.BOLD+Font.ITALIC,20));
ImageIcon img=new ImageIcon("library.jpg","Library image");
fimg=new JButton(img);
ImageIcon bimg=new ImageIcon("back.gif","Button image");
b1=new JButton(bimg);
p1.setLayout(null);
p1.setBackground(new Color(51,102,153));
p1.setBounds(80,20,490,200);
p2.setLayout(null);
p2.setBackground(new Color(51,102,153));
p2.setBounds(50,245,45,45);
m1.setForeground(Color.blue);
m2.setForeground(Color.blue);
m3.setForeground(Color.blue);
m4.setForeground(Color.blue);
m5.setForeground(Color.blue);
m6.setForeground(Color.blue);
m7.setForeground(Color.blue);
mb.add(m1);
mb.add(m2);
mb.add(m3);
mb.add(m4);
mb.add(m5);
mb.add(m6);
mb.add(m7);
con.add(p);
con.add(p1);
con.add(p2);
con.add(l1);
p.add(mb);
p1.add(fimg);
p2.add(b1);
fimg.setBounds(5,5,480,190);
b1.setBounds(0,0,45,45);
con.setLayout(null);
con.setBackground(new Color(102,204,255));
m1.addActionListener(this);
m2.addActionListener(this);
m3.addActionListener(this);
m4.addActionListener(this);
m5.addActionListener(this);
m6.addActionListener(this);
m7.addActionListener(this);
b1.addActionListener(this);
show();
m1.setMnemonic('B');
m2.setMnemonic('S');
m3.setMnemonic('I');
m4.setMnemonic('R');
m5.setMnemonic('U');
m6.setMnemonic('D');
m7.setMnemonic('P');
setVisible(true);
}
public void actionPerformed(ActionEvent evt)
{
if(evt.getSource().equals(m1))
{
setVisible(false);
new BookStock();
}
if(evt.getSource().equals(m2))
{
setVisible(false);
new BookSearch();
}
if(evt.getSource().equals(m3))
{
setVisible(false);
new BookIssue();
}
if(evt.getSource().equals(m4))
{
setVisible(false);
new BookReturn();
}
if(evt.getSource().equals(m5))
{
setVisible(false);
new Update();
}
if(evt.getSource().equals(m6))
{
setVisible(false);
new Delete();
}
if(evt.getSource().equals(m7))
{
setVisible(false);
new Report();
}
if(evt.getSource().equals(b1))
{
setVisible(false);
new LoginForm();
}
}
/*public static void main(String args[])
{
AdminLogin al=new AdminLogin();
al.setDefaultCloseOperation(EXIT_ON_CLOSE);
}*/
}

UserLogin.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.sql.*;
import java.awt.image.*;
public class UserLogin extends JFrame implements ActionListener
{
JMenuBar mb=new JMenuBar();
JButton m1=new JButton("History of library");
JButton m2=new JButton("BookSearch");
JButton b1;
JPanel p=new JPanel();
JPanel p1=new JPanel();
JPanel p2=new JPanel();
JLabel l1=new JLabel("WELCOME USER");
ImageIcon img;
ImageIcon bimg;
JButton fimg;
Container con=getContentPane();
Image icon=Toolkit.getDefaultToolkit().getImage("logo.gif");
public UserLogin()
{
setTitle("Welcome to user login");
setIconImage(icon);
setSize(650,600);
setVisible(true);
setJMenuBar(mb);
p.setBounds(220,300,240,35);
l1.setBounds(240,180,400,200);
l1.setForeground(Color.magenta);
l1.setFont(new Font("Arial",Font.BOLD+Font.ITALIC,20));
ImageIcon img=new ImageIcon("library.jpg","Library image");
fimg=new JButton(img);
ImageIcon bimg=new ImageIcon("back.gif","Button image");
b1=new JButton(bimg);
p1.setLayout(null);
p1.setBackground(new Color(51,102,153));
p1.setBounds(80,20,490,200);
p2.setLayout(null);
p2.setBackground(new Color(51,102,153));
p2.setBounds(50,245,45,45);
m1.setForeground(Color.blue);
m2.setForeground(Color.blue);
mb.add(m1);
mb.add(m2);
con.add(p);
con.add(p1);
con.add(p2);
con.add(l1);
p.add(mb);
p1.add(fimg);
p2.add(b1);
fimg.setBounds(5,5,480,190);
b1.setBounds(0,0,45,45);
con.setLayout(null);
con.setBackground(new Color(102,204,255));
m1.addActionListener(this);
m2.addActionListener(this);
b1.addActionListener(this);
m1.setMnemonic('H');
m2.setMnemonic('S');
show();
setVisible(true);
}
public void actionPerformed(ActionEvent evt)
{
if(evt.getSource().equals(m1))
{
setVisible(false);
new KhudaBakhsh();
}
if(evt.getSource().equals(m2))
{
setVisible(false);
new ItemSearch();
}
if(evt.getSource().equals(b1))
{
setVisible(false);
new LoginForm();
}
}
/*public static void main(String args[])
{
UserLogin ul=new UserLogin();
ul.setDefaultCloseOperation(EXIT_ON_CLOSE);
}*/
}

History.java
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.sql.*;
import java.awt.image.*;
public class History extends JFrame implements ActionListener
{
JTextArea ta1;
JButton b1;
JPanel p1=new JPanel();
JPanel p2=new JPanel();
JLabel l1=new JLabel("Welcome To Khuda Bakhsh Library");
ImageIcon img;
ImageIcon bimg;
JButton fimg;
Container con=getContentPane();
Image icon=Toolkit.getDefaultToolkit().getImage("logo.gif");
String val="HISTORICAL PERSPECTIVE:-\n\n" +
"Situated on the busy AshokRajpath, close to the
serene and tranquil\n" +
"banks of the ganges,in patna,stands the majestic
'KHUDA BAKHSH \n" +
"ORIENTAL PUBLIC LIBRARY',a unique
repository of rare manuscripts in\n" +
"Arabic, Persian, Urdu, Turkish, Pushto, Hindi and
Sanskrit related to\n" +
"various disciplines of knowledge. Besides a large
collection of printed\n" +
"books including old and rare prints both in
oriental and western\n" +
"language. Another major attraction is its valuable
collection of 2000\n" +
"magnificient paintings of Mughal, Rajput,
Awadh, Turkish, Iranian and \n" +
"central asian schools.\n\n" +
"Mohammad Bakhsh(d.1876) was a bibiophile
who collected about 1400\n" +
"manuscripts during his lifetime, with which he
setup a modest library,\n" +
"The Kutub, Khana-i-Mohammadiya. Inheriting
these 1400 manuscripts \n" +
"from his father Khuda Bakhsh. The library was
formally inaugurated on\n" +
"14th of jan 1891 and opened to the public on 5th
of octuber.\n\n" +
"MATERIALS ACQUIRED BY LIBRARY:-\n" +
"1. Manuscripts\n" +
"2. Books\n" +
"3. Periodicals\n" +
"4. Cassettes\n" +
"5. CDs\n\n" +
"In the identity of Khuda Bakhsh library an eastern
book 'AN EASTERN\n" +
"LIBRARY' was written by V.C Scott Conner.";
public History()
{
setTitle("About Khuda Bakhsh Library");
setIconImage(icon);
setSize(650,600);
setVisible(true);
l1.setBounds(110,10,340,40);
l1.setForeground(Color.magenta);
l1.setFont(new Font("Arial",Font.BOLD+Font.ITALIC,20));
ImageIcon img=new ImageIcon("khuda.jpg","Picture image");
fimg=new JButton(img);
ImageIcon bimg=new ImageIcon("back.gif","Button image");
b1=new JButton(bimg);
ta1=new JTextArea(val);
ta1.setBounds(40,100,400,450);
ta1.setBackground(new Color(102,204,255));
p1.setLayout(null);
p1.setBackground(new Color(51,102,153));
p1.setBounds(475,10,155,230);
p2.setLayout(null);
p2.setBackground(new Color(51,102,153));
p2.setBounds(50,10,45,45);
con.add(p1);
con.add(p2);
con.add(l1);
con.add(ta1);
p1.add(fimg);
p2.add(b1);
fimg.setBounds(0,0,155,230);
b1.setBounds(0,0,45,45);
con.setLayout(null);
con.setBackground(new Color(102,204,255));
b1.addActionListener(this);
ta1.setEditable(false);
show();
setVisible(true);
}
public void actionPerformed(ActionEvent evt)
{
if(evt.getSource().equals(b1))
{
setVisible(false);
new LoginForm();
}
}
/*public static void main(String args[])
{
History hi=new History();
hi.setDefaultCloseOperation(EXIT_ON_CLOSE);
}*/
}

C Co on nn ne ec ct ti io on nO Op pt ti io on n. .j ja av va a
i im mp po or rt t j ja av va a. .s sq ql l. .* *; ;
p pu ub bl li ic c c cl la as ss s C Co on nn ne ec ct ti io on nO Op pt ti io on n
{ {
p pu ub bl li ic c s st ta at ti ic c C Co on nn ne ec ct ti io on n C Co on nn ne ec ct t( () )
{ {
f fi in na al l S St tr ri in ng g
d dr ri iv ve er rC Cl la as ss s= =" "o or ra ac cl le e. .j jd db bc c. .d dr ri iv ve er r. .O Or ra ac cl le eD Dr ri iv ve er r" "; ;
f fi in na al l S St tr ri in ng g
C Co on nn ne ec ct ti io on nU UR RL L= =" "j jd db bc c: :o or ra ac cl le e: :t th hi in n: :@ @l lo oc ca al lh ho os st t: :1 15 52 21 1: :s si im mp py y" "; ;
f fi in na al l S St tr ri in ng g u us se er rI ID D= =" "s sc co ot tt t" "; ;
f fi in na al l S St tr ri in ng g u us se er rP Pa as ss sw wo or rd d= =" "t ti ig ge er r" "; ;
C Co on nn ne ec ct ti io on n c co on n= =n nu ul ll l; ;
t tr ry y
{ {
S Sy ys st te em m. .o ou ut t. .p pr ri in nt tl ln n( (" "L Lo oa ad di in ng g J JD DB BC C D Dr ri iv ve er r - -> >
" "+ +d dr ri iv ve er rC Cl la as ss s+ +" "\ \n n" ") ); ;
C Cl la as ss s. .f fo or rN Na am me e( (d dr ri iv ve er rC Cl la as ss s) ). .n ne ew wI In ns st ta an nc ce e( () ); ;
S Sy ys st te em m. .o ou ut t. .p pr ri in nt tl ln n( (" "C Co on nn ne ec ct ti io on n t to o - -
> >" "+ +C Co on nn ne ec ct ti io on nU UR RL L+ +" "\ \n n" ") ); ;

c co on n= =D Dr ri iv ve er rM Ma an na ag ge er r. .g ge et tC Co on nn ne ec ct ti io on n( (C Co on nn ne ec ct ti io on nU UR RL L, ,u us se er rI ID D, ,u us se er rP Pa as ss s
w wo or rd d) ); ;
S Sy ys st te em m. .o ou ut t. .p pr ri in nt tl ln n( (" "c co on nn ne ec ct ti io on n e es st ta ab bl li is sh he ed d" ") ); ;

} }
c ca at tc ch h( (C Cl la as ss sN No ot tF Fo ou un nd dE Ex xc ce ep pt ti io on n e e) )
{ {
e e. .p pr ri in nt tS St ta ac ck kT Tr ra ac ce e( () ); ;
S Sy ys st te em m. .e ex xi it t( (1 1) ); ;
} }
c ca at tc ch h( (I Il ll le eg ga al lA Ac cc ce es ss sE Ex xc ce ep pt ti io on n e e) )
{ {
e e. .p pr ri in nt tS St ta ac ck kT Tr ra ac ce e( () ); ;
S Sy ys st te em m. .e ex xi it t( (1 1) ); ;
} }
c ca at tc ch h( (I In ns st ta an nt ti ia at ti io on nE Ex xc ce ep pt ti io on n e e) )
{ {
e e. .p pr ri in nt tS St ta ac ck kT Tr ra ac ce e( () ); ;
S Sy ys st te em m. .e ex xi it t( (1 1) ); ;
} }
c ca at tc ch h( (S SQ QL LE Ex xc ce ep pt ti io on n e e) )
{ {
e e. .p pr ri in nt tS St ta ac ck kT Tr ra ac ce e( () ); ;
S Sy ys st te em m. .e ex xi it t( (1 1) ); ;
} }
r re et tu ur rn n c co on n; ;
} }
p pu ub bl li ic c s st ta at ti ic c v vo oi id d m ma ai in n( (S St tr ri in ng g a ar rg gs s[ [] ]) )
{ {
C Co on nn ne ec ct ti io on nO Op pt ti io on n c co o= =n ne ew w C Co on nn ne ec ct ti io on nO Op pt ti io on n( () ); ;
/ // /c co o. .p pe er rf fo or rm mU Us se er rQ Qu ue er ry y( () ); ;
/ // /c co o. .c cl lo os se eC Co on nn ne ec ct ti io on n( () ); ;
} }
} }

B Bo oo ok kS St to oc ck k. .j ja av va a
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.sql.*;
import java.lang.String;
public class BookStock extends JFrame implements ActionListener
{
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
JTextField t1,t2,t3,t4,t5,t6,t7,t8;
JLabel l1,l2,l3,l4,l5,l6,l7,l8;
JButton b1,b2;
Panel p=new Panel();
Panel p1=new Panel();
Panel p2=new Panel();
Container conn;
ImageIcon bimg;
Image icon=Toolkit.getDefaultToolkit().getImage("logo.gif");
public BookStock()
{
super("Maintain BookStock");
setIconImage(icon);
conn=getContentPane();
conn.setLayout(null);
conn.setBackground(new Color(102,204,255));
ImageIcon bimg=new ImageIcon("back.gif","Button image");
b2=new JButton(bimg);
p.setLayout(null);
p.setBackground(new Color(102,204,255));
p.setBounds(80,40,280,260);
p1.setLayout(null);
p1.setBackground(new Color(102,204,255));
p1.setBounds(80,300,280,40);
p2.setLayout(null);
p2.setBackground(new Color(51,102,153));
p2.setBounds(30,10,45,45);
b2.setBounds(0,0,45,45);
setLocation(200,300);
setSize(450,400);
l1=new JLabel("MemberID");
l1.setForeground(Color.magenta);
t1=new JTextField(20);
l2=new JLabel("ISBN No.");
l2.setForeground(Color.magenta);
t2=new JTextField(20);
l3=new JLabel("Book Title");
l3.setForeground(Color.magenta);
t3=new JTextField(20);
l4=new JLabel("Author");
l4.setForeground(Color.magenta);
t4=new JTextField(20);
l5=new JLabel("Year");
l5.setForeground(Color.magenta);
t5=new JTextField(20);
l6=new JLabel("quantity");
l6.setForeground(Color.magenta);
t6=new JTextField(20);
l7=new JLabel("remarks");
l7.setForeground(Color.magenta);
t7=new JTextField(20);
l8=new JLabel("Remarks");
l8.setForeground(Color.magenta);
t8=new JTextField(20);
b1=new JButton("Add");
b1.setForeground(Color.blue);
l1.setBounds(10,10,100,22);
l2.setBounds(10,40,100,22);
l3.setBounds(10,70,100,22);
l4.setBounds(10,100,100,22);
l5.setBounds(10,130,100,22);
l6.setBounds(10,160,100,22);
l7.setBounds(10,190,100,22);
l8.setBounds(10,220,100,22);
t1.setBounds(120,10,160,20);
t2.setBounds(120,40,160,20);
t3.setBounds(120,70,160,20);
t4.setBounds(120,100,160,20);
t5.setBounds(120,130,160,20);
t6.setBounds(120,160,160,20);
t7.setBounds(120,190,160,20);
t8.setBounds(120,220,160,20);
b1.setBounds(80,10,100,22);
conn.add(p);
conn.add(p1);
conn.add(p2);
p2.add(b2);
p.add(l2);
p.add(l3);
p.add(l4);
p.add(l5);
p.add(l6);
p.add(l7);
p.add(t2);
p.add(t3);
p.add(t4);
p.add(t5);
p.add(t6);
p.add(t7);
p1.add(b1);
b1.addActionListener(this);
b2.addActionListener(this);
b1.setMnemonic('A');
try
{
con=ConnectionOption.Connect();
stmt=con.createStatement();
}

catch(Exception e)
{
System.out.println("Error in connection");
}
show();
}
public void actionPerformed(ActionEvent lbutton)
{
if(lbutton.getActionCommand().equals("Add"))
{
try
{
boolean b1=false;
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
int a=Integer.parseInt(t2.getText());
String b=t3.getText();
String c=t4.getText();
int d=Integer.parseInt(t5.getText());
int e=Integer.parseInt(t6.getText());
String f=t7.getText();
int g=e-0;
String sql="insert into bookdetails values("+
a + ",'" + b + "','" + c +"'," + d + "," + e + "," + 0 + "," + g + ",'" + f + "')";
int status=stmt.executeUpdate(sql);
if(status>0)
{

JOptionPane.showMessageDialog(null,"one record inserted");
}
else
{

JOptionPane.showMessageDialog(null,"sorry record can't be
inserted");
}
b1=true;
setVisible(false);
new AdminLogin();
}
catch(Exception e)
{
System.out.println("Error in insertion" + e);
}
}
if(lbutton.getSource().equals(b2))
{
setVisible(false);
new AdminLogin();
}
}
/*public static void main(String args[])
{
BookStock bs=new BookStock();
bs.setDefaultCloseOperation(EXIT_ON_CLOSE);
}*/
}

BookSearch.java
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.sql.*;
import java.lang.String;
public class BookSearch extends JFrame implements
ActionListener,ItemListener
{
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
JLabel l1=new JLabel("Filter");
JComboBox cb=new JComboBox();
JLabel l2=new JLabel("EnterBookName");
JLabel l3=new JLabel("EnterAuthorName ");
JLabel l4=new JLabel("Enter ISBNNo.");
JLabel sl1=new JLabel("ISBNNo.");
JLabel sl2=new JLabel("BookTitle");
JLabel sl3=new JLabel("Author");
JLabel sl4=new JLabel("Year");
JLabel sl5=new JLabel("Quantity");
JLabel sl6=new JLabel("Book left");
JButton b2=new JButton("Search");
JButton b3=new JButton("Search");
JButton b4=new JButton("Search");
JTextField t1=new JTextField(40);
JTextField t2=new JTextField(40);
JTextField t3=new JTextField(40);
JTextField st1=new JTextField(40);
JTextField st2=new JTextField(40);
JTextField st3=new JTextField(40);
JTextField st4=new JTextField(40);
JTextField st5=new JTextField(40);
JTextField st6=new JTextField(40);
JButton b1;
JPanel p1,p2,p3,p4,p5,p6;
Container conn;
ImageIcon bimg;
Image icon=Toolkit.getDefaultToolkit().getImage("logo.gif");
public BookSearch()
{
super("BookSearch");
setIconImage(icon);
conn=getContentPane();
conn.setLayout(null);
conn.setBackground(new Color(102,204,255));
ImageIcon bimg=new ImageIcon("back.gif","Button image");
b1=new JButton(bimg);
setVisible(true);
setLocation(200,300);
setSize(500,500);
p1=new JPanel();
p1.setLayout(null);
p1.setBackground(new Color(102,204,255));
p1.setBounds(80,70,350,50);
p2=new JPanel();
p2.setLayout(null);
p2.setBackground(new Color(102,204,255));
p2.setBounds(80,140,350,80);
p3=new JPanel();
p3.setLayout(null);
p3.setBackground(new Color(102,204,255));
p3.setBounds(80,140,350,80);
p4=new JPanel();
p4.setLayout(null);
p4.setBackground(new Color(102,204,255));
p4.setBounds(80,140,350,80);
p6=new JPanel();
p6.setLayout(null);
p6.setBackground(new Color(102,204,255));
p6.setBounds(100,240,350,180);
p5=new JPanel();
p5.setLayout(null);
p5.setBackground(new Color(51,102,153));
p5.setBounds(30,10,45,45);
b1.setBounds(0,0,45,45);
conn.add(p1);
p1.add(l1);
p1.add(cb);
conn.add(p2);
conn.add(p3);
conn.add(p4);
conn.add(p5);
conn.add(p6);
p2.add(l2);
p2.add(t1);
p2.add(b2);
p3.add(l3);
p3.add(t2);
p3.add(b3);
p4.add(l4);
p4.add(t3);
p4.add(b4);
p5.add(b1);
l1.setForeground(Color.magenta);
l2.setForeground(Color.magenta);
l3.setForeground(Color.magenta);
l4.setForeground(Color.magenta);
b2.setForeground(Color.blue);
b3.setForeground(Color.blue);
b4.setForeground(Color.blue);
cb.setForeground(Color.blue);
l1.setBounds(10,10,120,30);
cb.setBounds(160,10,150,25);
l2.setBounds(10,10,120,30);
t1.setBounds(160,10,150,25);
b2.setBounds(110,50,100,25);
l3.setBounds(10,10,120,30);
t2.setBounds(160,10,150,25);
b3.setBounds(110,50,100,25);
l4.setBounds(10,10,120,30);
t3.setBounds(160,10,150,25);
b4.setBounds(110,50,100,25);
sl1.setForeground(Color.magenta);
sl2.setForeground(Color.magenta);
sl3.setForeground(Color.magenta);
sl4.setForeground(Color.magenta);
sl5.setForeground(Color.magenta);
sl6.setForeground(Color.magenta);
sl1.setBounds(10,10,100,22);
sl2.setBounds(10,40,100,22);
sl3.setBounds(10,70,100,22);
sl4.setBounds(10,100,100,22);
sl5.setBounds(10,130,100,22);
sl6.setBounds(10,160,100,22);
st1.setBounds(120,10,160,20);
st2.setBounds(120,40,160,20);
st3.setBounds(120,70,160,20);
st4.setBounds(120,100,160,20);
st5.setBounds(120,130,160,20);
st6.setBounds(120,160,160,20);
p6.add(sl1);
p6.add(sl2);
p6.add(sl3);
p6.add(sl4);
p6.add(sl5);
p6.add(sl6);
p6.add(st1);
p6.add(st2);
p6.add(st3);
p6.add(st4);
p6.add(st5);
p6.add(st6);
cb.addItem("Search");
cb.addItem("Bookwise");
cb.addItem("Authorwise");
cb.addItem("ISBNNo.wise");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
cb.addItemListener(this);
p2.setVisible(false);
p3.setVisible(false);
p4.setVisible(false);
p6.setVisible(false);
try
{
con=ConnectionOption.Connect();
stmt=con.createStatement();
}
catch(Exception e)
{
System.out.println("Error in connection");
}
st1.setEditable(false);
st2.setEditable(false);
st3.setEditable(false);
st4.setEditable(false);
st5.setEditable(false);
st6.setEditable(false);
b2.setMnemonic('S');
b3.setMnemonic('S');
b4.setMnemonic('S');
show();
}
public void actionPerformed(ActionEvent evt)
{
if(evt.getSource().equals(b1))
{
setVisible(false);
new AdminLogin();
}
if(evt.getSource().equals(b4))
{
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select * from
bookdetails");
boolean b1=false;
while(rs.next() && b1==false)
{
if(t3.getText().equals(rs.getString(1)))
{
int acc=rs.getInt(1);
System.out.println(""+acc);
String title=rs.getString(2);
String author=rs.getString(3);
String year=rs.getString(4);
String quan=rs.getString(5);
String book=rs.getString(7);
String remark=rs.getString(8);
p6.setVisible(true);
st1.setText(""+acc);
st2.setText(""+title);
st3.setText(""+author);
st4.setText(""+year);
st5.setText(""+quan);
st6.setText(""+book);
}
}
}
catch(Exception ex)
{
System.out.println("Error in connection");
}

}
if(evt.getSource().equals(b2))
{
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select * from
bookdetails");
boolean b1=false;
while(rs.next() && b1==false)
{
if(t1.getText().equals(rs.getString(2)))
{
int acc=rs.getInt(1);
String title=rs.getString(2);
String author=rs.getString(3);
String year=rs.getString(4);
String quan=rs.getString(5);
String book=rs.getString(7);


p6.setVisible(true);
st1.setText(""+acc);
st2.setText(""+title);
st3.setText(""+author);
st4.setText(""+year);
st5.setText(""+quan);
st6.setText(""+book);
}
}
}
catch(Exception ex)
{
System.out.println("Error in connection");
}

}
if(evt.getSource().equals(b3))
{
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select * from
bookdetails");
boolean b1=false;
while(rs.next() && b1==false)
{
if(t2.getText().equals(rs.getString(3)))
{
int acc=rs.getInt(1);
String title=rs.getString(2);
String author=rs.getString(3);
String year=rs.getString(4);
String quan=rs.getString(5);
String book=rs.getString(7);


p6.setVisible(true);
st1.setText(""+acc);
st2.setText(""+title);
st3.setText(""+author);
st4.setText(""+year);
st5.setText(""+quan);
st6.setText(""+book);
}
}
}
catch(Exception ex)
{
System.out.println("Error in connection");
}

}
}
public void itemStateChanged(ItemEvent ev)
{
if(ev.getSource().equals(cb))
{
if(cb.getSelectedIndex()==0)
{
p2.setVisible(false);
p3.setVisible(false);
p4.setVisible(false);
p6.setVisible(false);
}
if(cb.getSelectedIndex()==1)
{
p2.setVisible(true);
p3.setVisible(false);
p4.setVisible(false);
p6.setVisible(false);
}
if(cb.getSelectedIndex()==2)
{
p3.setVisible(true);
p2.setVisible(false);
p4.setVisible(false);
p6.setVisible(false);
}
if(cb.getSelectedIndex()==3)
{
p4.setVisible(true);
p2.setVisible(false);
p3.setVisible(false);
p6.setVisible(false);
}
}
}
/*public static void main(String args[])
{
BookSearch bs=new BookSearch();
bs.setDefaultCloseOperation(EXIT_ON_CLOSE);
}*/
}

BookIssue.java
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.sql.*;
import java.lang.String;
public class BookIssue extends JFrame implements ActionListener,
FocusListener
{
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
ResultSet rset=null;
JTextField t1,t2,t3,t4,t5,t6,t7,t8;
JLabel l1,l2,l3,l4,l5,l6,l7,l8;
JButton b1,b2;
Panel p=new Panel();
Panel p1=new Panel();
Panel p2=new Panel();
Container conn;
ImageIcon bimg,image;
Image icon=Toolkit.getDefaultToolkit().getImage("logo.gif");
public BookIssue()
{
super("Book Issue");
conn=getContentPane();
conn.setLayout(null);
conn.setBackground(new Color(102,204,255));
setIconImage(icon);
ImageIcon bimg=new ImageIcon("back.gif","Button image");
ImageIcon image=new ImageIcon("book.jpg","logo image");

b2=new JButton(bimg);
p.setLayout(null);
p.setBackground(new Color(102,204,255));
p.setBounds(80,40,280,260);
p1.setLayout(null);
p1.setBackground(new Color(102,204,255));
p1.setBounds(80,300,280,40);
p2.setLayout(null);
p2.setBackground(new Color(51,102,153));
p2.setBounds(30,10,45,45);
b2.setBounds(0,0,45,45);
setLocation(200,300);
setSize(450,400);
l1=new JLabel("MemberID");
l1.setForeground(Color.magenta);
t1=new JTextField(40);
l2=new JLabel("Name");
l2.setForeground(Color.magenta);
t2=new JTextField(40);
l3=new JLabel("Address");
l3.setForeground(Color.magenta);
t3=new JTextField(40);
l4=new JLabel("Phone No.");
l4.setForeground(Color.magenta);
t4=new JTextField(40);
l5=new JLabel("Email Id");
l5.setForeground(Color.magenta);
t5=new JTextField(40);
l6=new JLabel("ISBNNo.");
l6.setForeground(Color.magenta);
t6=new JTextField(40);
l7=new JLabel("Status");
l7.setForeground(Color.magenta);
t7=new JTextField(40);
l8=new JLabel("BookIssued");
l8.setForeground(Color.magenta);
t8=new JTextField(40);
b1=new JButton("Book Issued");
b1.setForeground(Color.blue);
l1.setBounds(10,10,100,22);
l2.setBounds(10,40,100,22);
l3.setBounds(10,70,100,22);
l4.setBounds(10,100,100,22);
l5.setBounds(10,130,100,22);
l8.setBounds(10,160,100,22);
l6.setBounds(10,190,100,22);
l7.setBounds(10,220,100,22);
t1.setBounds(120,10,160,20);
t2.setBounds(120,40,160,20);
t3.setBounds(120,70,160,20);
t4.setBounds(120,100,160,20);
t5.setBounds(120,130,160,20);
t8.setBounds(120,160,160,20);
t6.setBounds(120,190,160,20);
t7.setBounds(120,220,160,20);
b1.setBounds(80,10,120,22);
conn.add(p);
conn.add(p1);
conn.add(p2);
p2.add(b2);
p.add(l1);
p.add(l2);
p.add(l3);
p.add(l4);
p.add(l5);
p.add(l6);
p.add(l7);
p.add(l8);
p.add(t1);
p.add(t2);
p.add(t3);
p.add(t4);
p.add(t5);
p.add(t6);
p.add(t7);
p.add(t8);
p1.add(b1);
b1.addActionListener(this);
b2.addActionListener(this);
t1.addFocusListener(this);
t6.addFocusListener(this);
b1.setMnemonic('I');
try
{
con=ConnectionOption.Connect();
stmt=con.createStatement();
}
catch(Exception e)
{
System.out.println("Error in connection");
}
show();
t2.setEditable(false);
t3.setEditable(false);
t4.setEditable(false);
t5.setEditable(false);
t7.setEditable(false);
t8.setEditable(false);
}
public void focusGained(FocusEvent e)
{
if(e.getSource().equals(t1))
{
if(t1.getText().length()>=0)
{ }
}
if(e.getSource().equals(t6))
{
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select * from
memberdetails");
boolean b1=false;
while(rs.next() && b1==false)
{
if(t1.getText().equals(rs.getString(1)))
{
int mid=rs.getInt(1);
System.out.println(""+mid);
String name=rs.getString(3);
String add=rs.getString(4);
String phone=rs.getString(5);
String email=rs.getString(6);
String book=rs.getString(9);

t2.setText(""+name);
t3.setText(""+add);
t4.setText(""+phone);
t5.setText(""+email);
t8.setText(""+book);
}
}
}
catch(Exception ex)
{
System.out.println("Error in connection");
}
}
}
public void focusLost(FocusEvent e)
{
if(e.getSource().equals(t1))
{
t6.requestFocus();
}
if(e.getSource().equals(t6))
{
b1.requestFocus();
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select * from
bookdetails");
boolean b1=false;
while(rs.next() && b1==false)
{
if(t6.getText().equals(rs.getString(1)))
{
int mid=rs.getInt(1);
String quan=rs.getString(7);

t7.setText(""+quan);
}
}
}
catch(Exception ex)
{
System.out.println("Error in connection");
}
}
}
public void actionPerformed(ActionEvent evt)
{
if(evt.getSource().equals(b1))
{
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rset=stmt.executeQuery("select * from
bookdetails");
boolean b=false;
while(rset.next() && b==false)
{
if(t6.getText().equals(rset.getString(1)))
{
int quan=rset.getInt(5);
int issued=rset.getInt(6);
issued++;
int left=quan - issued;
String sql="update bookdetails
set bookissued=(" + issued + "), bookleft=(" + left + ") where
accountnumber=('" + rset.getString(1) + "')";
int
status=stmt.executeUpdate(sql);
if(status>0)
{
try
{

con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select *
from memberdetails");
while(rs.next())
{

if(t1.getText().equals(rs.getString(1)))
{
int mid=rs.getInt(1);
System.out.println(""
+mid);
String
bid=rs.getString(9);
bid="yes";
System.out.println(""
+bid);
String book=t6.getText();
System.out.println(""
+book);
String q="update
memberdetails set bookissued=('" + bid + "'), bookid=('" + book + "') where
memberid=(" + mid + ")";
int
status1=stmt.executeUpdate(q);
}
}
}
catch(Exception e)
{
System.out.println("Error" );
}

JOptionPane.showMessageDialog(null,"one book issued");
}
else
{

JOptionPane.showMessageDialog(null,"sorry book can't be issued");
}
}
}
}
catch(Exception e)
{
System.out.println("Error in issue" );
}
setVisible(false);
new AdminLogin();
}
if(evt.getSource().equals(b2))
{
setVisible(false);
new AdminLogin();
}
}
/*public static void main(String args[])
{
BookIssue bi=new BookIssue();
//bi.setDefaultCloseOperation(EXIT_ON_CLOSE);
}*/
}

BookReturn.java
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.sql.*;
import java.lang.String;
public class BookReturn extends JFrame implements ActionListener,
FocusListener
{
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
ResultSet rset=null;
JTextField t1,t2,t3,t4,t5,t6,t7,t8;
JLabel l1,l2,l3,l4,l5,l6,l7,l8;
JButton b1,b2;
Panel p=new Panel();
Panel p1=new Panel();
Panel p2=new Panel();
Container conn;
ImageIcon bimg;
Image icon=Toolkit.getDefaultToolkit().getImage("logo.gif");
public BookReturn()
{
super("Book Return");
setIconImage(icon);
conn=getContentPane();
conn.setLayout(null);
conn.setBackground(new Color(102,204,255));
ImageIcon bimg=new ImageIcon("back.gif","Button image");
b2=new JButton(bimg);
p.setLayout(null);
p.setBackground(new Color(102,204,255));
p.setBounds(80,40,280,260);
p1.setLayout(null);
p1.setBackground(new Color(102,204,255));
p1.setBounds(80,300,280,40);
p2.setLayout(null);
p2.setBackground(new Color(51,102,153));
p2.setBounds(30,10,45,45);
b2.setBounds(0,0,45,45);
setLocation(200,300);
setSize(450,400);
l1=new JLabel("MemberID");
l1.setForeground(Color.magenta);
t1=new JTextField(20);
l2=new JLabel("Name");
l2.setForeground(Color.magenta);
t2=new JTextField(20);
l3=new JLabel("Address");
l3.setForeground(Color.magenta);
t3=new JTextField(20);
l4=new JLabel("Phone No.");
l4.setForeground(Color.magenta);
t4=new JTextField(20);
l5=new JLabel("Email Id");
l5.setForeground(Color.magenta);
t5=new JTextField(20);
l6=new JLabel("Account No.");
l6.setForeground(Color.magenta);
t6=new JTextField(20);
l7=new JLabel("Status");
l7.setForeground(Color.magenta);
t7=new JTextField(20);
l8=new JLabel("BookStatus");
l8.setForeground(Color.magenta);
t8=new JTextField(20);
b1=new JButton("Book Returned");
b1.setForeground(Color.blue);
l1.setBounds(10,10,100,22);
l2.setBounds(10,40,100,22);
l3.setBounds(10,70,100,22);
l4.setBounds(10,100,100,22);
l5.setBounds(10,130,100,22);
l8.setBounds(10,160,100,22);
l6.setBounds(10,190,100,22);
l7.setBounds(10,220,100,22);
t1.setBounds(120,10,160,20);
t2.setBounds(120,40,160,20);
t3.setBounds(120,70,160,20);
t4.setBounds(120,100,160,20);
t5.setBounds(120,130,160,20);
t8.setBounds(120,160,160,20);
t6.setBounds(120,190,160,20);
t7.setBounds(120,220,160,20);
b1.setBounds(60,10,120,22);
conn.add(p);
conn.add(p1);
conn.add(p2);
p2.add(b2);
p.add(l1);
p.add(l2);
p.add(l3);
p.add(l4);
p.add(l5);
p.add(l6);
p.add(l7);
p.add(l8);
p.add(t1);
p.add(t2);
p.add(t3);
p.add(t4);
p.add(t5);
p.add(t6);
p.add(t7);
p.add(t8);
p1.add(b1);
b1.addActionListener(this);
b2.addActionListener(this);
t1.addFocusListener(this);
t6.addFocusListener(this);
b1.setMnemonic('R');
try
{
con=ConnectionOption.Connect();
stmt=con.createStatement();
}
catch(Exception e)
{
System.out.println("Error in connection");
}
show();
t2.setEditable(false);
t3.setEditable(false);
t4.setEditable(false);
t5.setEditable(false);
t7.setEditable(false);
t8.setEditable(false);
}
public void focusGained(FocusEvent e)
{
if(e.getSource().equals(t1))
{
if(t1.getText().length()>=0)
{
}
}
if(e.getSource().equals(t6))
{
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select * from
memberdetails");
boolean b1=false;
while(rs.next() && b1==false)
{
if(t1.getText().equals(rs.getString(1)))
{
int mid=rs.getInt(1);
System.out.println(""+mid);
String name=rs.getString(3);
String add=rs.getString(4);
String phone=rs.getString(5);
String email=rs.getString(6);
String book=rs.getString(9);

t2.setText(""+name);
t3.setText(""+add);
t4.setText(""+phone);
t5.setText(""+email);
t8.setText(""+book);
}
}
}
catch(Exception ex)
{
System.out.println("Error in connection");
}
}
}
public void focusLost(FocusEvent e)
{
if(e.getSource().equals(t1))
{
t6.requestFocus();
}
if(e.getSource().equals(t6))
{
b1.requestFocus();
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select * from
bookdetails");
boolean b1=false;
while(rs.next() && b1==false)
{
if(t6.getText().equals(rs.getString(1)))
{
int mid=rs.getInt(1);
String quan=rs.getString(7);

t7.setText(""+quan);
}
}
}
catch(Exception ex)
{
System.out.println("Error in connection");
}
}
}

public void actionPerformed(ActionEvent evt)
{
if(evt.getSource().equals(b1))
{
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rset=stmt.executeQuery("select * from
bookdetails");
boolean b=false;
while(rset.next() && b==false)
{
if(t6.getText().equals(rset.getString(1)))
{
int quan=rset.getInt(5);
int ret=rset.getInt(6);
ret--;
int left=quan - ret;
String sql="update bookdetails
set bookissued=(" + ret + "), bookleft=(" + left + ") where
accountnumber=('" + rset.getString(1) + "')";
int
status=stmt.executeUpdate(sql);

if(status>0)
{
try
{

con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select *
from memberdetails");
while(rs.next())
{

if(t1.getText().equals(rs.getString(1)))
{
int mid=rs.getInt(1);
System.out.println(""
+mid);
String
bid=rs.getString(9);
bid="no";
System.out.println(""
+bid);
String q="update
memberdetails set bookissued=('" + bid + "'),bookid=('" + null + "') where
memberid=(" + mid + ")";
int
status1=stmt.executeUpdate(q);
}
}
}
catch(Exception e)
{
System.out.println("Error" );
}

JOptionPane.showMessageDialog(null,"one book returned");
}
else
{

JOptionPane.showMessageDialog(null,"sorry book can't be
returned");
}
}
}
}
catch(Exception e)
{
System.out.println("Error in return" );
}
setVisible(false);
new AdminLogin();
}
if(evt.getSource().equals(b2))
{
setVisible(false);
new AdminLogin();
}
}
/*public static void main(String args[])
{
BookReturn br=new BookReturn();
br.setDefaultCloseOperation(EXIT_ON_CLOSE);
}*/
}

Update.java
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.sql.*;
import java.lang.String;
public class Update extends JFrame implements ActionListener,
FocusListener
{
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
JTextField t1,t2,t3,t4,t5,t6,t7,t8;
JLabel l1,l2,l3,l4,l5,l6,l7,l8;
JButton b1,b2;
Panel p=new Panel();
Panel p1=new Panel();
Panel p2=new Panel();
Container conn;
ImageIcon bimg;
Image icon=Toolkit.getDefaultToolkit().getImage("logo.gif");
public Update()
{
super("Update BookStock");
setIconImage(icon);
conn=getContentPane();
conn.setLayout(null);
conn.setBackground(new Color(102,204,255));
ImageIcon bimg=new ImageIcon("back.gif","Button image");
b2=new JButton(bimg);
p.setLayout(null);
p.setBackground(new Color(102,204,255));
p.setBounds(80,40,280,260);
p1.setLayout(null);
p1.setBackground(new Color(102,204,255));
p1.setBounds(80,300,280,40);
p2.setLayout(null);
p2.setBackground(new Color(51,102,153));
p2.setBounds(30,10,45,45);
b2.setBounds(0,0,45,45);
setLocation(200,300);
setSize(450,400);
l1=new JLabel("ISBNNo.");
l1.setForeground(Color.magenta);
t1=new JTextField(20);
l2=new JLabel("Book Title");
l2.setForeground(Color.magenta);
t2=new JTextField(20);
l3=new JLabel("Author");
l3.setForeground(Color.magenta);
t3=new JTextField(20);
l4=new JLabel("Year");
l4.setForeground(Color.magenta);
t4=new JTextField(20);
l5=new JLabel("Quantity");
l5.setForeground(Color.magenta);
t5=new JTextField(20);
l6=new JLabel("Book Left");
l6.setForeground(Color.magenta);
t6=new JTextField(20);
l7=new JLabel("Remarks");
l7.setForeground(Color.magenta);
t7=new JTextField(20);
b1=new JButton("Updated");
b1.setForeground(Color.blue);
l1.setBounds(10,10,100,22);
l2.setBounds(10,40,100,22);
l3.setBounds(10,70,100,22);
l4.setBounds(10,100,100,22);
l5.setBounds(10,130,100,22);
l6.setBounds(10,160,100,22);
l7.setBounds(10,190,100,22);
t1.setBounds(120,10,160,20);
t2.setBounds(120,40,160,20);
t3.setBounds(120,70,160,20);
t4.setBounds(120,100,160,20);
t5.setBounds(120,130,160,20);
t6.setBounds(120,160,160,20);
t7.setBounds(120,190,160,20);
b1.setBounds(80,10,100,22);
conn.add(p);
conn.add(p1);
conn.add(p2);
p2.add(b2);
p.add(l1);
p.add(l2);
p.add(l3);
p.add(l4);
p.add(l5);
p.add(l6);
p.add(l7);
p.add(t1);
p.add(t2);
p.add(t3);
p.add(t4);
p.add(t5);
p.add(t6);
p.add(t7);
p1.add(b1);
b1.addActionListener(this);
b2.addActionListener(this);
t1.addFocusListener(this);
t5.addFocusListener(this);
b1.setMnemonic('U');
try
{
con=ConnectionOption.Connect();
stmt=con.createStatement();
}
catch(Exception e)
{
System.out.println("Error in connection");
}
show();
t2.setEditable(false);
t3.setEditable(false);
t4.setEditable(false);
t6.setEditable(false);
t7.setEditable(false);
}
public void focusGained(FocusEvent e)
{
if(e.getSource().equals(t1))
{
if(t1.getText().length()>=0)
{ }
}
if(e.getSource().equals(t5))
{
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select * from
bookdetails");
boolean b1=false;
while(rs.next() && b1==false)
{
if(t1.getText().equals(rs.getString(1)))
{
int acc=rs.getInt(1);
String title=rs.getString(2);
String author=rs.getString(3);
String year=rs.getString(4);
String quan=rs.getString(5);
int quant=rs.getInt(5);
String issue=rs.getString(6);
int issued=rs.getInt(6);
String book=rs.getString(7);
int bookl=quant - issued;
String remark=rs.getString(8);

t2.setText(""+title);
t3.setText(""+author);
t4.setText(""+year);
t5.setText(""+quant);
t6.setText(""+bookl);
t7.setText(""+remark);

}
}
}
catch(Exception ex)
{
System.out.println("Error in connection");
}
}
}
public void focusLost(FocusEvent e)
{
if(e.getSource().equals(t1))
{
t5.requestFocus();
}
}
public void actionPerformed(ActionEvent evt)
{
if(evt.getSource().equals(b1))
{
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select * from
bookdetails");
boolean b1=false;
while(rs.next() && b1==false)
{
if(t1.getText().equals(rs.getString(1)))
{
int acc=rs.getInt(1);
int a=Integer.parseInt(t5.getText());

String sql="update bookdetails set
quantity=(" + a + ") where accountnumber=('" + rs.getString(1) + "')";
int status=stmt.executeUpdate(sql);
if(status>0)
{

JOptionPane.showMessageDialog(null,"one item updated");
}
else
{

JOptionPane.showMessageDialog(null,"sorry record can't be
updated");
}
}
}
}
catch(Exception e)
{
System.out.println("Error in Updation" );
}
setVisible(false);
new AdminLogin();
}
if(evt.getSource().equals(b2))
{
setVisible(false);
new AdminLogin();
}
}
/*public static void main(String args[])
{
Update ud=new Update();
ud.setDefaultCloseOperation(EXIT_ON_CLOSE);
}*/
}

Delete.java
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.sql.*;
import java.lang.String;
public class Delete extends JFrame implements ActionListener,
FocusListener
{
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
JTextField t1,t2,t3,t4,t5,t6,t7;
JLabel l1,l2,l3,l4,l5,l6,l7;
JButton b1,b2;
Panel p=new Panel();
Panel p1=new Panel();
Panel p2=new Panel();
Container conn;
ImageIcon bimg;
Image icon=Toolkit.getDefaultToolkit().getImage("logo.gif");
public Delete()
{
super("Delete Books");
setIconImage(icon);
conn=getContentPane();
conn.setLayout(null);
conn.setBackground(new Color(102,204,255));
ImageIcon bimg=new ImageIcon("back.gif","Button image");
b2=new JButton(bimg);
p.setLayout(null);
p.setBackground(new Color(102,204,255));
p.setBounds(80,40,280,260);
p1.setLayout(null);
p1.setBackground(new Color(102,204,255));
p1.setBounds(80,300,280,40);
p2.setLayout(null);
p2.setBackground(new Color(51,102,153));
p2.setBounds(30,10,45,45);
b2.setBounds(0,0,45,45);
setLocation(200,300);
setSize(450,400);
l1=new JLabel("ISBNNo.");
l1.setForeground(Color.magenta);
t1=new JTextField(20);
l2=new JLabel("BookTitle");
l2.setForeground(Color.magenta);
t2=new JTextField(20);
l3=new JLabel("Author");
l3.setForeground(Color.magenta);
t3=new JTextField(20);
l4=new JLabel("Year");
l4.setForeground(Color.magenta);
t4=new JTextField(20);
l5=new JLabel("Quantity");
l5.setForeground(Color.magenta);
t5=new JTextField(20);
l6=new JLabel("Remarks");
l6.setForeground(Color.magenta);
t6=new JTextField(20);
b1=new JButton("Item Deleted");
b1.setForeground(Color.blue);
l1.setBounds(10,10,100,22);
l2.setBounds(10,40,100,22);
l3.setBounds(10,70,100,22);
l4.setBounds(10,100,100,22);
l5.setBounds(10,130,100,22);
l6.setBounds(10,160,100,22);
t1.setBounds(120,10,160,20);
t2.setBounds(120,40,160,20);
t3.setBounds(120,70,160,20);
t4.setBounds(120,100,160,20);
t5.setBounds(120,130,160,20);
t6.setBounds(120,160,160,20);
b1.setBounds(80,10,120,22);
conn.add(p);
conn.add(p1);
conn.add(p2);
p2.add(b2);
p.add(l1);
p.add(l2);
p.add(l3);
p.add(l4);
p.add(l5);
p.add(l6);
p.add(t1);
p.add(t2);
p.add(t3);
p.add(t4);
p.add(t5);
p.add(t6);
p1.add(b1);
b1.addActionListener(this);
b2.addActionListener(this);
t1.addFocusListener(this);
t5.addFocusListener(this);
b1.setMnemonic('D');
try
{
con=ConnectionOption.Connect();
stmt=con.createStatement();
}
catch(Exception e)
{
System.out.println("Error in connection");
}
show();
t2.setEditable(false);
t3.setEditable(false);
t4.setEditable(false);
t5.setEditable(false);
t6.setEditable(false);
}
public void focusGained(FocusEvent e)
{
if(e.getSource().equals(t1))
{
if(t1.getText().length()>=0)
{ }
}
if(e.getSource().equals(t5))
{
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select * from
bookdetails");
boolean b1=false;
while(rs.next() && b1==false)
{
if(t1.getText().equals(rs.getString(1)))
{
int acc=rs.getInt(1);
System.out.println(""+acc);
String title=rs.getString(2);
String author=rs.getString(3);
String year=rs.getString(4);
String quan=rs.getString(5);
String remark=rs.getString(8);

t2.setText(""+title);
t3.setText(""+author);
t4.setText(""+year);
t5.setText(""+quan);
t6.setText(""+remark);
}
}
}
catch(Exception ex)
{
System.out.println("Error in connection");
}
}
}
public void focusLost(FocusEvent e)
{
if(e.getSource().equals(t1))
{
}
}
public void actionPerformed(ActionEvent evt)
{
if(evt.getSource().equals(b1))
{
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select * from
bookdetails");
boolean b1=false;
while(rs.next() && b1==false)
{
if(t1.getText().equals(rs.getString(1)))
{
String sql="delete from bookdetails where
accountnumber=('" + rs.getString(1) + "')" ;
int status=stmt.executeUpdate(sql);
if(status>0)
{

JOptionPane.showMessageDialog(null,"one item deleted");
}
else
{

JOptionPane.showMessageDialog(null,"sorry record can't be
deleted");
}
setVisible(false);
new AdminLogin();
}
}
}
catch(Exception e)
{
System.out.println("Error in Deletion" );
}
}
if(evt.getSource().equals(b2))
{
setVisible(false);
new AdminLogin();
}
}
/*public static void main(String args[])
{
Delete dl=new Delete();
dl.setDefaultCloseOperation(EXIT_ON_CLOSE);
}*/
}

R Re ep po or rt t. .j ja av va a
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.io.*;
import java.sql.*;
import java.lang.String;
public class Report extends JFrame implements ActionListener,ItemListener
{
Connection con=null;
Statement stmt=null;
ResultSet rs=null;
JLabel l1=new JLabel("Details of Member");
JComboBox cb=new JComboBox();
JLabel l2=new JLabel("Enter MemberId");
JLabel l3=new JLabel("Enter MemberName");
JLabel sl1=new JLabel("MemberId");
JLabel sl2=new JLabel("Name");
JLabel sl3=new JLabel("Address");
JLabel sl4=new JLabel("PhoneNo.");
JLabel sl5=new JLabel("EmailId");
JLabel sl6=new JLabel("BookIssued");
JLabel sl7=new JLabel("BookId");
JButton b2=new JButton("Show");
JButton b3=new JButton("Show");
JTextField t1=new JTextField(40);
JTextField t2=new JTextField(40);
JTextField st1=new JTextField(40);
JTextField st2=new JTextField(40);
JTextField st3=new JTextField(40);
JTextField st4=new JTextField(40);
JTextField st5=new JTextField(40);
JTextField st6=new JTextField(40);
JTextField st7=new JTextField(40);
JButton b1;
JPanel p1,p2,p3,p5,p6;
Container conn;
ImageIcon bimg;
Image icon=Toolkit.getDefaultToolkit().getImage("logo.gif");
public Report()
{
super("Report");
setIconImage(icon);
conn=getContentPane();
conn.setLayout(null);
conn.setBackground(new Color(102,204,255));
ImageIcon bimg=new ImageIcon("back.gif","Button image");
b1=new JButton(bimg);
setVisible(true);
setLocation(200,300);
setSize(500,500);
p1=new JPanel();
p1.setLayout(null);
p1.setBackground(new Color(102,204,255));
p1.setBounds(80,70,350,50);
p2=new JPanel();
p2.setLayout(null);
p2.setBackground(new Color(102,204,255));
p2.setBounds(80,130,350,80);
p3=new JPanel();
p3.setLayout(null);
p3.setBackground(new Color(102,204,255));
p3.setBounds(80,130,350,80);
p6=new JPanel();
p6.setLayout(null);
p6.setBackground(new Color(102,204,255));
p6.setBounds(100,220,350,220);
p5=new JPanel();
p5.setLayout(null);
p5.setBackground(new Color(51,102,153));
p5.setBounds(30,10,45,45);
b1.setBounds(0,0,45,45);
conn.add(p1);
p1.add(l1);
p1.add(cb);
conn.add(p2);
conn.add(p3);
conn.add(p5);
conn.add(p6);
p2.add(l2);
p2.add(t1);
p2.add(b2);
p3.add(l3);
p3.add(t2);
p3.add(b3);
p5.add(b1);
l1.setForeground(Color.magenta);
l2.setForeground(Color.magenta);
l3.setForeground(Color.magenta);
b2.setForeground(Color.blue);
b3.setForeground(Color.blue);
cb.setForeground(Color.blue);
l1.setBounds(10,10,120,30);
cb.setBounds(160,10,150,25);
l2.setBounds(10,10,120,30);
t1.setBounds(160,10,150,25);
b2.setBounds(110,50,100,25);
l3.setBounds(10,10,120,30);
t2.setBounds(160,10,150,25);
b3.setBounds(110,50,100,25);
sl1.setForeground(Color.magenta);
sl2.setForeground(Color.magenta);
sl3.setForeground(Color.magenta);
sl4.setForeground(Color.magenta);
sl5.setForeground(Color.magenta);
sl6.setForeground(Color.magenta);
sl7.setForeground(Color.magenta);
sl1.setBounds(10,10,100,22);
sl2.setBounds(10,40,100,22);
sl3.setBounds(10,70,100,22);
sl4.setBounds(10,100,100,22);
sl5.setBounds(10,130,100,22);
sl6.setBounds(10,160,100,22);
sl7.setBounds(10,190,100,22);
st1.setBounds(120,10,160,20);
st2.setBounds(120,40,160,20);
st3.setBounds(120,70,160,20);
st4.setBounds(120,100,160,20);
st5.setBounds(120,130,160,20);
st6.setBounds(120,160,160,20);
st7.setBounds(120,190,160,20);
p6.add(sl1);
p6.add(sl2);
p6.add(sl3);
p6.add(sl4);
p6.add(sl5);
p6.add(sl6);
p6.add(sl7);
p6.add(st1);
p6.add(st2);
p6.add(st3);
p6.add(st4);
p6.add(st5);
p6.add(st6);
p6.add(st7);
cb.addItem("Show Details");
cb.addItem("MemberId");
cb.addItem("MemberName");
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
cb.addItemListener(this);
p2.setVisible(false);
p3.setVisible(false);
p6.setVisible(false);
try
{
con=ConnectionOption.Connect();
stmt=con.createStatement();
}
catch(Exception e)
{
System.out.println("Error in connection");
}
st1.setEditable(false);
st2.setEditable(false);
st3.setEditable(false);
st4.setEditable(false);
st5.setEditable(false);
st6.setEditable(false);
st7.setEditable(false);
b2.setMnemonic('S');
b3.setMnemonic('S');
show();
}
public void actionPerformed(ActionEvent evt)
{
if(evt.getSource().equals(b1))
{
setVisible(false);
new AdminLogin();
}
if(evt.getSource().equals(b2))
{
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select * from
memberdetails");
boolean b1=false;
while(rs.next() && b1==false)
{
if(t1.getText().equals(rs.getString(1)))
{
int acc=rs.getInt(1);
String name=rs.getString(3);
String add=rs.getString(4);
String phone=rs.getString(5);
String email=rs.getString(6);
String book=rs.getString(9);
String id=rs.getString(10);


p6.setVisible(true);
st1.setText(""+acc);
st2.setText(""+name);
st3.setText(""+add);
st4.setText(""+phone);
st5.setText(""+email);
st6.setText(""+book);
st7.setText(""+id);
}
}
}
catch(Exception ex)
{
System.out.println("Error in connection");
}
}
if(evt.getSource().equals(b3))
{
try
{
con=ConnectionOption.Connect();

stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,R
esultSet.CONCUR_UPDATABLE);
rs=stmt.executeQuery("select * from
memberdetails");
boolean b1=false;
while(rs.next() && b1==false)
{
if(t2.getText().equals(rs.getString(3)))
{
int acc=rs.getInt(1);
String name=rs.getString(3);
String add=rs.getString(4);
String phone=rs.getString(5);
String email=rs.getString(6);
String book=rs.getString(9);
String id=rs.getString(10);
p6.setVisible(true);
st1.setText(""+acc);
st2.setText(""+name);
st3.setText(""+add);
st4.setText(""+phone);
st5.setText(""+email);
st6.setText(""+book);
st7.setText(""+id);
}
}
}
catch(Exception ex)
{
System.out.println("Error in connection");
}
}
}
public void itemStateChanged(ItemEvent ev)
{
if(ev.getSource().equals(cb))
{
if(cb.getSelectedIndex()==0)
{
p2.setVisible(false);
p3.setVisible(false);
p6.setVisible(false);
}
if(cb.getSelectedIndex()==1)
{
p2.setVisible(true);
p3.setVisible(false);
p6.setVisible(false);
}
if(cb.getSelectedIndex()==2)
{
p3.setVisible(true);
p2.setVisible(false);
p6.setVisible(false);
}
}
}
/*public static void main(String args[])
{
Report r=new Report();
r.setDefaultCloseOperation(EXIT_ON_CLOSE);
}*/
}






Testing is one of the most important phases of software development.
Testing is a process of executing program with the intent of finding an error.
Testing is the process of making sure that the process perform the intended
tasks .
In this project title Library Management System, I take proper care in
Software Testability. Once the system is designed it should be tested for
validity .During system testing ,the system is used experimentally to ensure
that the software does not fail.,ie it will run according to its specification and
in the way users expect it to.
Testing is vital to the success of the system. The first step in testing is to
prepare a plan that tests all aspects of the system in a way that promotes its
credibility among potential users.



WHI TE BOX TESTI NG
BLACK BOX TESTING WHITE BOX TESTING
TYPES OF TESTING
TESTING PROCEDURES AND REPORTS
White Box Testing which is performed early in the testing process, is also
called glass-box testing. Using white box testing, the software engineer can
cases that guarantee that all the independent paths within the module have
been exercised at least once.
Exercise all logical decisions on their TRUE and FALSE sides. Exercise all
loops at their boundaries and within their operational bounds.
Exercise internal data structure to assure their validity.

BLACK BOX TESTI NG
Black Box Testing to be applied during later stage of testing. Black box
testing focuses on the functional requirement of the software. Black box
testing enables the software engineer to derive sets of input conditions that
will fully exercise the functional requirements of a program.
Black box testing enables to find error in the following categories :
1. Incorrect or missing functions.
2. Interface errors.
3. Errors in the data structure or external Database access.
4. Performance errors.
5. Initialization and termination errors.

By applying the Black Box Testing a set of test cases that satisfy the
following criteria.
Test cases that reduce, by a count that is greater then one, the number of
additional test case must be designed to achieve reasonable testing. Test case
that tell us something about the presence or absence of classes of errors.
Rather than associated only with the specific test at hand.

Test Plan: The test plan is an important, but often overlooked, product of
software design. A test plane prescribes various kinds of activities that will
be performed to demonstrate that the software product meets its
requirements.
Test plan specifies
1. The objective of testing : It achieves error-free operation under stated
conditions for the state period of time.
2. The test completion criteria: It helps to achieve a specified rate of error
exposure, and a specified percent of logical path coverage.
3. The system integration plan: It helps to specify strategy, schedule and
responsible individuals of test
4. Method to be used: It defines method of the test plan such as walkthroughs,
inspections, static analysis, dynamic tests, formal verification and the
particular test cases to be used.

Testing Level:
Three levels of testing were carried out in the each phase:
Unit testing : It tests a code function.
Integration function : It checks interdependency of different modules.
System Testing : It tests the applications functionality as was
specified in the detailed functionality detail.
The testing level situation is illustrated below:





Coding
&
Debugging
Unit Testing
Integration
Testing
System Testing


DATABASE DESIGN
The proposed system stores the information that is made as tables in Oracle
database. Each table contains records that can be described as a set of fields.
Each table contains key filed that establish relationship in the database. It
shows how the records are stored.
INTERFACE DESIGN
All system need data as input into a format suitable for the computers. The
basic concept is data goes through two stages before it becomes input for the
systems. First, it is captured form the external environment and then it is put
into a source document. Next, it is fed in to the computer during the data
entry session and is validated before converted to machine readable format.


DOCUMENTATION
MAIN WINDOW :
This is the main form through which we can logon to the administrator form
to carry out further data entry such as stock maintain, book issue, book
return, update books, delete books, book search and report. New member
can also assign from here only by clicking on the button new user and
access the facility given to user by login by their memberid given by default
as many members available and password entered by themselves when they
fill form for their membership. We can also get the history of the library by
clicking on the button About KhudaBakhsh.




ADMIN LOGIN FORM :
This is the form from which we can perform several work like by clicking
button bookstock we can enter new bookdetails in the database.
From booksearch we can search books from the database, from bookissue
and bookreturn we can issue and return books books to the members, from
update we can add quantity of books increased, from delete we can delete
books from the library and from report we can get the details of the no. of
books issued to which members.


U US SE ER R L LO OG GI IN N F FO OR RM M: :
This is the form which opens when any user is logged on. They can get
history about the Khuda Bakhsh by clicking button History of library and
can search books available in the library by clisking on button BookSearch
by any books ISBNNo., BookName and AuthorName wise.

HISTORY FORM :
This form gives the details about the Khuda Bakhsh Oriental Public
Library like founder its seminars and materials acquired.


BOOKSTOCK FORM:
This is the form through which administrator can enter new books in the
library and can feed their details and their quantity in the database so that
members can use that book if they require. It can be used only by
administrator not by users.


BOOKSEARCH FORM:
This is the form which can be used by administrator as well as users who got
membership of the library so that they can get information about books.
They can search books by their ISBNNo wise., BookName wise and
AuthorName wise and get books availability in the library and do their jobs
like administrator to issue books and users for study if membership then can
issue books from the library.
.
BOOKISSUE FORM:
This is the form which can be accessed by only administrator for issuing
books to the member of the library.



BOOKRETURN FORM:
This is the form which can be accessed by only administrator for returning
books to the library from the member.


UPDATEBOOK FORM:
This is the form which can be accessed by only administrator for updating
books in the library if particular book is increased(quantity).


DELETEBOOK FORM:
This is the form which can be accessed by only administrator for deleting
books from the library if any book is lost or not available in the library.


REPORTBOOK FORM:
This is the form which can be accessed by only administrator for getting the
information about the books which are issued and which member issued the
particular book and to get details about the membership status of the
members it is expired or in use.


MEMBERSHIP FORM:
This is the form through which any new person can assign in the library and
get the membership from the library by filling this form and can access the
facility provided to the members. But the library provides the validation of
one year from joining to the members if the member is expired then they
cannot access the facility provided by the library.








This Library Management software is best suited to manage a Library. It can
retain records for future references. This project has very much capacity to
retain records. It can be accessed or manipulated according to our needs. In
future one can retrieve the old records.
This software has many other hidden advantages over the other softwares.
Future applications of this software are limitless. This software can be used
at any organization dealing with book maintenance and subscription.

Following are the main future application of this software:
1. This software can be used as a basis to develop a full fledged Library
Information System.
2. In future one can retrieve the old records
3. This software can be used to generate reports for the Library Center.
4. The proposed software can be further upgraded to handle other operations if
introduced in future, in a Library Center.
5. This software can be further developed for saving records and generate
report of CDs /DVDs /cassettes /cards /magazines /pictures /newspapers
/album.

FUTURE SCOPE
CONCLUSION



The motive behind this project was to design an automated system
which provides a GUI for handling all the Library operations. This software
also generates a report as and when required.
When I was creating this application in java, then I expect to give the
best result using minimum computer resources such as memory and
hardware space in order to ensure that my application uses the minimum
resources. I started my process of optimization from the designing stage
itself and continue till the final development stage. I always kept in mind
this theory that A well designed application is the first step towards an
optimized application.
Meanwhile designing the project, there came many
types of complications, where I was not able to handle it but gradually I was
able to handle almost all the problems. Lastly, I have been successfully able
to finish this project on time and according to current requirement of the
KHUDA BAKHSH ORIENTAL PUBLIC LIBRARY, Ashok Rajpath,
Patna.








BIBLIOGRAPHY



Books Referred

The Complete Reference- Java2 H.Schildt
Java: How to Program Java 2 Dietel and Dietel
Java Foundation Classes M.T. Nelson
Java Examples in a Nutshell D. Hanagan
A Programmers Guide to Java Certification K.Mughal
System Analysis & Design Satish Jain


Websites visited
www.sunsystems.com
www.javadowloads.com
www.dev.java.net
www.java.sun.com
www.download.com

You might also like