7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 1/144
Graduation Project Thesis
LIBRARY MANAGEMENT SYSTEM
Supervisor: Mr.A.saahira Ahmad
College of Computer Science & Information Systems
Jazan University, Jazan
Kingdom of Saudi Arabia
1436 / 2015
Sahar Ahmad Rajhi 201130795
Omaima Ali Masmaly 201130259
Somaya Mohsin Alamir 201130701
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 2/144
Library Management System
1
PREFACE
This project of “LIBRARY MANAGEMENT SYSTEM” of gives us the complete
information about the library. We can enter the record of new books and retrieve the
details of books available in the library. We can issue the books to the students and
maintain their records and can also check how many books are issued and stock
available in the library.
Throughout the project the focus has been on presenting information and comments in
an easy and intelligible manner. The project is very useful for those who want to know
about Library Management System.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 3/144
Library Management System
2
ACKNOWLEDGEMENTS
The satisfaction that accompanies that the successful completion of any task would be
incomplete without the mention of people whose ceaseless cooperation made it
possible, whose constant guidance and encouragement crown all efforts with success.
We are grateful to our project guide Ms. A.Saahira Banu for the guidance, inspiration
and constructive suggestions that helpful us in the preparation of this project. We also
thank our colleagues who have helped in successful completion of the project.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 4/144
Library Management System
3
ABSTRACTToday most of the library is using either manual system for tracking the day to day
activity or they are using desktop, spread sheet like MS Excel application to manage
the day to day activity. In this proposed Library Management System it will run in
client server mode and user can check the book availability, they can search the books,
library staff can issue, receive book, and management can check the report. System will
store historical data. Management can anytime view the total book status, library card
status.
This project of “LIBRARY MANAGEMENT SYSTEM” of gives us the complete
information about the library. We can enter the record of new books and retrieve the
details of books available in the library. We can issue the books to the students and
maintain their records and can also check how many books are issued and stock
available in the library.
Keywords: library management, automation in library.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 5/144
Library Management System
4
TABLE OF CONTENTS
PREFACE……………………………………………………………………………………. 1
ACKNOWLEDGEMENTS………………………………………………………………… 2ABSTRACT………………………………………………………………………………… 3
TABLE OF CONTENTS……………………………………………………………............. 4
1.
INTRODUCTION……………………………………………………………………….. 6
1.1 Project Overview Statement:……………………………………………………. 6
1.2
Project Goals And Objectives:……………………………………………………. 6
1.3
project Scope and Features:……………………………………………………….. 7
1.4
Limitations and Constraints:……………………………………………………… 9
1.5 Assumptions:……………………………………………………………………… 9
2. LITERATURE REVIEW………………………………………………………………………………… 103.
FEASIBILITY STUDY………………………………………………………………………………….. 12
3.1
Purpose Of The Feasibility Study:……………………………………………………………… 123.2
Justification For The Proposed System:…………………………………………... 12
3.3
Economic Feasibility……………………………………………………………… 13
3.4 Technical Feasibility:……………………………………………………………… 13
3.5
esired System Functionality:………………………………………………………. 13
4.
ROJECT PLAN………………………………………………………………………….. 14
4.1 Work Breakdown Structure:………………………………………………………. 14
4.2
Activity And Task List:…………………………………………………………… 14
4.3 Gantt Charts:………………………………………………………………………. 15
5.
REQUIREMENT ANALYSIS………………………………………………………………………… 17
5.1 System Requirements Analysis:…………………………………………………... 17
5.2 Hardware Requirements Specification:…………………………………………… 19
5.3
Software Requirements Specification:…………………………………………….. 195.4 Other Requirements Specifications:………………………………………………. 19
6. SYSTEM DESIGN……………………………………………………………………… 21
6.1 Application Architecture Design:…………………………………………………. 21
Data Flow Diagram:……………………………………………………………….. 22
Context Level DFD:…………………………………………………………… 22
0 Level Data Flow Diagram:…………………………………………………. 22
1 Level Data Flow Diagram:………………………………………………… 23
Use Case Diagram……………………………………………………………….. 24
Use Case description:…………………………………………………………….. 25
Use Case Model: Manage Users……………………………………………… 27
Use Case Model: Manage Members………………………………………….. 29
Use Case Model: Issue Book …………………………………………………. 31
Use Case Model: Receive Book ……………………………………………... 33
6.2 Database Design:………………………………………………………………….. 34
Data Dictionary:…………………………………………………………………… 34
User table:………………………………………………………………………. 34
Book master table:………………………………………………………………. 34
Member master table……………………………………………………………. 35
Transaction table::………………………………………………………………. 35
Book category Table:…………………………………………………………… 35
Library ER Diagram:……………………………………………………………. 36
6.3 User Interface Design:……………………………………………………………. 37
Library Management System : Login ………………………………………….. 37Library Management System : Main Screen…………………………………... 37
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 6/144
Library Management System
5
Library Management System : User Master …………………………………… 37
Library Management System : Change Password……………………………... 38
Library Management System : Book Master …………………………………. 38
Library Management System : Search Book …………………………………... 38
Library Management System : Book Status …………………………………… 39
Library Management System : MemberMaster ………………………………... 39
Library Management System : Search Member ………………………………... 39
Library Management System : Issue Book …………………………………….. 40
Library Management System : Receive Book …………………………………. 40
Library Management System : Transaction Report ……………………………. 41
Library Management System : About ………………………………………….. 41
7.
REAL SCREEN SHOTS OF DATA ENTRY FORMS AND REPORTS……………… 42
8. CODING OF IMPORTANT FUNCTIONS AND PROCEDURES OF THE SOFTWARE:……. 49
9.
TEST CASES……………………………………………………………………………………… 138
CONCLUSION AND FUTURE ENHANCEMENT………………………………. 142
REFERENCES ……………………………………………………………………... 143
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 7/144
Library Management System
6
1. INTRODUCTION
“Library Management Software” is to handle the entire activity of a library. The
software keeps track of all the information about the books in the library, their completedetails and total number of books available in the Library. The user will find it easy in
this automated system rather than using the manual writing system.
In this chapter, we will explain the objectives, scope, limitations and constraints faced
by library management system.
1.1 Project Overview Statement:
Library Management System is an application refer to other library system and
it is suitable to use by small and medium size library. It is use by librarian andlibrary admin to manage the library using a computerized system. The system
was developed and designed to help librarian record every book transaction so
that the problem such as file missing or record missing will not happened again.
Throughout the project the focus has been on presenting information and
comments in an easy and intelligible manner. The project is very useful for
those who want to know about Library Management System.
Library management System is a very simple, flexible and user-friendly
Library Management software specially for INDIA, that takes care of all your
requirements relating to managing huge library. Library stores complete
records of the books, members, creates library card, mange transaction,
Computes late fine, search books and generate MIS reports.
It is a complete library solution make this complicated function look much
easier. The software is user-friendly, with user-definable preferences like Book
category and extensive and search facilities, huge library of periodical data to
analyze the trend of issue and receive of books.
1.2 Project Goals And Objectives:
The project aims and objectives that will be achieved after completion of the
system.
To eliminate the paper-work in library
To record every transaction in computerized system so that problem
such as record file missing won’t happen again
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 8/144
Library Management System
7
To design a user friendly graphical user interface which suit the users
To complete the system according to project schedule
To produce technical report that documents the phases, tasks and
deliverables in the project
1.3 project Scope and Features:
The Library Management System is designed & developed for a receipt and
issuance of books in the library along with the student’s details. The books
received in the library are entered in Books Entry form and the new student is
entered in the student entry form. When the student wants to get the desired
book the same is issued on the availability basis to the student. The issuance
and due date for the returning of the book is also entered into the Book Issueform under third menu Book Issue.
Any education institute can make use of it for providing information about
author, content of the available books. It can be used in offices and
modifications can be easily done according to requirements
From an end-user perspective, the Library Management System Project
consists of two functional elements: Master and Transaction Module.
Master and Security module
Master and security module includes user security management, login security,
book details, member master, library card, library transaction.
Login :Check the user by user name and password, All user needs to
enter user name and password to access the system, system check the
user name and password and give access the system resource only valid
user.
Main Screen : It display available options, menus and toolbars to the
logged user. System display option as per user rights. It also show the
name of user currently logged in.
Book: includes book master, search book and book status.
New Book : This form used to enter new book details, system generates
book id,. User enters book title, book author, publisher name, book
description, no of pages, book category.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 9/144
Library Management System
8
Display Book : It displays all books in grid, user can short the book by
book title, book author, category. User can also print all or selected
book details from this screen.
Book Status: to displays book issue and available. Modify Book :User can edit previously saved book details in this
screen.
Search Book: Library system needs powerful book search facilities to
find any book. System provides two types of search facilities one is
normal search facilities where user enter book title, author name,
category, keyword, system perform pattern search and display the result
in grid. New Member : This form used to create new library member, user
enter library member details. System generates member id.
Modify Member: In this screen system users modify existing member
details
Search Member: System provide powerful search facility to search
library member, user can search card by giving various search input like
member id, member name. System can search single for single search
condition or all condition. After search results will display in grid.
Change Password: Currently logged user can change his or her
password from this form, before system validate old password.
User Master: Administrator can creates new system users from this
form, Administrator enters new user name, password and selects user
type to create new user.
Transaction module:
Transaction module includes issuing, receiving book and transaction report.
Issuing Book : This form used to issue book to the member. In this
screen user selects book id, and member id, system display the book
and card history. If book is already issued it display message and details
of last issued details. Same way system display card history for the
member id, if book already available it shows the message. If book is
available and there is no book pending for received then book is issued
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 10/144
Library Management System
9
and system saves the details. System also has powerful search facility
to find the book and member id.
Receive Book: In this screen user enters the book issued transaction no,
system displays the transaction details and book received status. Useralso checks the book condition and enters the remark if needed.
Transaction Reports: In this report system user can generates book
issue and book received details for single member/all members, for
single book/ all books, for the selected date or all days. User can also
short the record by transaction no, type, book id, member id.
1.4 Limitations and Constraints:
The information of all the users must be stored in a database that isaccessible by Library System.
The users access the Online Library System from any computer that has
Internet browsing capabilities and an Internet connection.
The users must have their correct usernames and passwords to enter into
theLibrary System.
1.5
Assumptions:
The users have sufficient knowledge of computers.
The users know the English language, as the user interface will be
provided in English.
Microsoft SQL server to store the database.
Netbans to develop the Product.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 11/144
Library Management System
10
2. Literature Review
Library is regarded as the brain of any institute; many institutes understand the
importance of the library to the growth of the institute and their esteem users (students).
Library Management System (LMS) supports the general requirement of the library
like acquisition, cataloguing, circulation. An LMS usually comprises a relational
database, software to interact with that database, and two graphical user interfaces (one
for patrons, one for staff). Most LMSes separate software functions into discrete
programs called modules, each of them integrated with a unified interface. Prior to
computerization, library tasks were performed manually and independently from one
another. Selectors ordered materials with ordering slips, cataloguers manually
catalogued items and indexed them with the card catalog system (in which all
bibliographic data was kept on a single index card), and users signed books out
manually, indicating their name on cue cards which were then kept at the circulation
desk. Early mechanization came in 1936, when the University of Texas began using a
punch card system to manage library circulation. While the punch card system allowed
for more efficient tracking of loans, library services were far from being integrated, and
no other library task was affected by this change.
By the mid to late 2000s, LMS vendors had increased not only then umber of services
offered but also their prices, leading to some dissatisfaction among many smaller
libraries. At the same time, open source ILS was in its early stages of testing. Some
libraries began turning to such open source ILSs as Kohaand Evergreen. Common
reasons noted were to avoid vendor lock in, avoid license fees, and participate in
software development. Freedom from vendors also allowed libraries to prioritize needs
according to urgency, as opposed to what their vendor can offer. Libraries which have
moved to open source ILS have found that vendors are now more likely to provide
quality service in order to continue a partnership since they no longer have the power
of owning the ILS software and tying down libraries to strict contracts. This has been
the case with the SC LENDS consortium. Following the success of Evergreen for the
Georgia PINES library consortium, the South Carolina State Library along with some
local public libraries formed the SCLENDS consortium in order to share resources and
to take advantage of the open source nature of the Evergreen ILS to meet their specific
needs. By October 2011, just 2 years after SC LENDS began operations, 13 publiclibrary systems across 15 counties had already joined the consortium, in addition to the
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 12/144
Library Management System
11
South Caroline State Library. Librarytechnology.org does an annual survey of over
1,500 libraries and noted in 2008, 2% of those surveyed used open source ILS, in 2009
the number increased to 8% and in 2010(most recent year available) 12% of the libraries
polled had adopted open source LMSs.Library project system that offers many flexible and convenient features, allowing
librarians and library users to maximize time and efficiency. Library System gives the
all detailed information about students, staffs and books. It will track on the how many
books available in library and books issued to the students. It shows popular book
among the students. It will provide book lost in library. It keeps the record of the
suppliers and book binders. It generates MIS reports for management. Our software is
customizable for any library requirement.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 13/144
Library Management System
12
3. FEASIBILITY STUDY
3.1 Purpose Of The Feasibility Study:
The feasibility study proposes one or more conceptual solution to the problem set ofthe project. In fact, it is an evaluation of whether it is worthwhile to proceed with projector not.
Evaluation of feasibility of such solutions. Such evaluation often
indicates shortcomings in the initial goals. This step is repeated as the
goals are adjusted and the alternative solutions are evaluated.
Feasibility analysis usually considers a number of project alternatives, one that is
chosen as the most satisfactory solution. These alternatives also need to be evaluated in
a broad way without committing too many resources. Various steps involved in
feasibility analysis are:
To propose a set of solution that can realize the project goal. These
solutions are usually descriptions of what the new system should look
like.
3.2 Justification For The Proposed System:
Justification means convincing stakeholders that a certain development makes sense
and that it should be supported. The main justification for the transition towards digital
libraries is that it is inevitable. The entire information scene is moving towards digital,
networked distribution of information. Libraries cannot lag behind or they will be at
risk of extinction.
Is this sufficient justification, however? Certainly not, for it could be argued that in the
networked world of the digital information society there is no need any more for
libraries. More thorough justification is required, and this should be directed towards
the various stakeholders of the library:
For the user of the library, the library system should provide clearly
enhanced services, improving the availability of useful information, the
speed of access and delivery, the usability of information, etc.
For the funders of libraries, the benefits of digital libraries should be
expressed in terms of more effective use of available (financial)
resources.
The final stakeholder is the library itself, or more specifically: the library
staff. Without commitment and involvement of library staff, the move
towards the digital library cannot be successful. Justification in this
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 14/144
Library Management System
13
respect means convincing library staff that the outcome will be a more
stimulating, professional environment in which to work.
Justification of library projects should therefore concentrate on these three aspects:
enhancement of service to the user and added value to the organisation, more efficientuse of funds, and the continuation of a challenging and professional working
environment for library staff. Proposals for library projects should outline their benefits
in terms of these aspects.
3.3 Economic Feasibility
Economic Feasibility an evaluation of development cost weighed against the ultimateincome of benefit derived from the development system of product. In economic
feasibility, cost benefit analysis is done in which expected cost and benefits areevaluated.
3.4 Technical Feasibility:
Technical Feasibility includes existing and new H/W and S/W requirements that arerequired to operate the project using Netbeans. The basic S/W requirement is java in
which the front end of the library management project has been done. The basic entry
forms are developed in Netbeans and the data is stored in the MY SQL.
3.5 Desired System Functionality:
The Library System provides online real time information about the books available in
the Library and the user information. The functions of the system include the system providing different type of services based on the type of users [Member/Librarian].
The member should be provided with the updated information about the
books catalog.
Provisions for the members to borrow the books they want, if all the other
required rules hold good.
The member is given a provision to check his account information and
change the account information any time in the given valid period.
The members are provided with the books available roster and allowed to
choose the books, which they want to use in the coming up days.
The librarian can get the information about the members who have borrowed
or returned the books.
The librarian is provided with interfaces to add/edit the books available in
the book catalog.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 15/144
Library Management System
14
4. ROJECT PLAN
Scheduling of a project can be correlated to prioritizing various jobs with
respect to their cost, time and duration. Scheduling can be done with resource
constraint or time constraint in mind.
4.1 Work Breakdown Structure:
4.2 Activity And Task List:
Requirement Analysis
Problem Definition
Requirement specification S/w and h/w requirement
Planning and scheduling
Design
Data Design
Modular
Coding
Testing
Unit testing
System testing
Integration testing
Testing
Coding
Design
Requirement AnalysisMaintenance
Problem
Definition
Requirement
specification
S/w and h/w
requirement
Planning
and
schedulingData Design Modular
Unit
testing
Integration testing
System testing
Library Management System
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 16/144
Library Management System
15
4.3 Gantt Charts:
PHASE TIME REQUIRED(IN weeks)
WK1 WK2 WK3 WK4 WK5 WK6
requirement
Gathering
requirement
analysis
design
coding
testing
implementation
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 17/144
Library Management System
16
Gantt Charts with Details :
Implementation
13 Mar –20Mar
Wk6
Req.Gathering
1 Feb – 08 Feb 0
Wk 1
Design
15 Feb-25 Feb
Wk3+4days
Testing
03 Mar –13Mar
Wk5+4days
Coding
25 Feb – 03 Mar
Wk 4
Analysis
08 Feb-15 Feb
Wk2
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 18/144
Library Management System
17
5. REQUIREMENT ANALYSIS
In this chapter, we will discuss and analyses about the developing process of Library
Management System including Software Requirement Specification (SRS).
5.1 System Requirements Analysis:
General Description
Product DescriptionLibrary Management System is a computerized system which can helps user
(librarian) to manage the library daily activity in electronic format. It reduces
the risk of paper work such as file lost, file damaged and time-consuming. It
can help user to manage the transaction or record more effectively and time-
saving.
Problem Statement
The problem occurred before having computerized system includes:
File lost :
When no computerizes system is implemented, the file always lost
because of human and environment. Sometimes librarian didn’t keep
the record to its original place because of a lot member queue up to
borrow books. After that the file was missing due to messy
environment.
Difficult to search record :
Without computerized system, when member wants to borrow a book,
librarian hard to search for the member’s record. It will cause time-consuming when a lot member are waiting to borrow the books.
Cost consuming:
Paper is needed to add every new record. After a long period of time,
the cost to buy a paper can be high. On the other hand, library needs to
employ more staff to solve the long queue problem. If the library only
has one staff, it is not enough time to process the book transaction.
System objectives
Improvement in control and performanceThe system was developed to overcome the current problem occurred
in library. The system must be able to validate the user, store the record
and bug free.
Save cost
After implementing the computerized library system, library can only
hire 1 or 2 staff to handle the book transaction process. With the aids of
computerized system, library can save the cost of hire employee and
also save the paper-cost.
Save time
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 19/144
Library Management System
18
Librarian is able to search the record in short time by pressing only few
keys. Compare to previous time before implementing the system,
librarian can save a lot time.
System Requirements:
The following sections summarize features and functionality described by use case.
Please see bellow Library Management System – Requirements
Manage Members
Must be able to analyze member data
Must be able to sort member
Must be able to sort member by transactions
Must be able to identify members transaction
Must be able to store employee photo and academic, personal details
Must be able to view history of the member data, must maintain audit trail.
Manage Library Card
Must be able to create new library card.
Must be able to view and edit library card details
Must be able to print the library card details.
Must be able to view the card transaction.
Manage Books
Must be able to maintain book master information.
Must be able to mange publisher details
Must be able to edit book details, includes no of pages, book author name, title,category, keywords, book publishing details
Must be able to maintain book register
Must able to search book by title, author, keywords
Must able to view book issue and received history
Library Transaction
Must able to issue books after validate the card and book id
Must able to enter receive books.
Must be able to calculate late fees as per late fine charge.
Must able to enter remarks while entering book receive details.
Must able to view all library transaction, by selected book id, library card and selecteddate range.
Must able to print, save library transaction.
Network Management
Must be able to monitor the network centrally
Must be able to monitor servers centrally
Must be able to monitor application server software centrally
Must be able to monitor databases centrally
CEO Requirements
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 20/144
Library Management System
19
To support any number of member’s volume (Looks more like a business goal than a
definable requirement.)
Providing a no single point failure application (Looks more like a business goal than a
definable requirement.)
Reduce our costs by lowering process time (Looks more like a business goal than adefinable requirement.)
5.2 Hardware Requirements Specification:
Processor: 733 MHz Pentium III
RAM: 128 MB
Hard Disk: 10GB
Monitor: 14” VGA COLOR
Keyboard: 104 Keys
Floppy Drive: 1.44 MB Mouse: Logitech Serial Mouse
Disk Space: 1 GB
5.3 Software Requirements Specification:
Platform: Java (JDK1.6)
Operating System: Microsoft Windows NT 4.0 or Windows 2000 or
XP
Front End: JSP & Servlets
Back End: MySql 5.1 Tools: Netbeans IDE 6.8, Sqlyog
5.4 Other Requirements Specifications:
Business Requirements
The business goal for the application is to support an increase the productivity and
complete automation of existing manual or semi automatic library management
process. Business requirements are discussed in the Scope section, with the following
additional detail:
Improve the search facility and system users should get all theinformation in a second.
System should have security features in built.
User must not delete any data, Administrator can only have the rights to
delete the data,
System Administrator must able to control the access rights by each user
as per requirement.
The application should support the capability to use multi user
environment.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 21/144
Library Management System
20
User Requirements
User requirements are categorized by user type.
System Users
Able to search and view the member details.
Able to find all the information like book details, book and library card
transaction details in one screen to give answer to member query.
Must able to change the his or her own password
Must able to generate reports.
Supervisor
Update book and member details.
Modify library card details if required.
Perform transaction and view transaction reports
Operational Requirements
The following requirements provide a high-level view of how the system will run:
Processor usage should not exceed 80 percent during concurrent uses.
Backups will occur incrementally throughout the day.
Ensure that information is easy to access either, and meaningful for the system
users and the company.
Minimize the technical knowledge that systems users need to access the data
generate ad hoc queries, search and view book, member and transaction
information.
The application should work with the existing communications and
networking infrastructure.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 22/144
Library Management System
21
6. SYSTEM DESIGN
6.1 Application Architecture Design:
The three tier architecture:
To develop software for Library management system the architecture that we areimplementing is Three Tier Architecture. The User Interface Layer, Application Logic
Layer and Data Storage Layer together called as Three Tier Architecture.
User Interface Layer
The User Interface Layer will consist of everything shown directly to the client. This
Layer will communicate only with the Application Logic Layer. This Layer will also
be responsible for initial validation of any user inputted data. Any validation that
requires communication to the Data Storage Layer will however be completed at the
Logic Layer.
Application Logic Layer
It will be responsible for providing a secure connection to the Data Storage Layer and
formatting information received from the SQL Server for presentation to the UserInterface Layer.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 23/144
Library Management System
22
Data Storage Layer
The Data Storage Layer will record all information required by the Logic and User
Interface Layer. This data will include Subject details for general user and admin user
information. Within the Data Storage Layer a collection of SQL Queries will provide
access to the data in a meaningful way.Data Flow Diagram :
Context Level DFD:
Context Flow Diagrams give us the complete details about the inputs and outputsfor a given system.
0 Level Data Flow Diagram
USER
librarysystem
Login
Accesses
View
Transcation
DBMS
Admin
Add User
details DBMS
DBMS
Adds
Members,
Books
Admin
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 24/144
Library Management System
23
Validate
Entry
Calculate
Late Fine
Receive Book
Validate
Entry
DBMS
Enter
Book ID ,
Member ID
Save
Transaction
Access table: bookmaster
MembermasterUSER
Issue Books
DBMS
Enter
Transaction
No
Generate
report
Access table: transaction, bookmaster,
membermaster
Employee
Save
Transaction
1 Level Data Flow Diagram
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 25/144
Library Management System
24
Use Case Diagram
Usage summary use case
User Profiles:
The following user types are expected for the Library Management System:
User Brief Description of Use Actions
User Minimum rights to the system, query the information
can add, edit some modules.
Supervisor Add / modify book, member and transaction details
generate all reports; however can not delete any
information.
SystemAdministrator
Create new system users, set and alter the role and privilege to the system users for accessing the system
resource. Can delete the member and book data. Alsoresponsible to database backup, backend
performance. And overall the system performance.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 26/144
Library Management System
25
Use Case description:
Manage User:
Description This function will enable administrator to add new user. Business Need This function will enable system users to interact with Library ManagementSystem catalog directly without the intervention of any other employees.
Priority High
Manage Members
Description This function allows user of Library Management System to create, maintain,
and delete information about employees in the database that can then be viewed by other system users.
Business Need This function will support the system users with accurate and relevant
information, and will also support the transaction and query function by ensuringup-to-date book information.
Priority High
Issue Book
Description
This function enables the user to issue book.Business Need
This function enables user of Library Management System to issue new book to
selected member.
PriorityMedium
Receive Book
DescriptionThis function enables the user to receive book.
Business Need
This function enables user of Library Management System to receive book frommember.
Priority
Medium
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 27/144
Library Management System
26
Use Case : Manage UsersTitle: Manage Users
Abbreviated Title: Manage Users
Requirement ID: 01
IntentManage the user information; modify the contact details of a user.
Scenario Narrative
Administrator may want to add details of a new user.
Assumptions/Preconditions
System users have access rights to add new user details.
Actors
Administrator
Basic Course
Use case begins when the actor decides to add new user information.
System opens the user master information. Actor navigates the required information from.
Actor press add button and enter the necessary information.
Actor press Save button to save the record in the user master catalog.
Use case ends when the selected information is passed to a method ofdelivery.
Alternate Course
If no appropriate user information, system reports this fact.
Use case restarts to enable users to update the type of userinformation.
Future Requirements
The system users may want to apply filters to the retrieved data. The system users may want to sort the data. For example, the system user want
to list the names of user in chronological order based on the entry date.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 28/144
Library Management System
27
Use Case Model: Manage Users
Administrator
Update
Master
Navigate Users
User Master Add Details
Apply
Validation
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 29/144
Library Management System
28
Use Case Manage Members
Title: Manage Members
Abbreviated Title: Manage Members
Requirement ID: 02
Intent
Enable actor to View, Add, Modify, Delete member information
Scenario Narrative
Actors want to View, Add, Modify, Delete member information
Assumptions/Preconditions
The actor has rights to access to the Library Management System, and having
rights to view, add, edit and delete the member details.
Actors
User
Supervisor
Administrator
Basic Course: Use case begins when actor decides to view, add, edit and delete the member
information.
The system displays summary information about the member.
Actor process member data as per his/ her rights.
Use case ends when information is presented to the correct method of delivery.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 30/144
Library Management System
29
Use Case Model: Manage Members
User
Administrator
Transaction
Delete
Member Data
View /
Navigate
Edit Member
Validation
Supervisor
Add Member
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 31/144
Library Management System
30
Use Case Issue Book
Title: Issue Book
Abbreviated Title: Issue Book
Requirement ID: 03
Intent
Enable actor to issue bookScenario Narrative
An actor wants to issue new book to selected member.
Assumptions/Preconditions
The actor has rights to access to the Library Management System, and having
rights to issue book.
Actor
Supervisor
Basic Course:
Use case begins when actor decides to issue book.
System checks the status of the book and library card. Systems displays actor the status of book and card, if it already issued,
system warns actor that fact.
Otherwise system updates the transaction.
System display message for confirmation.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 32/144
Library Management System
31
Use Case Model: Issue Book
Supervisor
Book Master
Select Book ID,
Member ID
Issue Book
Transaction
System Check
the status
Member
Master
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 33/144
Library Management System
32
Use Case Receive Book
Title: Receive Book
Abbreviated Title: Receive Book
Requirement ID: 03
Intent
Enable actor to receive book
Scenario Narrative
An actor wants to issue receive book from selected member.
Assumptions/Preconditions
The actor has rights to access to the Library Management System, and having
rights to receive book.
Actor
Supervisor
Basic Course:
Use case begins when actor decides to receive book. User enters the transaction number, or find the transaction number
System checks the status of the book and library card.
Systems displays actor the status of book and card, if it already received,
system warns actor that fact.
System calculates the late fine if applicable.
Actor update the remarks, if any fault found.
Otherwise system updates the transaction.
System display message for confirmation.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 34/144
Library Management System
33
Use Case Model: Receive Book
Member
Master
Supervisor
Book Master
Select
Transaction ID
Receive Book
Transaction
System Check
the status
Late Fine
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 35/144
Library Management System
34
6.2 Database Design:
The LMS implements MySql as the Backend and thus the database schema is
defined and modified through MySQL Query Browser. The LMS consists of five
tables to store all the information, and all the necessary information is extracted
from these tables through appropriate queries in Netbanse.
Data Dictionary:
1. User table:
Table name: Lib _user
Description: store the information of user who used the library system
rulesDefault valueNull/not nullData typeFields
--not nullVARCHAR(45)User _Name
--not nullVARCHAR(45)User
_Password
--not nullVARCHAR(45)User _Type
--not nullVARCHAR(45)User _Active
2. Book master table:
Table name: Lib _book _master
Description: store the information of books
rulesDefault valueNull/not nullData typeFields
- Nullnot nullINT(10)Book _id
- Null-VARCHAR(100)Book _title
--not nullVARCHAR(100)Book _author
--not nullVARCHAR(100)Book _publisher
--not nullVARCHAR(45)Book _publish _year
--not nullVARCHAR(100)Book _category
--not nullVARCHAR(250)Book _keyword
- Nullnot nullVARCHAR(45)Book _status
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 36/144
Library Management System
35
3. Member master table:
Table name: Lib _member _master
Description: store the information of member
rulesDefaultvalue
Null/notnull
Data typeFields
- Nullnot nullINT(10)Mem _id
Null-VARCHAR(100)Mem _name
- Null-VARCHAR(250)Mem _address
- Null-VARCHAR(100)Mem _email _id
- Null-VARCHAR(01)Mem _mobile _no
- Null-VARCHAR(1)Mem _active
4. Transaction table:
Table name: Lib _transaction
Description: Store for issuing and return books Details
rulesDefault
value
Null/not nullData typeFields
- Nullnot nullINT(10)Trn _id
-not nullINT(10)Trn _mem _id
--not nullINT(10)Trn _book _id--not nullDATETIMETrn _issue _dt
- Null-DATETIMETrn _receive _dt
5. Book category Table:
Table name: lib _book _category
Description: Classification of types of books
rulesDefault valueNull/not nullData typeFields
- - not nullVARCHAR(100)
Book _category
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 37/144
Library Management System
36
Library ER Diagram:
MEMBER MASTER
MEM_NAME
MEM_ADD
MEM_EMAIL
ISSUE BOOK_dtRECEIVE BOOK_dt
MEM_ID
Trn _id
Book master
AUTHOR
TITLE
PROVIDED
Transaction
USER
User _Password
ISSUE/
RECEIVE
PROVIDES
BOOK_ID
User _ NAME
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 38/144
Library Management System
37
6.3 User Interface Design:
Library Management System : Login
Library Management System : Main Screen
Library Management System : User Master
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 39/144
Library Management System
38
Library Management System : Change Password
Library Management System : Book Master
Library Management System : Search Book
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 40/144
Library Management System
39
Library Management System : Book Status
Library Management System : MemberMaster
Library Management System : Search Member
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 41/144
Library Management System
40
Library Management System : Issue Book
Library Management System : Receive Book
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 42/144
Library Management System
41
Library Management System : Transaction Report
Library Management System : About
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 43/144
Library Management System
42
7. REAL SCREEN SHOTS OF DATA ENTRY FORMS
AND REPORTS
Login Page:
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 44/144
Library Management System
43
Main Screen
User Master
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 45/144
Library Management System
44
Change Password
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 46/144
Library Management System
45
Book Master
Search Book
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 47/144
Library Management System
46
Book Status
Member Master
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 48/144
Library Management System
47
Search Member
Issue Book
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 49/144
Library Management System
48
Receive Book
Transaction Report
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 50/144
Library Management System
49
8. CODING OF IMPORTANT FUNCTIONS AND
PROCEDURES OF THE SOFTWARE:
1. Login page code :
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
public class Login extends javax.swing.JFrame {
/** Creates new form Login */
public Login() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
TxtUserName = new javax.swing.JTextField();
CmdOk = new javax.swing.JButton();
CmdClose = new javax.swing.JButton();
TxtPassword = new javax.swing.JPasswordField();
jLabel4 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Login to Library Mangement System");
setResizable(false);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);}
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 51/144
Library Management System
50
});
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText(" JAVA Library Managemnet System");
jLabel2.setText("User Name:");
jLabel3.setText("Password:");
CmdOk.setText("Ok");
CmdOk.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdOkActionPerformed(evt);
}
});
CmdClose.setText("Close");
CmdClose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdCloseActionPerformed(evt);
}
});
jLabel4.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\logan.jpg")); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new
javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.
LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(170, 170, 170)
.addComponent(jLabel2,
javax.swing.GroupLayout.PREFERRED_SIZE, 80,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 52/144
Library Management System
51
.addComponent(TxtUserName,
javax.swing.GroupLayout.PREFERRED_SIZE, 130,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(180, 180, 180)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.
LEADING)
.addComponent(jLabel3,
javax.swing.GroupLayout.PREFERRED_SIZE, 80,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(70, 70, 70)
.addComponent(TxtPassword,
javax.swing.GroupLayout.PREFERRED_SIZE, 130,
javax.swing.GroupLayout.PREFERRED_SIZE))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(220, 220, 220)
.addComponent(CmdOk)
.addGap(5, 5, 5)
.addComponent(CmdClose,
javax.swing.GroupLayout.PREFERRED_SIZE, 76,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup().addGap(60, 60, 60)
.addComponent(jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 321,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel4))
.addGap(14, 14, 14))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE,
30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.
LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE,
20, javax.swing.GroupLayout.PREFERRED_SIZE)
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 53/144
Library Management System
52
.addComponent(TxtUserName,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.
LEADING)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE,
20, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtPassword,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.
LEADING)
.addComponent(CmdOk)
.addComponent(CmdClose)))
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 180,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 392,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>
private void CmdCloseActionPerformed(java.awt.event.ActionEvent evt) {
// Close project
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 54/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 55/144
Library Management System
54
else
{
JOptionPane.showMessageDialog(null,"User name or password are not
correct.");
return;}
}
catch (Exception e)
{
System.err.println(e);
System.exit(1);
}
}
private void formWindowOpened(java.awt.event.WindowEvent evt) {
// TODO add your handling code here:
this.setLocationRelativeTo(null);
}
public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Login().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton CmdClose; private javax.swing.JButton CmdOk;
private javax.swing.JPasswordField TxtPassword;
private javax.swing.JTextField TxtUserName;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 56/144
Library Management System
55
2. Main Screen code :
public class MainForm extends javax.swing.JFrame {
/** Creates new form Main */
public MainForm() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
MnuExits = new javax.swing.JMenuItem();
jMenu6 = new javax.swing.JMenu();
jMenuItem7 = new javax.swing.JMenuItem();
jMenuItem8 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
MnuBookMaster = new javax.swing.JMenuItem();MnuSearchBook = new javax.swing.JMenuItem();
MnuBookStatus = new javax.swing.JMenuItem();
jMenu3 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
jMenu4 = new javax.swing.JMenu();
jMenuItem3 = new javax.swing.JMenuItem();
jMenuItem4 = new javax.swing.JMenuItem();
jMenuItem6 = new javax.swing.JMenuItem(); jMenu5 = new javax.swing.JMenu();
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 57/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 58/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 59/144
Library Management System
58
MnuExits.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\7.png")); //
NOI18N
MnuExits.setText("Exit");
MnuExits.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) {
MnuExitsActionPerformed(evt);
}
});
jMenu1.add(MnuExits);
jMenuBar1.add(jMenu1);
jMenu6.setBackground(new java.awt.Color(249, 60, 139));
jMenu6.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\2.png")); //
NOI18N
jMenu6.setText("Admin");
jMenuItem7.setBackground(new java.awt.Color(249, 60, 139));
jMenuItem7.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\8.png")); //
NOI18N
jMenuItem7.setText("User Master"); jMenuItem7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem7ActionPerformed(evt);
}
});
jMenu6.add(jMenuItem7);
jMenuItem8.setBackground(new java.awt.Color(249, 60, 139));
jMenuItem8.setIcon(new javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\9.png")); //
NOI18N
jMenuItem8.setText("Change Password");
jMenuItem8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem8ActionPerformed(evt);
}
});
jMenu6.add(jMenuItem8);
jMenuBar1.add(jMenu6);
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 60/144
Library Management System
59
jMenu2.setBackground(new java.awt.Color(249, 60, 139));
jMenu2.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\3.png")); //
NOI18N jMenu2.setText("Book Status");
MnuBookMaster.setBackground(new java.awt.Color(249, 60, 139));
MnuBookMaster.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\15.png")); //
NOI18N
MnuBookMaster.setText("Book Master");
MnuBookMaster.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt) {
MnuBookMasterActionPerformed(evt);
}
});
jMenu2.add(MnuBookMaster);
MnuSearchBook.setBackground(new java.awt.Color(249, 60, 139));
MnuSearchBook.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\14.png")); //
NOI18NMnuSearchBook.setText("Search Book");
MnuSearchBook.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt) {
MnuSearchBookActionPerformed(evt);
}
});
jMenu2.add(MnuSearchBook);
MnuBookStatus.setBackground(new java.awt.Color(249, 60, 139));
MnuBookStatus.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\18.png")); //
NOI18N
MnuBookStatus.setText("Book Status");
MnuBookStatus.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt) {
MnuBookStatusActionPerformed(evt);
}
});
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 61/144
Library Management System
60
jMenu2.add(MnuBookStatus);
jMenuBar1.add(jMenu2);
jMenu3.setBackground(new java.awt.Color(249, 60, 139)); jMenu3.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\4.png")); //
NOI18N
jMenu3.setText("Member");
jMenuItem1.setBackground(new java.awt.Color(249, 60, 139));
jMenuItem1.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\16.png")); //
NOI18N
jMenuItem1.setText("Member Master");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
jMenu3.add(jMenuItem1);
jMenuItem2.setBackground(new java.awt.Color(249, 60, 139));
jMenuItem2.setIcon(new javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\17.png")); //
NOI18N
jMenuItem2.setText("Search Mamber");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
jMenu3.add(jMenuItem2);
jMenuBar1.add(jMenu3);
jMenu4.setBackground(new java.awt.Color(249, 60, 139));
jMenu4.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\5.png")); //
NOI18N
jMenu4.setText("Transaction");
jMenu4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenu4ActionPerformed(evt);
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 62/144
Library Management System
61
}
});
jMenuItem3.setBackground(new java.awt.Color(249, 60, 139));
jMenuItem3.setIcon(new javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\11.png")); //
NOI18N
jMenuItem3.setText("Issue Book");
jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem3ActionPerformed(evt);
}
});
jMenu4.add(jMenuItem3);
jMenuItem4.setBackground(new java.awt.Color(249, 60, 139));
jMenuItem4.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\12.png")); //
NOI18N
jMenuItem4.setText("Receive Book");
jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem4ActionPerformed(evt);
}});
jMenu4.add(jMenuItem4);
jMenuItem6.setBackground(new java.awt.Color(249, 60, 139));
jMenuItem6.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\13.png")); //
NOI18N
jMenuItem6.setText("Transaction Report ");
jMenuItem6.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem6ActionPerformed(evt);
}
});
jMenu4.add(jMenuItem6);
jMenuBar1.add(jMenu4);
jMenu5.setBackground(new java.awt.Color(249, 60, 139));
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 63/144
Library Management System
62
jMenu5.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\6.png")); //
NOI18N
jMenu5.setText("Help");
jMenuItem5.setBackground(new java.awt.Color(249, 60, 139));
jMenuItem5.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\10.png")); //
NOI18N
jMenuItem5.setText("About");
jMenuItem5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem5ActionPerformed(evt);
}
});
jMenu5.add(jMenuItem5);
jMenuBar1.add(jMenu5);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 64/144
Library Management System
63
private void MnuExitsActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(1);
}
private void MnuBookMasterActionPerformed(java.awt.event.ActionEventevt) {
BookMaster b=new BookMaster();
b.setVisible(true);
}
private void formWindowOpened(java.awt.event.WindowEvent evt) {
this.setLocationRelativeTo(null);
}
private void MnuSearchBookActionPerformed(java.awt.event.ActionEvent
evt) {
SearchBook b=new SearchBook();
b.setVisible(true);
}
private void MnuBookStatusActionPerformed(java.awt.event.ActionEvent
evt) {BookStatus b=new BookStatus();
b.setVisible(true);
}
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt)
{
MemberMaster b=new MemberMaster();
b.setVisible(true);
}
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt)
{
SearchMember b=new SearchMember();
b.setVisible(true);
}
private void jMenuItem7ActionPerformed(java.awt.event.ActionEvent evt)
{
UserMaster b=new UserMaster();
b.setVisible(true);
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 65/144
Library Management System
64
}
private void jMenuItem8ActionPerformed(java.awt.event.ActionEvent evt)
{
ChangePassword b=new ChangePassword(); b.setVisible(true);
}
private void jMenuItem5ActionPerformed(java.awt.event.ActionEvent evt)
{
About b=new About();
b.setVisible(true);
}
private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt)
{
IssueBook b=new IssueBook();
b.setVisible(true);
}
private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt)
{
ReceiveBook b=new ReceiveBook();
b.setVisible(true);}
private void jMenu4ActionPerformed(java.awt.event.ActionEvent evt) {
}
private void jMenuItem6ActionPerformed(java.awt.event.ActionEvent evt)
{
TransactionReport b=new TransactionReport(); b.setVisible(true);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MainForm().setVisible(true);
}
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 66/144
Library Management System
65
});
}
// Variables declaration - do not modify
private javax.swing.JMenuItem MnuBookMaster; private javax.swing.JMenuItem MnuBookStatus;
private javax.swing.JMenuItem MnuExits;
private javax.swing.JMenuItem MnuSearchBook;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenu jMenu5;
private javax.swing.JMenu jMenu6;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JMenuItem jMenuItem4;
private javax.swing.JMenuItem jMenuItem5; private javax.swing.JMenuItem jMenuItem6;
private javax.swing.JMenuItem jMenuItem7;
private javax.swing.JMenuItem jMenuItem8;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}
3. User Master code:
import java.sql.Statement;import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
/**
*
* @author Administrator
*/
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 67/144
Library Management System
66
public class UserMaster extends javax.swing.JFrame {
MainClass mc=new MainClass();
ResultSet rsuser;
int rspos=0;
int rscount=0; boolean chadd=false;
/** Creates new form UserMaster */
public UserMaster() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
ChkUserActive = new javax.swing.JCheckBox();
CmbUserType = new javax.swing.JComboBox();
TxtPassword = new javax.swing.JTextField();
TxtUserName = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
LblPosition = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
CmdLast = new javax.swing.JButton();
CmdClose = new javax.swing.JButton();
CmdFirst = new javax.swing.JButton();
CmdPrevious = new javax.swing.JButton();CmdNext = new javax.swing.JButton();
CmdNew = new javax.swing.JButton();
CmdEdit = new javax.swing.JButton();
CmdSave = new javax.swing.JButton();
jLabel2 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CL
OSE);
setTitle(" User Master");
addWindowListener(new java.awt.event.WindowAdapter() {
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 68/144
Library Management System
67
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel1.setText("Library - User Master");
ChkUserActive.setText("Member Active");
CmbUserType.setModel(new javax.swing.DefaultComboBoxModel(new
String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
TxtPassword.setText("jTextField1");
TxtUserName.setText("jTextField1");
jLabel4.setText("Password :");
jLabel8.setText("User Type :");
jLabel3.setText("User Name :");
LblPosition.setText("position");
CmdLast.setText("Last");
CmdLast.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdLastActionPerformed(evt);
}
});
CmdClose.setText("Close");CmdClose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdCloseActionPerformed(evt);
}
});
CmdFirst.setText("Fisrt");
CmdFirst.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdFirstActionPerformed(evt);
}
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 69/144
Library Management System
68
});
CmdPrevious.setText("Previous");
CmdPrevious.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {CmdPreviousActionPerformed(evt);
}
});
CmdNext.setText("Next");
CmdNext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdNextActionPerformed(evt);
}
});
CmdNew.setText("New");
CmdNew.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdNewActionPerformed(evt);
}
});
CmdEdit.setText("Edit");CmdEdit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdEditActionPerformed(evt);
}
});
CmdSave.setText("Save");
CmdSave.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {CmdSaveActionPerformed(evt);
}
});
jLabel2.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\UserMaster.jpg")
); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new
javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 70/144
Library Management System
69
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEA
DING)
.addGroup(jPanel1Layout.createSequentialGroup().addGap(69, 69, 69)
.addComponent(CmdPrevious)
.addGap(67, 67, 67)
.addComponent(CmdLast)
.addGap(201, 201, 201)
.addComponent(CmdClose))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(284, 284, 284)
.addComponent(CmdNew))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(400, 400, 400)
.addComponent(CmdSave))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(343, 343, 343)
.addComponent(CmdEdit))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(CmdFirst))
.addGroup(jPanel1Layout.createSequentialGroup().addGap(148, 148, 148)
.addComponent(CmdNext))
.addComponent(jLabel2,
javax.swing.GroupLayout.PREFERRED_SIZE, 680,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(297, 297, 297)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alig
nment.LEADING)
.addComponent(CmdPrevious)
.addComponent(CmdLast)
.addComponent(CmdClose)
.addComponent(CmdNew)
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 71/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 72/144
Library Management System
71
.addGroup(layout.createSequentialGroup()
.addGap(50, 50, 50)
.addComponent(jLabel8,
javax.swing.GroupLayout.PREFERRED_SIZE, 80,
javax.swing.GroupLayout.PREFERRED_SIZE)).addComponent(jPanel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 677,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addComponent(jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(40, 40, 40)
.addComponent(jLabel3)
.addGap(56, 56, 56)
.addComponent(CmbUserType,
javax.swing.GroupLayout.PREFERRED_SIZE, 25,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(102, 102, 102)
.addComponent(LblPosition))
.addGroup(layout.createSequentialGroup()
.addGap(110, 110, 110)
.addComponent(TxtPassword,
javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(193, 193, 193)
.addComponent(ChkUserActive)).addGroup(layout.createSequentialGroup()
.addGap(110, 110, 110)
.addComponent(jLabel4))
.addGroup(layout.createSequentialGroup()
.addGap(80, 80, 80)
.addComponent(TxtUserName,
javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(150, 150, 150)
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 73/144
Library Management System
72
.addComponent(jLabel8,
javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jPanel1,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>
private void CmdFirstActionPerformed(java.awt.event.ActionEvent evt) {
try {
rsuser.first();
Display();
} catch (Exception e) {
System.err.println(e);
}
}
private void CmdPreviousActionPerformed(java.awt.event.ActionEvent evt){
try {
if (rsuser.isFirst()==true) {
JOptionPane.showMessageDialog(null,"Already in first record.");
return;
}
rsuser.previous();Display();
} catch (Exception e) {
System.err.println(e);
}
}
private void CmdNextActionPerformed(java.awt.event.ActionEvent evt) {
try {
if (rsuser.isLast()==true) {
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 74/144
Library Management System
73
JOptionPane.showMessageDialog(null,"Already in last record.");
return;
}
rsuser.next();Display();
} catch (Exception e) {
System.err.println(e);
}
}
private void CmdLastActionPerformed(java.awt.event.ActionEvent evt) {
try {
rsuser.last();
Display();
} catch (Exception e) {
System.err.println(e);
//System.exit(1);
}
}
private void CmdNewActionPerformed(java.awt.event.ActionEvent evt) {
chadd=true;
ClearText();
}
private void CmdEditActionPerformed(java.awt.event.ActionEvent evt) {
chadd=false;
}
private void CmdSaveActionPerformed(java.awt.event.ActionEvent evt) {
//validate entry and save record
try {
if (TxtUserName.getText().trim().length()==0 ) {
JOptionPane.showMessageDialog(null,"Enter user name.");
return;
}
if (TxtPassword.getText().trim().length()==0 ) {
JOptionPane.showMessageDialog(null,"Enter password.");
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 75/144
Library Management System
74
return;
}
//String strqr="";
Connection connection;
connection=DriverManager.getConnection(mc.StrUrl,mc.StrUid,mc.StrPwd);
if (chadd==true ) {
rsuser.moveToInsertRow();
rsuser.updateString("user_name",TxtUserName.getText());
rsuser.updateString("user_password",TxtPassword.getText());
rsuser.updateString("user_type",CmbUserType.getSelectedItem().toString());
if (ChkUserActive.isSelected()==true) {
rsuser.updateString("user_active","YES");
} else {rsuser.updateString("user_active","NO");
}
rsuser.insertRow();
rsuser.last();
Display();
} else {
rsuser.updateString("user_password",TxtPassword.getText());
rsuser.updateString("user_type",CmbUserType.getSelectedItem().toString());
if (ChkUserActive.isSelected()==true) {
rsuser.updateString("user_active","YES");
} else {
rsuser.updateString("user_active","NO");
}
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 76/144
Library Management System
75
rsuser.updateRow();
rsuser.refreshRow();
}
chadd=false;JOptionPane.showMessageDialog(null,"Record updated.");
} catch (Exception e) {
System.err.println(e);
JOptionPane.showMessageDialog(null,"Unable to save record.");
return;
}
}
private void CmdCloseActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
this.setVisible(false);
}
private void formWindowOpened(java.awt.event.WindowEvent evt) {
try
{
this.setLocationRelativeTo(null);
ClearText();
CmbUserType.removeAllItems();
CmbUserType.addItem("Admin");
CmbUserType.addItem("User");
Connection connection;
connection=DriverManager.getConnection(mc.StrUrl,mc.StrUid,mc.StrPwd);
ResultSet rs;
PreparedStatement stmt;
//get user count
stmt=connection.prepareStatement("select count(*) from lib_user");
rs = stmt.executeQuery();
rs.first();
rscount=rs.getInt(1);
//get user details
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 77/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 78/144
Library Management System
77
}
}
private void ClearText()
{//clear text of fields for entry/display old data
TxtUserName.setText("");
TxtPassword.setText("");
ChkUserActive.setSelected(false);
LblPosition.setText("");
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new UserMaster().setVisible(true);
}
});}
// Variables declaration - do not modify
private javax.swing.JCheckBox ChkUserActive;
private javax.swing.JComboBox CmbUserType;
private javax.swing.JButton CmdClose;
private javax.swing.JButton CmdEdit;
private javax.swing.JButton CmdFirst;
private javax.swing.JButton CmdLast; private javax.swing.JButton CmdNew;
private javax.swing.JButton CmdNext;
private javax.swing.JButton CmdPrevious;
private javax.swing.JButton CmdSave;
private javax.swing.JLabel LblPosition;
private javax.swing.JTextField TxtPassword;
private javax.swing.JTextField TxtUserName;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 79/144
Library Management System
78
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}4. Change Password code:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import javax.swing.JOptionPane;
public class ChangePassword extends javax.swing.JFrame {
/** Creates new form ChangePassword */
public ChangePassword() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
CmdOk = new javax.swing.JButton();
CmdClose = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
TxtConfirmPassword = new javax.swing.JPasswordField();
TxtNewPassword = new javax.swing.JPasswordField();
TxtOldPassword = new javax.swing.JPasswordField();
jPanel1 = new javax.swing.JPanel();
jLabel2 = new javax.swing.JLabel();
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 80/144
Library Management System
79
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CL
OSE);
setTitle("Change Password");
addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
CmdOk.setText("Ok");
CmdOk.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdOkActionPerformed(evt);
}
});
CmdClose.setText("Close");
CmdClose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdCloseActionPerformed(evt);
}
});
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel1.setText(" Library - Change Password");
jLabel5.setText("Confirm Password:");
jLabel4.setText("New Password:");
jLabel3.setText("Old Password:");
jLabel2.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\ChangePassword.
jpg")); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new
javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEA
DING)
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 81/144
Library Management System
80
.addComponent(jLabel2,
javax.swing.GroupLayout.PREFERRED_SIZE, 430,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEA
DING)
.addComponent(jLabel2,
javax.swing.GroupLayout.PREFERRED_SIZE, 240,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(80, 80, 80)
.addComponent(jLabel3,
javax.swing.GroupLayout.PREFERRED_SIZE, 110,
javax.swing.GroupLayout.PREFERRED_SIZE).addGap(0, 0, 0)
.addComponent(TxtOldPassword,
javax.swing.GroupLayout.PREFERRED_SIZE, 136,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(80, 80, 80)
.addComponent(jLabel4,
javax.swing.GroupLayout.PREFERRED_SIZE, 120,
javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup()
.addGap(190, 190, 190)
.addComponent(TxtConfirmPassword,
javax.swing.GroupLayout.PREFERRED_SIZE, 136,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(154, 154, 154)
.addComponent(CmdOk)
.addGap(6, 6, 6)
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 82/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 83/144
Library Management System
82
.addComponent(TxtConfirmPassword,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(27, 27, 27)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L
EADING)
.addComponent(CmdOk)
.addComponent(CmdClose)))
.addGroup(layout.createSequentialGroup()
.addGap(90, 90, 90)
.addComponent(TxtNewPassword,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(114, 114, 114)
.addComponent(jLabel5,
javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jLabel1)).addComponent(jPanel1,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>
private void CmdOkActionPerformed(java.awt.event.ActionEvent evt) {
//validation
try {
if (TxtOldPassword.getText().isEmpty()==true) {
JOptionPane.showMessageDialog(null,"Enter Old Password.");
return;
}
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 84/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 85/144
Library Management System
84
}
} catch (Exception e) {
System.err.println(e);System.exit(1);
}
}
private void CmdCloseActionPerformed(java.awt.event.ActionEvent evt) {
// Close project
this.setVisible(false);
}
private void formWindowOpened(java.awt.event.WindowEvent evt) {
this.setLocationRelativeTo(null);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {new ChangePassword().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton CmdClose;
private javax.swing.JButton CmdOk;
private javax.swing.JPasswordField TxtConfirmPassword; private javax.swing.JPasswordField TxtNewPassword;
private javax.swing.JPasswordField TxtOldPassword;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 86/144
Library Management System
85
5. Book Master code:
public class BookMaster extends javax.swing.JFrame {
MainClass mc=new MainClass();
ResultSet rsbook;int rspos=0;
int rscount=0;
boolean chadd=false;
/** Creates new form BookMaster */
public BookMaster() {
initComponents();
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
TxtBookID = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
TxtBookTitle = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
TxtAuthor = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
TxtPublisher = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
TxtYear = new javax.swing.JTextField();
jLabel7 = new javax.swing.JLabel();TxtKeywords = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
CmbCategory = new javax.swing.JComboBox();
CmdFirst = new javax.swing.JButton();
CmdPrevious = new javax.swing.JButton();
CmdNext = new javax.swing.JButton();
CmdLast = new javax.swing.JButton();
CmdNew = new javax.swing.JButton();
CmdEdit = new javax.swing.JButton();
CmdSave = new javax.swing.JButton();
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 87/144
Library Management System
86
CmdClose = new javax.swing.JButton();
LblPosition = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
jLabel10 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CL
OSE);
setTitle(" Book Master");
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel1.setText(" Library - Book Master");
jLabel2.setText("Book ID:");
TxtBookID.setEditable(false);
TxtBookID.setText("jTextField1");
jLabel3.setText("Book Title:");
TxtBookTitle.setText("jTextField1");
jLabel4.setText("Author:");
TxtAuthor.setText("jTextField1");
jLabel5.setText("Publisher:");
TxtPublisher.setText("jTextField1");
jLabel6.setText("Year Publish:");
TxtYear.setText("jTextField1");
jLabel7.setText("Search Keyword:");
TxtKeywords.setText("jTextField1");
jLabel8.setText("Category:");
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 88/144
Library Management System
87
CmbCategory.setModel(new javax.swing.DefaultComboBoxModel(new
String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
CmdFirst.setText("Fisrt");CmdFirst.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdFirstActionPerformed(evt);
}
});
CmdPrevious.setText("Previous");
CmdPrevious.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdPreviousActionPerformed(evt);
}
});
CmdNext.setText("Next");
CmdNext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdNextActionPerformed(evt);
}
});
CmdLast.setText("Last");
CmdLast.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdLastActionPerformed(evt);
}
});
CmdNew.setText("New");CmdNew.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdNewActionPerformed(evt);
}
});
CmdEdit.setText("Edit");
CmdEdit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdEditActionPerformed(evt);
}
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 89/144
Library Management System
88
});
CmdSave.setText("Save");
CmdSave.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {CmdSaveActionPerformed(evt);
}
});
CmdClose.setText("Close");
CmdClose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdCloseActionPerformed(evt);
}
});
LblPosition.setText("Book ID:");
jPanel1.setLayout(null);
jLabel10.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\BookMaster.jpg"
)); // NOI18N
jPanel1.add(jLabel10); jLabel10.setBounds(0, 0, 620, 410);
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup().addGap(10, 10, 10)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(87, 87, 87)
.addComponent(jLabel2)
.addGap(68, 68, 68)
.addComponent(TxtBookID,
javax.swing.GroupLayout.PREFERRED_SIZE, 198,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(87, 87, 87)
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 90/144
Library Management System
89
.addComponent(jLabel3)
.addGap(59, 59, 59)
.addComponent(TxtBookTitle,
javax.swing.GroupLayout.PREFERRED_SIZE, 198,
javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup()
.addGap(87, 87, 87)
.addComponent(jLabel4)
.addGap(72, 72, 72)
.addComponent(TxtAuthor,
javax.swing.GroupLayout.PREFERRED_SIZE, 198,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(87, 87, 87)
.addComponent(jLabel5)
.addGap(62, 62, 62)
.addComponent(TxtPublisher,
javax.swing.GroupLayout.PREFERRED_SIZE, 198,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(87, 87, 87)
.addComponent(jLabel6)
.addGap(47, 47, 47)
.addComponent(TxtYear, javax.swing.GroupLayout.PREFERRED_SIZE, 198,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(87, 87, 87)
.addComponent(jLabel8)
.addGap(60, 60, 60)
.addComponent(CmbCategory,
javax.swing.GroupLayout.PREFERRED_SIZE, 198,
javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup()
.addGap(87, 87, 87)
.addComponent(jLabel7)
.addGap(27, 27, 27)
.addComponent(TxtKeywords,
javax.swing.GroupLayout.PREFERRED_SIZE, 197,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(143, 143, 143)
.addComponent(LblPosition))
.addGroup(layout.createSequentialGroup()
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 91/144
Library Management System
90
.addGap(25, 25, 25)
.addComponent(CmdFirst)
.addGap(85, 85, 85)
.addComponent(CmdNext)
.addGap(6, 6, 6)
.addComponent(CmdLast)
.addGap(63, 63, 63)
.addComponent(CmdNew)
.addGap(7, 7, 7)
.addComponent(CmdEdit)
.addGap(6, 6, 6)
.addComponent(CmdSave)
.addGap(6, 6, 6)
.addComponent(CmdClose))
.addGroup(layout.createSequentialGroup()
.addGap(84, 84, 84)
.addComponent(CmdPrevious))
.addComponent(jPanel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 620,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup()
.addGap(11, 11, 11)
.addComponent(jLabel1)
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L
EADING)
.addGroup(layout.createSequentialGroup()
.addGap(5, 5, 5)
.addComponent(jLabel2))
.addComponent(TxtBookID,
javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(6, 6, 6)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L
EADING)
.addGroup(layout.createSequentialGroup()
.addGap(1, 1, 1)
.addComponent(jLabel3))
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 92/144
Library Management System
91
.addComponent(TxtBookTitle,
javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(6, 6, 6)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L
EADING)
.addGroup(layout.createSequentialGroup()
.addGap(4, 4, 4)
.addComponent(jLabel4))
.addComponent(TxtAuthor,
javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(6, 6, 6)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L
EADING)
.addComponent(jLabel5)
.addComponent(TxtPublisher,
javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(2, 2, 2)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addGroup(layout.createSequentialGroup()
.addGap(4, 4, 4)
.addComponent(TxtYear,
javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(6, 6, 6)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L
EADING)
.addComponent(jLabel8)
.addGroup(layout.createSequentialGroup()
.addGap(1, 1, 1)
.addComponent(CmbCategory,
javax.swing.GroupLayout.PREFERRED_SIZE, 25,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(19, 19, 19)
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 93/144
Library Management System
92
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L
EADING)
.addComponent(jLabel7)
.addComponent(TxtKeywords, javax.swing.GroupLayout.PREFERRED_SIZE, 45,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(43, 43, 43)
.addComponent(LblPosition)
.addGap(6, 6, 6)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L
EADING)
.addComponent(CmdFirst)
.addComponent(CmdNext)
.addComponent(CmdLast)
.addComponent(CmdNew)
.addComponent(CmdEdit)
.addComponent(CmdSave)
.addComponent(CmdClose)))
.addGroup(layout.createSequentialGroup()
.addGap(345, 345, 345)
.addComponent(CmdPrevious))
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 410,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>
private void CmdCloseActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:this.setVisible(false);
}
private void formWindowOpened(java.awt.event.WindowEvent evt) {
// TODO add your handling code here:
try
{
this.setLocationRelativeTo(null);
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 94/144
Library Management System
93
ClearText();
CmbCategory.removeAllItems();
Connection connection;
connection=DriverManager.getConnection(mc.StrUrl,mc.StrUid,mc.StrPwd);
ResultSet rs;
//fill book category
PreparedStatement stmt=connection.prepareStatement("select * from
lib_book_category order by book_category");
rs = stmt.executeQuery();
while (rs.next()){
CmbCategory.addItem(rs.getString(1));
}
rs.close();
//get book count
stmt=connection.prepareStatement("select count(*) from
lib_book_master");
rs = stmt.executeQuery();
rs.first();
rscount=rs.getInt(1);
//get book details
Statement stmt1 =
connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sqlQuery = "select * from lib_book_master order by book_id";
rsbook = stmt1.executeQuery(sqlQuery);
//display first recordrsbook.first();
Display();
}
catch (Exception e)
{
System.err.println(e);
//System.exit(1);
}
}
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 95/144
Library Management System
94
private void CmdNewActionPerformed(java.awt.event.ActionEvent evt) {
chadd=true;
ClearText();}
private void CmdNextActionPerformed(java.awt.event.ActionEvent evt) {
try
{
if (rsbook.isLast()==true)
{
JOptionPane.showMessageDialog(null,"Already in last record.");
return;
}
rsbook.next();
Display();
}
catch (Exception e)
{
System.err.println(e);
}
}
private void CmdFirstActionPerformed(java.awt.event.ActionEvent evt) {
try
{
rsbook.first();Display();
}
catch (Exception e)
{
System.err.println(e);
}
}
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 96/144
Library Management System
95
private void CmdPreviousActionPerformed(java.awt.event.ActionEvent evt)
{
try
{if (rsbook.isFirst()==true)
{
JOptionPane.showMessageDialog(null,"Already in first record.");
return;
}
rsbook.previous();
Display();
}
catch (Exception e)
{
System.err.println(e);
}
}
private void CmdLastActionPerformed(java.awt.event.ActionEvent evt) {
try
{
rsbook.last();
Display();
}
catch (Exception e)
{System.err.println(e);
//System.exit(1);
}
}
private void CmdEditActionPerformed(java.awt.event.ActionEvent evt) {
chadd=false;
}
private void CmdSaveActionPerformed(java.awt.event.ActionEvent evt) {
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 97/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 98/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 99/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 100/144
Library Management System
99
}
// Variables declaration - do not modify
private javax.swing.JComboBox CmbCategory;
private javax.swing.JButton CmdClose; private javax.swing.JButton CmdEdit;
private javax.swing.JButton CmdFirst;
private javax.swing.JButton CmdLast;
private javax.swing.JButton CmdNew;
private javax.swing.JButton CmdNext;
private javax.swing.JButton CmdPrevious;
private javax.swing.JButton CmdSave;
private javax.swing.JLabel LblPosition;
private javax.swing.JTextField TxtAuthor;
private javax.swing.JTextField TxtBookID;
private javax.swing.JTextField TxtBookTitle;
private javax.swing.JTextField TxtKeywords;
private javax.swing.JTextField TxtPublisher;
private javax.swing.JTextField TxtYear;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}
6.
Search Book code: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try
{
MainClass mc=new MainClass();
Connection connection;
connection=DriverManager.getConnection(mc.StrUrl,mc.StrUid,mc.StrPwd);
ResultSet rs;
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 101/144
Library Management System
100
String StrQr="";
if (TxtBookID.getText().trim().length()>0 )
{
StrQr=StrQr + " and book_id = " + TxtBookID.getText().trim() + " ";}
if (TxtTitle.getText().trim().length()>0 )
{
StrQr=StrQr + " and book_title like '%" + TxtTitle.getText().trim() +
"%' ";
}
if (TxtKeyword.getText().trim().length()>0 )
{
StrQr=StrQr + " and book_keyword like '%" +
TxtKeyword.getText().trim() + "%' ";
}
if (StrQr.length()==0)
{
JOptionPane.showMessageDialog(null,"Enter search critaria.");
return;
}
PreparedStatement stmt=connection.prepareStatement("select book_id,
book_title, book_category, book_keyword from lib_book_master where 1=1 "
+ StrQr + " order by book_id");
rs = stmt.executeQuery();
jTable1.getColumnModel().getColumn(0).setHeaderValue("Book
ID"); jTable1.getColumnModel().getColumn(1).setHeaderValue("Title");
jTable1.getColumnModel().getColumn(2).setHeaderValue("Category");
jTable1.getColumnModel().getColumn(3).setHeaderValue("Keyword");
jTable1.getTableHeader().resizeAndRepaint();
// Removing Previous Data
while (jTable1.getRowCount() > 0) {
((DefaultTableModel) jTable1.getModel()).removeRow(0);
}
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 102/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 103/144
Library Management System
102
while (jTable1.getRowCount() > 0) {
((DefaultTableModel) jTable1.getModel()).removeRow(0);
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new SearchBook().setVisible(true);
}
});
}
7.
Book Status code:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
try {
MainClass mc=new MainClass();
Connection connection;
connection=DriverManager.getConnection(mc.StrUrl,mc.StrUid,mc.StrPwd);
ResultSet rs;
PreparedStatement stmt=connection.prepareStatement("select book_id,
book_title, book_category, book_status from lib_book_master order by book_id");
rs = stmt.executeQuery();
jTable1.getColumnModel().getColumn(0).setHeaderValue("Book
ID");
jTable1.getColumnModel().getColumn(1).setHeaderValue("Title");
jTable1.getColumnModel().getColumn(2).setHeaderValue("Category");
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 104/144
Library Management System
103
jTable1.getColumnModel().getColumn(3).setHeaderValue("Status");
jTable1.getTableHeader().resizeAndRepaint();
// Removing Previous Data
while (jTable1.getRowCount() > 0) {((DefaultTableModel) jTable1.getModel()).removeRow(0);
}
//Creating Object []rowData for jTable's Table Model
int columns = rs.getMetaData().getColumnCount();
while (rs.next()) {
Object[] row = new Object[columns];
for (int i = 1; i <= columns; i++) {
row[i - 1] = rs.getObject(i); // 1
}
((DefaultTableModel) jTable1.getModel()).insertRow(rs.getRow() -
1,row);
}
} catch (Exception e) {
System.err.println(e);
//System.exit(1);}
}
private void CmdCloseActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
}
private void formWindowOpened(java.awt.event.WindowEvent evt) {
this.setLocationRelativeTo(null);
jTable1.getColumnModel().getColumn(0).setHeaderValue("Book ID");
jTable1.getColumnModel().getColumn(1).setHeaderValue("Title");
jTable1.getColumnModel().getColumn(2).setHeaderValue("Category");
jTable1.getColumnModel().getColumn(3).setHeaderValue("Status");
jTable1.getTableHeader().resizeAndRepaint();
// Removing Previous Data
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 105/144
Library Management System
104
while (jTable1.getRowCount() > 0) {
((DefaultTableModel) jTable1.getModel()).removeRow(0);
}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new BookStatus().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton CmdClose;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
// End of variables declaration
}
8. Member Master code:
import java.sql.Statement;
import java.sql.Connection;import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;import javax.swing.JOptionPane;
public class MemberMaster extends javax.swing.JFrame {
MainClass mc=new MainClass();
ResultSet rsmem;
int rspos=0;
int rscount=0; boolean chadd=false;
/** Creates new form MemberMaster */ public MemberMaster() {
initComponents();
}
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 106/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 107/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 108/144
Library Management System
107
}
});
CmdEdit.setText("Edit");
CmdEdit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {CmdEditActionPerformed(evt);
}});
CmdSave.setText("Save");
CmdSave.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdSaveActionPerformed(evt);
}
});
CmdClose.setText("Close");CmdClose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdCloseActionPerformed(evt);
}
});
ChkMemActive.setText("Member Active");
jPanel1.setLayout(null);
jLabel7.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\membermaster.jpg")); //
NOI18N
jPanel1.add(jLabel7);
jLabel7.setBounds(0, 0, 580, 380);
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup().addGap(178, 178, 178)
.addComponent(TxtName, javax.swing.GroupLayout.PREFERRED_SIZE,
198, javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup()
.addGap(178, 178, 178)
.addComponent(TxtAddress,
javax.swing.GroupLayout.PREFERRED_SIZE, 198,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup().addGap(178, 178, 178)
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 109/144
Library Management System
108
.addComponent(TxtEmailID,
javax.swing.GroupLayout.PREFERRED_SIZE, 198,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(95, 95, 95)
.addComponent(jLabel6)
.addGap(33, 33, 33)
.addComponent(TxtMobileNo, javax.swing.GroupLayout.PREFERRED_SIZE, 198,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(90, 90, 90)
.addComponent(CmdPrevious)
.addGap(337, 337, 337)
.addComponent(CmdClose))
.addGroup(layout.createSequentialGroup()
.addGap(170, 170, 170)
.addComponent(CmdNext)).addGroup(layout.createSequentialGroup()
.addGap(95, 95, 95)
.addComponent(jLabel5))
.addGroup(layout.createSequentialGroup()
.addGap(320, 320, 320)
.addComponent(CmdNew))
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(jLabel1)).addGroup(layout.createSequentialGroup()
.addGap(95, 95, 95)
.addComponent(jLabel3))
.addGroup(layout.createSequentialGroup()
.addGap(178, 178, 178)
.addComponent(ChkMemActive))
.addGroup(layout.createSequentialGroup()
.addGap(178, 178, 178)
.addComponent(TxtMemID,
javax.swing.GroupLayout.PREFERRED_SIZE, 198,
javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup()
.addGap(150, 150, 150)
.addComponent(LblPosition))
.addGroup(layout.createSequentialGroup()
.addGap(95, 95, 95)
.addComponent(jLabel4))
.addGroup(layout.createSequentialGroup().addGap(440, 440, 440)
.addComponent(CmdSave))
.addGroup(layout.createSequentialGroup()
.addGap(230, 230, 230)
.addComponent(CmdLast))
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 110/144
Library Management System
109
.addGroup(layout.createSequentialGroup()
.addGap(380, 380, 380)
.addComponent(CmdEdit))
.addGroup(layout.createSequentialGroup()
.addGap(95, 95, 95)
.addComponent(jLabel2)).addGroup(layout.createSequentialGroup()
.addGap(30, 30, 30)
.addComponent(CmdFirst))
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 580,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(76, 76, 76)
.addComponent(TxtName, javax.swing.GroupLayout.PREFERRED_SIZE,
23, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(6, 6, 6)
.addComponent(TxtAddress,
javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6)
.addComponent(TxtEmailID,
javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN
G)
.addGroup(layout.createSequentialGroup()
.addGap(4, 4, 4)
.addComponent(jLabel6))
.addComponent(TxtMobileNo,
javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(144, 144, 144)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN
G).addComponent(CmdPrevious)
.addComponent(CmdClose)))
.addGroup(layout.createSequentialGroup().addGap(330, 330, 330)
.addComponent(CmdNext)).addGroup(layout.createSequentialGroup()
.addGap(138, 138, 138)
.addComponent(jLabel5))
.addGroup(layout.createSequentialGroup().addGap(330, 330, 330)
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 111/144
Library Management System
110
.addComponent(CmdNew))
.addGroup(layout.createSequentialGroup()
.addGap(11, 11, 11)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(84, 84, 84)
.addComponent(jLabel3))
.addGroup(layout.createSequentialGroup().addGap(204, 204, 204)
.addComponent(ChkMemActive))
.addGroup(layout.createSequentialGroup()
.addGap(47, 47, 47)
.addComponent(TxtMemID,
javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(310, 310, 310)
.addComponent(LblPosition)).addGroup(layout.createSequentialGroup()
.addGap(109, 109, 109)
.addComponent(jLabel4))
.addGroup(layout.createSequentialGroup()
.addGap(330, 330, 330)
.addComponent(CmdSave))
.addGroup(layout.createSequentialGroup()
.addGap(330, 330, 330)
.addComponent(CmdLast)).addGroup(layout.createSequentialGroup()
.addGap(330, 330, 330)
.addComponent(CmdEdit))
.addGroup(layout.createSequentialGroup()
.addGap(52, 52, 52)
.addComponent(jLabel2))
.addGroup(layout.createSequentialGroup()
.addGap(330, 330, 330)
.addComponent(CmdFirst))
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 380,
javax.swing.GroupLayout.PREFERRED_SIZE));
pack();
}// </editor-fold>
private void Display(){
try{
//clear text of fields for entry/display old data
TxtMemID.setText(rsmem.getString("mem_id"));
TxtName.setText(rsmem.getString("mem_name"));TxtAddress.setText(rsmem.getString("mem_address"));
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 112/144
Library Management System
111
TxtEmailID.setText(rsmem.getString("mem_email_id"));
TxtMobileNo.setText(rsmem.getString("mem_mobile_no"));
if (rsmem.getString("mem_active").equals("Y"))
{
ChkMemActive.setSelected(true);}
else{
ChkMemActive.setSelected(false);
}
LblPosition.setText("Record position : " + rsmem.getRow() + "/" +
String.valueOf(rscount));
}
catch (Exception e)
{System.err.println(e);
}
}
private void ClearText()
{
//clear text of fields for entry/display old data
TxtMemID.setText("");TxtName.setText("");TxtAddress.setText("");
TxtEmailID.setText("");
TxtMobileNo.setText("");
ChkMemActive.setSelected(false);
LblPosition.setText("");
}
private void CmdFirstActionPerformed(java.awt.event.ActionEvent evt) {
try {rsmem.first();
Display();
} catch (Exception e) {
System.err.println(e);
}}
private void CmdPreviousActionPerformed(java.awt.event.ActionEvent evt) {
try {if (rsmem.isFirst()==true) {
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 113/144
Library Management System
112
JOptionPane.showMessageDialog(null,"Already in first record.");
return;
}
rsmem.previous();Display();
} catch (Exception e) {
System.err.println(e);
}
}
private void CmdNextActionPerformed(java.awt.event.ActionEvent evt) {
try {
if (rsmem.isLast()==true) {
JOptionPane.showMessageDialog(null,"Already in last record.");return;
}
rsmem.next();
Display();
} catch (Exception e) {
System.err.println(e);
}}
private void CmdLastActionPerformed(java.awt.event.ActionEvent evt) {
try {
rsmem.last();
Display();
} catch (Exception e) {
System.err.println(e);
//System.exit(1);}
}
private void CmdNewActionPerformed(java.awt.event.ActionEvent evt) {
chadd=true;ClearText();
}
private void CmdEditActionPerformed(java.awt.event.ActionEvent evt) {
chadd=false;
}
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 114/144
Library Management System
113
private void CmdSaveActionPerformed(java.awt.event.ActionEvent evt) {
//validate entry and save record
try {
if (TxtName.getText().trim().length()==0 ) {
JOptionPane.showMessageDialog(null,"Enter member name.");return;
}
if (TxtAddress.getText().trim().length()==0 ) {
JOptionPane.showMessageDialog(null,"Enter address.");
return;
}
if (TxtEmailID.getText().trim().length()==0) {
JOptionPane.showMessageDialog(null,"Enter email id.");
return;
}
if (TxtMobileNo.getText().trim().length()==0) {JOptionPane.showMessageDialog(null,"Enter mobile no.");
return;
}
//String strqr="";
Connection connection;connection=DriverManager.getConnection(mc.StrUrl,mc.StrUid,mc.StrPwd);
if (TxtMemID.getText().trim().length()==0 ) {
rsmem.moveToInsertRow();
rsmem.updateString("mem_name",TxtName.getText());
rsmem.updateString("mem_address",TxtAddress.getText());
rsmem.updateString("mem_email_id",TxtEmailID.getText());
rsmem.updateString("mem_mobile_no",TxtMobileNo.getText());
if (ChkMemActive.isSelected()==true)
{rsmem.updateString("mem_active","Y");
}
else{
rsmem.updateString("mem_active","N");}
rsmem.insertRow();
rsmem.last();
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 115/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 116/144
Library Management System
115
//get mem count
PreparedStatement stmt;
stmt=connection.prepareStatement("select count(*) fromlib_member_master");
rs = stmt.executeQuery();rs.first();
rscount=rs.getInt(1);
//get mem details
Statement stmt1 =
connection.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
String sqlQuery = "select * from lib_member_master order by mem_id";
rsmem = stmt1.executeQuery(sqlQuery);
//display first record
rsmem.first();
Display();
}
catch (Exception e)
{
System.err.println(e);//System.exit(1);}
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() { public void run() {
new MemberMaster().setVisible(true);}
});
}
// Variables declaration - do not modify private javax.swing.JCheckBox ChkMemActive;
private javax.swing.JButton CmdClose;
private javax.swing.JButton CmdEdit;
private javax.swing.JButton CmdFirst; private javax.swing.JButton CmdLast;
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 117/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 118/144
Library Management System
117
TxtMemberName = new javax.swing.JTextField();
TxtMemberStatus = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
TxtBookID = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
TxtBookStatus = new javax.swing.JTextField();TxtBookTitle = new javax.swing.JTextField();
CmdIssueBook = new javax.swing.JButton();CmdClose = new javax.swing.JButton();
CmdBookDetails = new javax.swing.JButton();
CmdReset = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jLabel6 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setTitle(" Issue Book");
addWindowListener(new java.awt.event.WindowAdapter() { public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
jLabel3.setText("Member ID :");
TxtMemberID.setText("jTextField1");
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel1.setText(" Library - Issue Book");
CmdMemberDetails.setText("Details");
CmdMemberDetails.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdMemberDetailsActionPerformed(evt);
}
});
jLabel2.setText("Name :");
TxtMemberName.setEditable(false);TxtMemberName.setText("jTextField1");
TxtMemberStatus.setEditable(false);TxtMemberStatus.setText("jTextField1");
jLabel4.setText("Book ID :");
TxtBookID.setText("jTextField1");
jLabel5.setText("Title :");
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 119/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 120/144
Library Management System
119
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(jLabel3)
.addGap(4, 4, 4)
.addComponent(TxtMemberID, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addComponent(CmdMemberDetails))
.addGroup(layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(jLabel2)
.addGap(33, 33, 33)
.addComponent(TxtMemberName,
javax.swing.GroupLayout.PREFERRED_SIZE, 229,
javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup()
.addGap(107, 107, 107)
.addComponent(TxtMemberStatus,
javax.swing.GroupLayout.PREFERRED_SIZE, 229,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(jLabel4)
.addGap(18, 18, 18).addComponent(TxtBookID, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(10, 10, 10)
.addComponent(CmdBookDetails))
.addGroup(layout.createSequentialGroup()
.addGap(40, 40, 40)
.addComponent(jLabel5)
.addGap(40, 40, 40)
.addComponent(TxtBookTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 229,
javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup()
.addGap(107, 107, 107)
.addComponent(TxtBookStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 229,
javax.swing.GroupLayout.PREFERRED_SIZE)).addGroup(layout.createSequentialGroup()
.addGap(110, 110, 110)
.addComponent(CmdReset)
.addGap(9, 9, 9)
.addComponent(CmdIssueBook)
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 121/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 122/144
Library Management System
121
.addComponent(jLabel5))
.addComponent(TxtBookTitle,
javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(6, 6, 6)
.addComponent(TxtBookStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 23,
javax.swing.GroupLayout.PREFERRED_SIZE).addGap(41, 41, 41)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADIN
G)
.addComponent(CmdReset)
.addComponent(CmdIssueBook)
.addComponent(CmdClose)))
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 310,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>
private void CmdResetActionPerformed(java.awt.event.ActionEvent evt) {
ClearText();
}
private void CmdIssueBookActionPerformed(java.awt.event.ActionEvent evt) {//issue booktry
{
if (TxtMemberID.getText().trim().length()==0 ) {
JOptionPane.showMessageDialog(null,"Enter member id.");
return;
}
if (TxtBookID.getText().trim().length()==0 ) {
JOptionPane.showMessageDialog(null,"Enter member id.");return;
}MainClass mc=new MainClass();
Connection connection;
connection=DriverManager.getConnection(mc.StrUrl,mc.StrUid,mc.StrPwd);
String sql = "insert into lib_transaction (trn_mem_id,trn_book_id,trn_issue_dt)values (" + TxtMemberID.getText() + "," + TxtBookID.getText() + ",sysdate())";
PreparedStatement pst=connection.prepareStatement(sql);
pst.executeUpdate(sql);
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 123/144
Library Management System
122
sql = "update lib_book_master set book_status='Issued' where book_id=" +
TxtBookID.getText();
pst=connection.prepareStatement(sql);
pst.executeUpdate(sql);
JOptionPane.showMessageDialog(null,"Book Issued");
ClearText();}
catch (Exception e) {
System.err.println(e);
System.exit(1);
}
}
private void CmdCloseActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);}
private void formWindowOpened(java.awt.event.WindowEvent evt) {
ClearText();
this.setLocationRelativeTo(null);
}
private void CmdMemberDetailsActionPerformed(java.awt.event.ActionEvent evt)
{ //get member deatilstry
{
//get database connection details
MainClass mc=new MainClass();
//open connection
Connection connection;
connection=DriverManager.getConnection(mc.StrUrl,mc.StrUid,mc.StrPwd);
String str="";
str="select * from lib_member_master where mem_id =? ";PreparedStatement pst=connection.prepareStatement(str);
pst.setString(1, TxtMemberID.getText());
ResultSet rs;
rs=pst.executeQuery();if (rs.next())
{TxtMemberName.setText(rs.getString("mem_name"));
//get mem status
str="select * from lib_transaction where trn_mem_id =? and (trn_receive_dtis null or trn_receive_dt='')";
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 124/144
Library Management System
123
PreparedStatement pst1=connection.prepareStatement(str);
pst1.setString(1, TxtMemberID.getText());
ResultSet rs1;
rs1=pst1.executeQuery();
if (rs1.next()){
TxtMemberStatus.setText("Book already issued.");CmdIssueBook.setEnabled(false);
CmdBookDetails.setEnabled(false);
}
else
{
TxtMemberStatus.setText("No book issued.");
CmdIssueBook.setEnabled(true);
CmdBookDetails.setEnabled(true);
}
}else
{
JOptionPane.showMessageDialog(null,"Invalid member id.");
TxtMemberID.setText("");
TxtMemberName.setText("");
TxtMemberStatus.setText("");
CmdIssueBook.setEnabled(false);
return;
}
}
catch (Exception e)
{
System.err.println(e);
System.exit(1);
}
}
private void CmdBookDetailsActionPerformed(java.awt.event.ActionEvent evt) {
//get member deatilstry
{
//get database connection detailsMainClass mc=new MainClass();
//open connection
Connection connection;
connection=DriverManager.getConnection(mc.StrUrl,mc.StrUid,mc.StrPwd);
String str="";str="select * from lib_book_master where book_id =? ";
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 125/144
Library Management System
124
PreparedStatement pst=connection.prepareStatement(str);
pst.setString(1, TxtBookID.getText());
ResultSet rs;
rs=pst.executeQuery();
if (rs.next()){
TxtBookTitle.setText(rs.getString("book_title"));
//get mem status
str="select * from lib_transaction where trn_book_id =? and (trn_receive_dt
is null or trn_receive_dt='')";
PreparedStatement pst1=connection.prepareStatement(str);
pst1.setString(1, TxtBookID.getText());
ResultSet rs1;
rs1=pst1.executeQuery();
if (rs1.next()){
TxtBookStatus.setText("Book not available.");
CmdIssueBook.setEnabled(false);
}
else
{
TxtBookStatus.setText("Book available.");
CmdIssueBook.setEnabled(true);
}
}
else
{
JOptionPane.showMessageDialog(null,"Invalid book id.");
TxtBookID.setText("");
TxtBookTitle.setText("");
TxtBookStatus.setText("");
CmdIssueBook.setEnabled(false);
return;}
}
catch (Exception e){
System.err.println(e);System.exit(1);
}
}
private void ClearText()
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 126/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 127/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 128/144
Library Management System
127
});
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel1.setText("Library - Receive Book");
jLabel3.setText("Member ID :");
TxtMemberID.setText("jTextField1");
CmdMemberDetails.setText("Details");
CmdMemberDetails.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdMemberDetailsActionPerformed(evt);
}
});
jLabel2.setText("Name :");
TxtMemberName.setEditable(false);
TxtMemberName.setText("jTextField1");
CmdReset.setText("Reset");
CmdReset.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdResetActionPerformed(evt);
}
});
CmdReceiveBook.setText("Receive Book");
CmdReceiveBook.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdReceiveBookActionPerformed(evt);}
});
CmdClose.setText("Close");
CmdClose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdCloseActionPerformed(evt);
}
});
TxtBookDetails.setEditable(false);
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 129/144
Library Management System
128
TxtBookDetails.setText("jTextField1");
jLabel4.setText("Book :");
LblBookID.setFont(new java.awt.Font("Tahoma", 0, 8)); // NOI18NLblBookID.setForeground(java.awt.Color.lightGray);
jLabel5.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\reciveBook.jpg")); //
NOI18N
javax.swing.GroupLayout jPanel1Layout = new
javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE,
410, javax.swing.GroupLayout.PREFERRED_SIZE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI NG)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE,
300, javax.swing.GroupLayout.PREFERRED_SIZE)
);
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 164,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(45, 45, 45)
.addComponent(jLabel3)
.addGap(14, 14, 14)
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 130/144
Library Management System
129
.addComponent(TxtMemberID,
javax.swing.GroupLayout.PREFERRED_SIZE, 53,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(109, 109, 109)
.addComponent(CmdMemberDetails)).addGroup(layout.createSequentialGroup()
.addGap(45, 45, 45)
.addComponent(jLabel2))
.addGroup(layout.createSequentialGroup()
.addGap(45, 45, 45)
.addComponent(jLabel4)
.addGap(41, 41, 41)
.addComponent(TxtBookDetails,
javax.swing.GroupLayout.PREFERRED_SIZE, 229,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(116, 116, 116)
.addComponent(LblBookID))
.addGroup(layout.createSequentialGroup()
.addGap(116, 116, 116)
.addComponent(CmdReset)
.addGap(6, 6, 6)
.addComponent(CmdReceiveBook)
.addGap(6, 6, 6)
.addComponent(CmdClose))
.addGroup(layout.createSequentialGroup()
.addGap(116, 116, 116)
.addComponent(TxtMemberName,
javax.swing.GroupLayout.PREFERRED_SIZE, 229,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
405, javax.swing.GroupLayout.PREFERRED_SIZE)
);layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(11, 11, 11)
.addComponent(jLabel1)
.addGap(13, 13, 13)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEA
DING)
.addGroup(layout.createSequentialGroup()
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 131/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 132/144
Library Management System
131
MainClass mc=new MainClass();
//open connection
Connection connection;
connection=DriverManager.getConnection(mc.StrUrl,mc.StrUid,mc.StrPwd);
String str="";
str="select * from lib_member_master where mem_id =? ";
PreparedStatement pst=connection.prepareStatement(str);
pst.setString(1, TxtMemberID.getText());
ResultSet rs;
rs=pst.executeQuery();
if (rs.next()) {
TxtMemberName.setText(rs.getString("mem_name"));
//get mem status
str="select * from lib_transaction, lib_book_master where
book_id=trn_book_id and trn_mem_id =? and (trn_receive_dt is null or
trn_receive_dt='')";
PreparedStatement pst1=connection.prepareStatement(str);
pst1.setString(1, TxtMemberID.getText());
ResultSet rs1;rs1=pst1.executeQuery();
if (rs1.next()) {
TxtBookDetails.setText("Available Book : " +
rs1.getString("book_title"));
CmdReceiveBook.setEnabled(true);
LblBookID.setText(rs1.getString("book_id"));
} else {
TxtBookDetails.setText("No book available.");CmdReceiveBook.setEnabled(false);
LblBookID.setText("");
}
} else {
JOptionPane.showMessageDialog(null,"Invalid member id.");
TxtMemberID.setText("");
TxtMemberName.setText("");
TxtBookDetails.setText("");
CmdReceiveBook.setEnabled(false);
LblBookID.setText("");
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 133/144
Library Management System
132
return;
}
} catch (Exception e) {System.err.println(e);
System.exit(1);
}
}
private void CmdResetActionPerformed(java.awt.event.ActionEvent evt) {
ClearText();
}
private void CmdReceiveBookActionPerformed(java.awt.event.ActionEvent
evt) {
//issue book
try {
if (TxtMemberID.getText().trim().length()==0 ) {
JOptionPane.showMessageDialog(null,"Enter member id.");
return;
}
MainClass mc=new MainClass();
Connection connection;
connection=DriverManager.getConnection(mc.StrUrl,mc.StrUid,mc.StrPwd);
String sql = "update lib_transaction set trn_receive_dt = sysdate() where
trn_mem_id= " + TxtMemberID.getText() + " and trn_receive_dt is null and
trn_book_id=" + LblBookID.getText();PreparedStatement pst=connection.prepareStatement(sql);
pst.executeUpdate(sql);
sql = "update lib_book_master set book_status='Available' where
book_id=" + LblBookID.getText();
pst=connection.prepareStatement(sql);
pst.executeUpdate(sql);
JOptionPane.showMessageDialog(null,"Book Received");
ClearText();
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 134/144
Library Management System
133
} catch (Exception e) {
System.err.println(e);
System.exit(1);
}
}
private void ClearText()
{
TxtMemberID.setText("");
TxtMemberName.setText("");
TxtBookDetails.setText("");
LblBookID.setText("");
CmdReceiveBook.setEnabled(false);
}
private void CmdCloseActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
}
private void formWindowOpened(java.awt.event.WindowEvent evt) {
ClearText();
this.setLocationRelativeTo(null);
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new ReceiveBook().setVisible(true);
}});
}
// Variables declaration - do not modify
private javax.swing.JButton CmdClose;
private javax.swing.JButton CmdMemberDetails;
private javax.swing.JButton CmdReceiveBook;
private javax.swing.JButton CmdReset;
private javax.swing.JLabel LblBookID;
private javax.swing.JTextField TxtBookDetails;
private javax.swing.JTextField TxtMemberID;
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 135/144
Library Management System
134
private javax.swing.JTextField TxtMemberName;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}
11.
About page code: public class About extends javax.swing.JFrame {
/** Creates new form About */
public About() {
initComponents();
}
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel2 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
CmdClose = new javax.swing.JButton();
jPanel1 = new javax.swing.JPanel();
jLabel5 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle(" About");addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel2.setText("Contact Us:");
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 136/144
Library Management System
135
jLabel1.setText(" Library System");
jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel3.setText("WWW.LMS.COM");
jLabel4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel4.setText("[email protected]");
CmdClose.setText("Close");
CmdClose.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmdCloseActionPerformed(evt);
}
});
jLabel5.setIcon(new
javax.swing.ImageIcon("C:\\p2p_library\\source_code\\img\\About.jpg")); //
NOI18N
javax.swing.GroupLayout jPanel1Layout = new
javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE,
400, javax.swing.GroupLayout.PREFERRED_SIZE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADI
NG).addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE,
200, javax.swing.GroupLayout.PREFERRED_SIZE)
);
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 137/144
Library Management System
136
.addGap(125, 125, 125)
.addComponent(jLabel3,
javax.swing.GroupLayout.PREFERRED_SIZE, 180,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup().addGap(70, 70, 70)
.addComponent(jLabel2,
javax.swing.GroupLayout.PREFERRED_SIZE, 97,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(127, 127, 127)
.addComponent(jLabel4,
javax.swing.GroupLayout.PREFERRED_SIZE, 170,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(130, 130, 130)
.addComponent(jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 160,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(280, 280, 280)
.addComponent(CmdClose,
javax.swing.GroupLayout.PREFERRED_SIZE, 76,
javax.swing.GroupLayout.PREFERRED_SIZE)).addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(103, 103, 103)
.addComponent(jLabel3,
javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(80, 80, 80)
.addComponent(jLabel2))
.addGroup(layout.createSequentialGroup()
.addGap(129, 129, 129)
.addComponent(jLabel4,
javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE))
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 138/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 139/144
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 140/144
Library Management System
139
Testing SchedulesThe user acceptance testing schedules are shown in the project structure
document and resulting Gantt charts.
UNIT TESTING :
What are the requirements of library management system?
User able to register and login.
User can search the added books, and check in or out.
User can change the password and other profile details.
User can add the books.
These are some of the common features expected from the library management system.
So you now have some test scenarios to check for. In addition to these test scenarios,
you have GUI based software to check for the bugs, usability and functionality.
LOGIN TEST:
SL.No Test Case Excepted Result Test
Result
1 Enter valid name and password &
click on ok button
Software should display
main window
Successful
2 Enter invalid name and password User name and password
not correct
successful
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 141/144
Library Management System
140
ISSUE BOOK TEST:
SL.No Test Case Excepted Result Test
Result
1 Enter invalid IDmember
Software should display invalidmember id
Successful
2 Enter valid ID member
and ID book
Software check if available book
or not to issue book
successful
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 142/144
Library Management System
141
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 143/144
Library Management System
142
Conclusion and future enhancement
This project was developed to fulfill user and business requirement; however there are
lots of scopes to improve the performance of the Library Management System in the
area of user interface, database performance, and query processing time. Etc.
So there are many things for future enhancement of this project. The future
enhancements that are possible in the project are as follows.
In any system there is always chance for its enhancement and extension.
This system can also be enhanced with the change facilities.
More facilities can be added to the system for its growth. There is always scope for enhancements in any system, especially in the ever
changing world of computers. Linking and integration of any legacy system for
accounting.
Integration with LMS database through Web Services
Connection to third-party OLAP applications
Implement Bar code reader
Web interface for members
In the area of data security and system security.
Provide more online tips and help.
To optimize the query which is embedded in the system.
7/21/2019 Library System
http://slidepdf.com/reader/full/library-system-56da4222401a1 144/144