You are on page 1of 95

1

1. INTRODUCTION

1.1 OVERVIEW:

Library project system that offers many flexible and convenient features, allowing librarians
and li- brary users to maximize time and efficiency. Library System gives the all detailed
information about students, staff 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.

1.2 Objective:

Library management software where admin can add/view/delete librarian and librarian
can add/view books, issue, view issued books and returnbooks.

1.2.1 Users of the System


Librarian

1.2.2 Functional Requirement


1. Librarian

a) Add Member
b) Add Books
c) Issued books
d) Return Books
e) View & Print Issued List
f) View & Print Pending List
2

Tools to be used:

 Use any IDE to develop the project. It may be Eclipse /My eclipse / Net beans etc.
 MariaDB for thedatabase.

1.2.3 Front End and BackEnd:


1. Front End: JavaSwing
2. Back End: MariaDB

1.3: SCOPE

What is the scope of library management system?

The system accepts the General Library Transactions of book issue, return and
renewals for the mem- bers. Different areas where we can use these applications are:
Any educational institutes can make use of it for providing information about author,
content of the available books.
Thesystemwouldprovidebasicsetoffeaturestoadd/updatemembers,add/updatebo
oks,andmanage check in specifications for the systems based on the client's statement
ofneed.
3

2. LITERATURE SURVEY

JavaisaprogramminglanguageandcomputingplatformfirstreleasedbySunMicro systemsin1995.
TherearelotsofapplicationsandwebsitesthatwillnotworkunlessyouhaveJavainsta
ofapplicationsandwebsitesthatwillnotworkunlessyouhaveJavainsta lled,andmore
are created every day. Java is fast, secure, and reliable. From laptops to datacenters, game
consoles to scientific supercomputers, cell phones to the Internet, Java iseverywhere!
Java is a programming language and a platform Independed.
Java is a high level, robust, object
object-oriented
oriented and secure programming language. Platform: Any
hardware or software environment in which a program runs, is known as a platform. Since
Java has a runtime
ime environment (JRE) and API, it is called a platform. Oops concept (object-
(object
oriented programming system):
Object means a real-world
world entity such as a pen, chair, table, computer, watch, etc. Object-
Oriented
Programmingisamethodologyorparadigmtodesign
Programmingisamethodologyorparadigmtodesignaprogramusingclassesandobj
aprogramusingclassesandobj
ects.Itsimplifies the software development and maintenance by providing someconcepts:

 Object
 Class
 Inheritance
 Polymorphism
 Abstraction
 Encapsulation

Fig. 2(i) 3
4

Object

Fig. 2(ii)

2.1.1 Object:

Any entity that has state and behavioris known as an object.For example a
chairpen,table,keyboard,
yboard, bike, etc. It can be physical orlogical.
An Object can be defined as an instance of a class. An object contains an address and takes up
some space in memory. Objects can communicate without knowing the details of each other's
data or code. The onlyy necessary thing is the type of message accepted and the type of response
returned by the objects.

Example: A dog is an object because it has states like color, name, breed, etc.
as well as behaviors like wagging the tail, barking, eating, etc.

2.1.2 Class:

Collection of objects is called class. It is a logical entity.


Aclasscanalsobedefinedasablueprintfromwhichyoucancreateanindividualobjec t.Classdoesn't
consume anyspace.
5

1.2.3 Inheritance:

When one object acquire sall the properties and behavior so faparent object,it is
known as inheritance. It provides code reusability. It is used to
achieve

Runtime polymorphism.

Fig.2(iii)

1.2.4 Polymorphism:

If one task is performed by different ways ,it is known as polymorphism. For example: to
convince the customer differently, to draw something, for example, shape, triangle, rectangle,etc.
In Java, we use method overloading and method overriding to achieve polymorphism.
Another example can be to speak something; for example, a cat speaks meow, dog barks woof,
etc. Abstraction:
Hiding internal details and showing functionality is known as abstraction. For example phone
call, we don't know the internal processing. In Java, we use abstract class and interface to
achieve abstraction.
6

2.1.6 Encapsulation:

Binding (or wrapping) code and data together into a single unit are known as encapsulation
encapsulation. For ex-
ample capsule, it is wrapped with different medicines.
A java class is the example of encapsulation. Java bean is the fully encapsulated class because all
the data members are private here.

Fig .2(iv)

1.3 MariaDB:

Maria DB is an open source relational database management sy system (DBMS


DBMS) that is acompatible
drop- in replacement for the widely used MySQL database technology. It was created as a
software fork of MySQL by developers w who
ho played key roles in building the original database; they
devised MariaDB in 2009 in response to Oracle Corp.'s acquisition of MySQL.
MariaDB is based on SQLand nd supports ACID-styledata
ata processing with guaranteed atomicity, con-
con
sistency, isolation and durability for transactions. Among other features, the database also supports
JSON APIs, Is, parallel data replication and multiple storage engines, including InnoDB, MyRocks,
Spi- der, Aria, TokuDB, Cassandra and MariaDB ColumnStore.
The MariaDB software runs on Windows, Linux and macOS operating systems; it's available
onIntel and IBM Power88 hardware platforms, and runs as a service on several cloud platforms.
Supported programming languages include C++, C#, #, Java, Python andothers.
andothers
Its lead developer is Michael "Monty" Widenius, one of the founders of MySQL AB and the founder
ofMontyProgramAB.
On16January2008,MySQLABannouncedthat ithadagreedtobeacquired by Sun Microsystems for
approximately $1 billion. Thee acquisition completed on 26 February 2008. MariaDB is named after
Monty's younger daughter Maria, similar to how MySQL is named after his other daughterMy
7

MariaDB is developed by original developers of MySQL after concerns raised by Oracle's acquisition
of MySQL.

MariaDB is a relational database management system. It stores data in various tables. Primary keys
and foreign keys are used to establish relationship between these tables.

Relational database management syatem provides the following features:

 RDBMS facilitates you to implement a data source with tables, columns, andindices.

 RDBMS provides integrity of references across rows of multipletables.

 It is used to automatically updateindices.

 It is used to interpret SQL queries and operations in manipulating or sourcing data fromtable

3.SYSTEMSANALYSIS

3.1 INTRODUCTION :

Introduces the systems development life cycle (SDLC), the fundamental fourphase model
(planning, analysis, design, and implementation) common to all information systems development
8

projects. It describes the evolution of system development methodologies and discusses the roles
and skills re- quired of a systems analyst. The chapter then overviews the basic characteristics of
objectoriented systems and the fundamentals of object-oriented systems analysis and design and
closes with a de- scription of the Unified Process and its extensions and the Unified Modelling
Language.

3.1.1 OBJECTIVES:

 Understand the fundamental systems development life cycle and its four
Phases.

 Understand the evolution of systems developmentmethodologies.

 Be familiar with the different roles played by and the skills of a systems
Analyst.

 Be familiar with the basic characteristics of object-orientedsystems.

 Be familiar with the fundamental principles of object-oriented systems


analysis anddesign.

 Be familiar with the Unified Process, its extensions, and the Unified
ModelingLanguage.

1. BusinessAnalyst
2. SystemsAnalyst
3. InfrastructureAnalyst 4. Change Management...
9

3.2 Feasibility study:

What is a Feasibility Study?

A feasibility study is an analysis used in measuring the ability and likelihood to complete a project
successfully including all relevant factors. It must account for factors that affect it such as economic,
technological, legal and scheduling factors. Project managers use feasibility studies to determine po- tential
positive and negative outcomes of a project before investing a considerable amount of time and money into
its BREAKING DOWN Feasibility Study.

For example, a small school looking to expand its campus might perform a feasibility study to deter- mine if
it should follow through,considering material and laborcosts,how disruptive the project would be to the
students, the public opinion of the expansion, and laws that might affect the expansion.

A feasibility study tests the viability of an idea, a project or even a new business. The goal of a feasibility
study is to emphasize potential problems that could occur if one pursues a project and determine if, after
considering all significant factors, the project is a good idea. Feasibility studies also allow a business to
address where and how it will operate, potential obstacles, competition and the funding needed to get the
business up and running.

3.2.1 Importance of FeasibilityStudies:

Feasibility studies allow companies to determine and organize all the detail stomake a business work. A
feasibility study helps identify logistical problems, and nearly all business-related problems and their
solutions. Feasibility studies can also lead to the development of marketing strategies that convince
investors or a bank that investing in the business is a wisechoice.

3.2.2 Components of a FeasibilityS


There are several components of a feasibility study:

Description: A layout of the business, the products and services it will offer, and how it will
deliver them. Market feasibility : Description of the industry, the current and future market
potential, competition, sales estimations and prospective buyers.

Technical feasibility:
The details on how a company will deliver goods or services, including trans- portation, business
location, technology needed, materials and labor.
10

Financial feasibility: A projection of the amount of funding or startup capital needed, what
sources of capital a business can and will use, and what is the return on investment.

Organizational feasibility:
A definition of the corporate and legal structure of the business. This may include information
about the founders,the irprofessional background and the skill they possess necessary to get the
company off the ground and keep itoperational.

SystemStudy:
What is system study?

This is a Service we provide ahead of the Application Development/


Customization to conduct a de- tailed study. It involves studying a procedure or business in order to
identify its goals and purposes and create systems and procedures that will achieve them in an
efficient way. Use cases are a widely used systems analysis modeling tool for identifying and
expressing the functional requirements of a system. Each use case is a business scenario or event for
which the system must provide a defined response. Use cases evolved out of object-oriented
analysis.

Systems Analysis (according to the Waterfall model) would constitute the following steps:

The development of a feasibility study, involving determining whether a project is economi- cally,
socially, technologically and organizationallyfeasible.

Conducting fact-finding measures, designed to ascertain the requirements of the system's end- users.
These typically span interviews, questionnaires, or visual observations of work on the
existingsystem.

This exercise helps our consultants understand the limitations in the existing System and analyze the
process gaps the knowledge of which can be used to design the new system, including the develop-
ment of System Requirements Specifications (SRS) which provide a basis for the development of
the Application.

Preliminary system study is the first stage of system development life cycle. This is a brief
investiga- tion of the system under consideration and gives a clear picture of what actually the
11

physical system is? In practice, the initial system study involves the preparation of a System
proposal which lists the Problem Definition ,Objective so fthe Study,andTerm so freference for
Study,Constraints,Expected benefits of the new system, etc. in the light of the user requirements.
The system proposal is prepared by the System Analyst (who studies the system) and places it
before the user management. The man- agement may accept the proposal and the cycle proceeds to
the next stage. The management mayalso reject the proposal or request some modifications in the
proposal. In summary, we would say that system study phase passes through the followingsteps:

 Problem identification and projectinitiation


 Backgroundanalysis
 Inference orfindings

3.3 ExitingSystem:

What is Existing System?


12

This activity relies on knowledge of the hardware, software, workload, and monitoring
tools associ- ated with the system under study. It also requires access to
information recorded by accounting and software monitors during system operation. Here, we
describe general approaches applicable to a va- riety of systems. In Chapter 17, we illustrate
these approaches with an example based on a specific system (IBM’s MVS) and a specific
monitoring tool (RMF).

In Chapter 4 we divided the inputs of queuing network models into three groups: the
customer description, the center description, and the service demands.The structure of the present
chapter reflects this division. Section 12.3 is devoted to the customer description: the
correspondence of theworkload components of the system to the customer classes of the model. In
specifying the values of the cus- tomer description parameters, we are answering questions such as:
- How many customer classes are

required? - Of what type (transaction, batch, or terminal) should each class be? - What should be the
workload intensity value (A, N, or N and Z) for each class? Section 12.4 is devoted to the center
description: the correspondence of the resources of the system to the service centers of the model.
In specifying the values of the center description parameters ,we are answering questions such as:-
What devices and subsystems should be included in the model? - How should each of these
entities be rep- resented (e.g., as a queuing center, a delay center, or an FESC)? Section 12.5 is
devoted to the service demands:the description of what proportion of the measure dus age of each
device should be attributed to the customers of eachclass?

We precedet he set here sections,in Section12.2,with a survey of the information used to


parameterize queuing network models: its types, its sources, and how it can be managed. We follow
these sections, in Section12.6,with a discussion of the validation of baseline models,indicating
reasonable tol erances for various performance measures. There is little reason to construct a model of
13

an existing system unless this model to project performance for an evolving system (the subject of
Chapter 13). Our (somewhat model is to be used for performance projection. Consequently, we
cannot completely sep- arate the task of constructing a baseline model of an existing system (the
subject of this chapter) from the task of using artificial) separation between the two tasks will be the
following: problems thatarise from limitations or shortcomings of current monitoring tools and
techniques will be treated in this chapter, while problems that would persist even with ideal
monitoring capabilities will be deferred to the nextchart.
14

• ProposedSystems

What is Proposed System?

Introduction the preceding two chapter shave discussed the parameterization of queuing network
mod- elso fexisting system sand evolving systems. In this chapter we consider model so proposed
systems: major new systems and subsystems that are under going design and implementation. The
process of design and implementation involves continual tradeoffs between cost and performance.
Quantifying the performance implications of various alternative siscentral to this process .It also is
extremely chal- lenging .In the case of existing systems ,measurement data is available .In the case
of evolving systems, contemplated modifications often are straightforward (e.g., a new CPU within
a product line), and limited experimentation may be possible in validating a baseline model. In the
case of proposed sys- tems, these advantages do not exist. For this reason, it is tempting to rely on
seat-of-the-pants perfor- mance projections, which all too often prove to be significantly inerror.

The consequences can be serious, for performance, like reliability, is best designed in, rather than
added on. Recently, progress has been made in evolving a general framework for projecting the
per- formance of proposed systems. There has been a confluence of ideas from software
engineering and performance evaluation ,with queuing network model splaying a central role.The
purpose of this chapter is to present the elements of this framework. In Section 14.2 we review
some early efforts. In Section 14.3 we discuss, in a general setting, some of the components
necessary to achieve a good understanding of the performance of a proposed system. In Section
14.4 we describe two specific approaches.

3.1.2 Background:

Background User satisfaction with a new application system depends to a significant extent on
the system’s ability to deliver performance that is acceptable and consistent. In this section we
describe several early attempts at assessing the performance of large systems during the design stage.
Some common themes will bee vident ;the se will be discussed in then extsection .In the
mid1960sGECOS III was being designed by General Electric as an integrated batch and timesharing
15

system. After the initial design was complete,two activities be ganin parallel:one team began the
implementation,while another developed a simulation model to project the effects of subsequent
design and implementation decisions.

4. System RequirementSpecification

4.1 HardwareRequirement:

The following table the recommended hardware requirement.

Com Minimu Recomm


ponen t m ended

Proc 2.5 Dual


essor gigahertz(GHz) processors that
are each
3 GHz or
faster
RA 1 2 GB
M gigabyte(G
B)
16

5. SYSTEM DESIGN
5.1 Data FlowDiagram:

Data flow oriented techniques advocate that the major data items handled by a system must be first
identifiedandthentheprocessingrequiredonthesedataitemtoproducethedesiredoutputsshouldbe
determined. The DFD (also called as bubble chart) is a simple graphical formalism that can be used
to represent a system in terms of input data to the system in terms of input data to the system,
various processing carried out on these data , and the output generated by the system . it was
introduced by de-Macro(1978). The primitive symbols used for constructing DFD’are:

5.1.1 Symbols used in DFD:

A circle represent a process

A rectangle represents external entity

A square defines a source or destination of the system data

An arrow identifies data flow

Fig.5(i)
17

Data Flow Dia- gram

Success-
Add Book
ful

Librarian Login
View
Book

Issue
Fasl Book
e Data

View Is- base


sue Book
Login
Table

Return
Book

Logout

Fig .5(ii)
5.2 E-R DIAGRAM
18 Add Member
Pass-
Add Book

ID Borrow
True
Login
Return Book

All Member

All Book
False
Lend History

Fig.5(iii)
19

6. SNAPSHOTS

6.1 Librarian loginpage:

6.2 Homepage
20

6.3 AddMember

6.4 AddBook
21

6.4 BorrowBook

6.5 ReturnBook
22

6.6 All book details

6.6 All Member Details


23

6.7 LendHistory
24

7 .DATABASEDESIGN

A database is an organized mechanism that has the capability of storing information through which a
user can retrieve stored information in an effective and efficient manner .The data is the purpose of any
database and must be protected.

The database is design is a two level process. In the first step, user requirements are gatheredtogether
andadatabaseisdesignedwhichwillmeettheserequirementsasclearlyaspossible.T hisstepiscalled
Information level Design and it is taken independent of any individual Database ManagementSystem
(DBMS).

In the Second Step, this Information level design is transferred into a design for the specific DBMS that
will be used to implement the system in question.
This step is called Physical Level Design, con-
cernedwiththecharacteristicsDBMSthatwillbeused.Adatabasedesignrunsparalle
lwiththesystem design. The organization of the data in the database is aimed to achieve the following
two major ob- jectives.

7.1 DATABASE TABLEDESIGN:

7.1.1 TABLE NAME:

AddMember
25

7.1.2 TABLE NAME: BookLend

7.1.2 TABLE NAME:


BookReturn
26

7.1.3 TABLE NAME:


AddBooks
27

7. Impelimentation

8.1 SourceCode
(Login)

package Interface;

import javax.swing.JOptionPane; public class Login extends javax.swing.JFrame {

public Login() { initComponents();


}

@SuppressWarnings("unchecked")
// <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() ; txtuname = new
javax.swing.JTextFie
ld();
txtpword = new javax.swing.JPasswordFi eld(); jButton1 = new javax.swing.JButton(); jButton2 =
new javax.swing.JButton(); jLabel3 =
newjavax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants. EXIT_ON_CLOSE);
jLabel1.setText("User Name");
jLabel2.setText("Password");
jButton1.setIcon(new javax.swing.ImageIcon
("D:\\library I mage\\lock.png")); // NOI18N j Button1 .
jButton1.addActionListener(new java.awt.event.ActionListener()
{publicvoidactionPerformed(java.awt.event.
ActionEvent) { jButton1
ActionPerformed(evt);}

jButton2.setIcon(new javax.swing.ImageIcon("D:\\library image\\cancel1.png")); // NOI18N


jButton2.setText("Cancel"); jButton2.addActionListener(new java.awt.event.ActionListener() { public
void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt)}});

jLabel3.setIcon(new javax.swing.ImageIcon("D:\\library image\\boy.png")); // NOI18N


jLabel4.setIcon(new javax.swing.ImageIcon("D:\\library image\\key.png")); // NOI18N

javax.swing.GroupLayout jPanel1Layout = new


javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Align
ment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(24, 24, 24)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.Gro
upLayout.Align- ment.LEADING)
28

.addComponent(jLabel1)
.addComponent(jLabel2))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.Gro
upLayout.Align- ment.LEADING, false)
.addComponent(txtuname,
javax.swing.GroupLayout.PREFERRED_SIZE, 231, ja-
vax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacemen
t.RELATED, ja- vax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jButton2))
.addComponent(txtpword,
javax.swing.GroupLayout.PREFERRED_SIZE, 231, ja-
vax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNREL
ATED)
.addGroup( jPanel1Layout.createParallelGroup(javax.swing.Gro
upLayout.Align- ment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addContainerGap(38, Short.MAX_VALUE))); jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Align ment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(57, 57, 57)

addGroup(jPanel1Layout.createParallelGroup( javax.swing.GroupLayo
ut.Alignment.LEADING).addComponent(jLabel3,javax.swing.GroupL ayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout
Align- ment.BASELINE).addComponent(jLabel1).addComponent(txtuname,
javax.swing.GroupLayout.PREFERRED_SIZE, 35, ja-
vax.swing.GroupLayout.PREFERRED_SIZE))).addGap(35, 35, 35)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.G
roupLayout.Align- ment.LEADING).addComponent(jLabel4,
javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout. Align-
ment.BASELINE).addComponent(txtpword, javax.swing.GroupLayout.PREFERRED_SIZE, 35, ja-
vax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel2)))
addGap(33, 33, 33)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayo ut.Align-
ment.BASELINE).addComponent(jButton1)
.addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE,
41, ja- vax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(32, Short.MAX_VALUE))); javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L EADING).addComponent(jPanel1,
javax.swing.GroupLayout.DEFAULT_SIZE, ja-
29

vax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE)) ; layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L
EADING).addComponent(jPanel1,
javax.swing.GroupLayout.DEFAULT_SIZE, ja-
vax.swing.GroupLayout.DEFAULT_SIZE,Short.MAX_VALUE));
setLocation
Rel
ativeTo(null
);
}//</editor-fold>

private void
jButton2ActionPerformed(java.awt.event.ActionEve nt evt) { System.exit(0);
}

private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String uname=txtuname.getText(); String pword=txtpword.getText();
if(uname.equals("admin")&&pword.equals(
"1234"))
{
Home ho=new Home(); ho.setVisible(t rue);
this.dispose();
} else {
JOptionPane.showMessageDialog(rootPane, "User name or password incorrect");
}
}

/**
* @param args the command line arguments
*/ public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If
Nimbus (introduced in Java SE 6) is not available, stay with the default look andfeel. * For details
seehttp://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
{ for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.get- InstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClass Name()); break;}}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging. Level.SE-VERE, null,
ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging. Level.SE-VERE, null,
ex);
30

} catch (IllegalAccessException ex) {


java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.
Level.SE-VERE, null, ex);} catch
(javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging. Level.SE-VERE, null,
ex);
}
//</editor-fold>
/*Createanddisplaythefo*/ java.awt.EventQueue.invo keLater(new Runnable() {
public void run() { new Login().setVisible(true);}});}+
//
Variablesdeclarationdonomodi fy private javax.swing.JButton jButton1; private
javax.swing.JButton jButton2;
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;
private javax.swing.JPasswordField txtpword; private javax.swing.JTextField
txtuname;
// End of variables declaration
}
(Home)

package Interface;

importcom.mysq l.jdbc.Connectio n; import


java.util.Calenda
r;
import java.util.Gregori anCalendar; import javax.swing.JOp tionPane;/****
@auth/
public class Home extends javax.swing.JFrame {/**
* Creates new form Home*/Connection conn=null;public Home()
{ initComponents(); clock();conn=DBConnect.connect();}
/**
* This method is called from within the constructor to initialize theform. *
WARNING: Do NOT modify this code. The content of this method isalways *
regenerated by the FormEditor.
*/ @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code"> private void
initComponents() {

jToolBar2 = new javax.swing.JToolBar(); jPanel1 = new javax.swing.JPanel();


jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jButton3 =
new javax.swing.JButton(); jButton4 = new javax.swing.JButton(); jLabel4 = new
javax.swing.JLabel(); lbltime = new javax.swing.JLabel(); lbldate = new
javax.swing.JLabel(); jLabel1 = newjavax.swing.JLabel();
homeDesktop = new javax.swing.JDesktopPane(); jLabel2 =
newjavax.swing.JLabel();
jLabel3 = new javax.swing.JLabel(); jToolBar1 = new
javax.swing.JToolBar(); jButton7 = new javax.swing.JButton(); jButton5 = new
javax.swing.JButton(); jButton8 = new javax.swing.JButton();

30
30

jToolBar2.setRollover(true);
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE

); jPanel1.setMinimumSize(new java.awt.Dimension(1200, 650));


jPanel1.setPreferredSize(new java.awt.Dimension(1200, 650)); jPanel1.setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());

jButton1.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jButton1.setText("Borrow");
jButton1.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt);
}
}); jPanel1.add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10,
170, 270, 50));

jButton2.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jButton2.setText("Return");
jButton2.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {


jButton2ActionPerformed(evt);
}
});
jPanel1.add(jButton2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 350,
270, 50));

jButton3.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jButton3.setText("Add Members");
jButton3.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt);
}
});
jPanel1.add(jButton3, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 530,
270, 50));

jButton4.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jButton4.setText("Add Books");
jButton4.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) { jButton4ActionPerformed(evt);
31

}
});
jPanel1.add(jButton4, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 720,
270, 50));

jLabel4.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N


jLabel4.setText("PRASAD POLYTECHNIC LIBRARY
MANAGAMENTSYSTEM");
jPanel1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(40, 49, -
1,40));

lbltime.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N


jPanel1.add(lbltime, new org.netbeans.lib.awtextra.AbsoluteConstraints(1140, 50,
180, 30));

lbldate.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N


jPanel1.add(lbldate, new org.netbeans.lib.awtextra.AbsoluteConstraints(860, 50, 180,
30));

top);
2
)
)
; j vax.swing.BorderFactory.createLineBorder(new
L java.awt.Color(0, 0, 0),
a
b jPanel1.add(jLabel1, new e
l org.netbeans.lib.awtextra.AbsoluteConstraints(0, 40, 1550,
1
. 50)); javax.swing.GroupLayout homeDesktopLayout = new s
e javax.swing.GroupLayout(homeDesk- t
B homeDesktop.setLayout(homeDesktopLayout); o
homeDesktopLayout.setHorizontalGroup( r
homeDesktopLayout.createParallelGroup(javax.swing.Group d
Layout.Alignment.LEADING)
e .addGap(0, 0, Short.MAX_VALUE) r ( j
a
);
homeDesktopLayout.setVerticalGroup(
homeDesktopLayout.createParallelGroup
(javax.swing.GroupLayout.Alignme nt.LEADING)
.addGap(0, 0, Short.MAX_VALUE) jPanel1.add(homeDesktop, new
org.netbeans.lib.awtextra.AbsoluteConstraints(300, 100, 1250,
720));
jLabel2.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0),2));
jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 40,
1560,790));
32

jLabel3.setBorder(javax.swing.BorderFactory.createLineBorde
2 r(new java.awt.Color(0, 0, 0),
)
) jPanel1.add(jLabel3, new
;
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 90, 290,

730)); jToolBar1.setRollover(true);
jToolBar1.setPreferredSize(new java.awt.Dimension(1200,
40));

jButton7.setFont(new java.awt.Font("Times New Roman", 1,


24)); // NOI18N jButton7.setText("All Books"); jButton7.setAlignmentX(3.0F);
jButton7.setFocusable(false);
jButton7.setHorizontalTextPosition(javax.swing.SwingConsta
nts.CENTER); jButton7.setMaximumSize(new
java.awt.Dimension(140, 30));
jButton7.setVerticalTextPosition(javax.swing.SwingConstants. BOTTOM);
jButton7.addActionListener(new
java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
}};
jToolBar1.add(jButton7);
jButton5.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N
jButton5.setText("All Members");
jButton5.setAlignmentX(3.0F); jButton5.setFocusable(false);
jButton5.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButton5.setMaximumSize(new java.awt.Dimension(140, 30));
jButton5.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
jButton5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt); }
});
jToolBar1.add(jButton5);

jButton8.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jButton8.setText("Lend Histry");
jButton8.setAlignmentX(3.0F); jButton8.setFocusable(false);
jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
jButton8.setMaximumSize(new java.awt.Dimension(140, 30)); jToolBar1.add(jButton8);

jPanel1.add(jToolBar1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0,


1190, 40));
33

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.Alignment.TRAILING, ja-
vax.swing.GroupLayout.DEFAULT_SIZE, 1566, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, ja-
vax.swing.GroupLayout.DEFAULT_SIZE, 831, Short.MAX_VALUE)
);

pack(); }// </editor-fold>

public void clock()


{
Thread clock; clock = new Thread()
{
public void run()
{ try { while(true)
{
Calendar cal =new GregorianCalendar(); int day
=cal.get(Calendar.DAY_OF_MONTH); int manth=cal.get(Calendar.MONTH)+1;
int year=cal.get(Calendar.YEAR);
int second=cal.get(Calendar.SECOND); int
minute=cal.get(Calendar.MINUTE); int hour=cal.get(Calendar.HOUR);
lbltime.setText(hour +":"+ minute +":"+ second); lbldate.setText(year +"-"+ manth +"-"+
day); sleep(1000);
}}
catch(Exception e)
{
JOptionPane.showMessageDialog(rootPane, e);
} }; clock.start();

} private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {


homeDesktop.removeAll();
AddBook ab=new AddBook(); homeDesktop.add(ab).setVisible(true);

private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {


homeDesktop.removeAll();
AddMembers ad=new AddMembers(); homeDesktop.add(ad).setVisible(true);

}
34

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {


homeDesktop.removeAll();
Borrow br=new Borrow(); homeDesktop.add(br).setVisible(true);

} private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

homeDesktop.removeAll(); Return rn=new Return();


homeDesktop.add(rn).setVisible(true);

private void jButton7ActionPerformed(java.awt.event.ActionEvent evt) {


homeDesktop.removeAll();
Allbooks ab=new Allbooks(); homeDesktop.add(ab).setVisible(true); }

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {


homeDesktop.removeAll();
Allmember am=new Allmember(); homeDesktop.add(am).setVisible(true); }

private void jButton8ActionPerformed(java.awt.event.ActionEvent evt) {


homeDesktop.removeAll();
35

LendHistry lh=new LendHistry();


homeDesktop.add(lh).setVisible( true); }

/**
* @param args the command linearguments
*/ public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If
Nimbus (introduced in Java SE 6) is not available, stay with the default look andfeel. * For details
seehttp://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html *
/ t
r
y

{ for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.get- InstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName()); break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.S E-
VERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.S E-
VERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.S E-
VERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.S E-VERE,
null, ex);}
//</editor-fold>/* Create and display the form */ java.awt.EventQueue.invokeLater(() -> { new
Home().setVisible(true);
});}

// Variables declaration - do not modify


private javax.swing.JDesktopPane homeDesktop; private javax.swing.JButton jButton1; private
javax.swing.JButton jButton2; private javax.swing.JButton jButton3; private javax.swing.JButton
jButton4; private javax.swing.JButton jButton5; private javax.swing.JButton jButton7; private
javax.swing.JButton jButton8; private javax.swing.JLabel jLabel1; private javax.swing.JLabel
jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private
36

javax.swing.JPanel jPanel1; private javax.swing.JToolBar jToolBar1; private javax.swing.JToolBar


jToolBar2; private javax.swing.JLabel lbldate; private javax.swing.JLabel lbltime;
// End of variables declaration
}

(Data Base Connectivity)

package Interface;

import com.mysql.jdbc.Connection; import java.sql.DriverManager; import


javax.swing.JOptionPane;

public class DBConnect { public static Connection connect()


{
Connection conn=null; try
{
Class.forName("com.mysql.jdbc.Driver"); conn=(Connection)
DriverManager.getConnection("jdbc:mysql://localhost:3306/li- brary?","root","");
//JOptionPane.showMessageDialog(null,"connection success");
} catch(Exception e) {
JOptionPane.showMessageDialog(null,e);

(Borrow)

package Interface;

import com.mysql.jdbc.Connection; import java.awt.HeadlessException; import


java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import
java.time.LocalDate; import java.time.temporal.ChronoUnit; import javax.swing.JOptionPane; import
javax.swing.JTextField;

/**
37

*
* @author dheeru
*/
public class Borrow extends javax.swing.JInternalFrame {

/**
* Creates new form Borrow
*/
Connection conn=null; PreparedStatement pst=null; ResultSet rs=null;

public Borrow() { initComponents(); conn=DBConnect.connect(); autoId();


LocalDate today= LocalDate.now();
LocalDate reday=today.plus(15,ChronoUnit.DAYS); txtidate.setText(today.toString());
txtredate.setText(reday.toString()); tablelord();
}

/**
* This method is called from within the constructor to initialize theform. * WARNING:
Do NOT modify this code. The content of this method isalways * regenerated by the FormEditor.
*/

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents()
{

jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new


javax.swing.JLabel(); txtmid = new javax.swing.JTextField(); txtmname = new
javax.swing.JTextField(); txtmtype = new javax.swing.JTextField(); jLabel3 = new
javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel();
jLabel12 = new javax.swing.JLabel(); txtbid = new javax.swing.JTextField(); txtbname = new
javax.swing.JTextField(); txtbtype = new javax.swing.JTextField(); jLabel4 = new
javax.swing.JLabel(); txtrno = new javax.swing.JButton(); jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton(); jLabel5 = new javax.swing.JLabel(); jLabel13 = new
javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); txtidate = new
38

javax.swing.JTextField(); txtredate = new javax.swing.JTextField(); jLabel6 =


newjavax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane(); tbllend = new javax.swing.JTable();
jLabel2 = new javax.swing.JLabel(); jLabel1 = newjavax.swing.JLabel(); jScrollPane2 = new
javax.swing.JScrollPane(); jList1 = newjavax.swing.JList<>();

setClosable(true);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

jLabel7.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jLabel7.setText("Member ID"); getContentPane().add(jLabel7, new
- org.netbeans.lib.awtextra.AbsoluteConstraints(30, 60, 120,
1
)
)
;

jLabel8.setFont(new java.awt.Font("Times New Roman", 1,


24)); // NOI18N jLabel8.setText("Name"); getContentPane().add(jLabel8, new
- org.netbeans.lib.awtextra.AbsoluteConstraints(30, 130, 80,
1
)
)
;

jLabel9.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jLabel9.setText("Member Type");

getContentPane().add(jLabel9, new
org.netbeans.lib.awtextra.AbsoluteConstraints(30, 210, 150, -1));

txtmid.addActionListener(new java.awt.event.ActionListener() { public void


actionPerformed(java.awt.event.ActionEvent evt) { txtmidActionPerformed(evt);
}
}); txtmid.addKeyListener(new java.awt.event.KeyAdapter() { public void
keyReleased(java.awt.event.KeyEvent evt) { txtmidKeyReleased(evt);
}
});
getContentPane().add(txtmid, new
5 org.netbeans.lib.awtextra.AbsoluteConstraints(190, 40, 230, 0
)
)
;
39

txtmname.setEditable(false); getContentPane().add(txtmname, new


org.netbeans.lib.awtextra.AbsoluteConstraints(190, 120, 230, 50));

txtmtype.setEditable(false); getContentPane().add(txtmtype, new


org.netbeans.lib.awtextra.AbsoluteConstraints(190, 200, 230, 50));

jLabel3.setBorder(javax.swing.BorderFactory.createLineBorde
2 r(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel3, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, 410,
240));

jLabel10.setFont(new java.awt.Font("Times New Roman", 1,


24)); // NOI18N jLabel10.setText("Book ID"); getContentPane().add(jLabel10,
new
- org.netbeans.lib.awtextra.AbsoluteConstraints(480, 50, -1,
1
)
)
;

jLabel11.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jLabel11.setText("Name"); getContentPane().add(jLabel11, new
org.netbeans.lib.awtextra.AbsoluteConstraints(480, 130, - 1, -1));

jLabel12.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jLabel12.setText("Book Type"); getContentPane().add(jLabel12, new
org.netbeans.lib.awtextra.AbsoluteConstraints(480, 210, - 1, -1));

txtbid.addKeyListener(new java.awt.event.KeyAdapter() { public void


keyReleased(java.awt.event.KeyEvent evt) { txtbidKeyReleased(evt);
}
});
2

jButton2.setFont(new java.awt.Font("Times New Roman", 3, 24)); // NOI18N


jButton2.setText("Clear");
jButton2.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt);
}
}); getContentPane().add(jButton2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(860, 150, 260, 60));
40

jButton3.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jButton3.setText("Issue");
jButton3.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt);
}
}); getContentPane().add(jButton3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(860, 260, 260, 60));

jLabel5.setBorder(javax.swing.BorderFactory.createLineBorde
2 r(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel5, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(850, 20, 280,
330));

jLabel13.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jLabel13.setText("Issuse Date"); getContentPane().add(jLabel13, new
4 org.netbeans.lib.awtextra.AbsoluteConstraints(30, 292, -1, 0
)
)
;

jLabel14.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jLabel14.setText("Return Date"); getContentPane().add(jLabel14, new
org.netbeans.lib.awtextra.AbsoluteConstraints(430, 290, - 1, 40));

txtidate.setEditable(false); getContentPane().add(txtidate, new


org.netbeans.lib.awtextra.AbsoluteConstraints(160, 280, 250, 60));

txtredate.setEditable(false); getContentPane().add(txtredate, new


org.netbeans.lib.awtextra.AbsoluteConstraints(570, 280, 260, 60));

jLabel6.setBorder(javax.swing.BorderFactory.createLineBord
2 er(new java.awt.Color(0, 0, 0),
) getContentPane().add(jLabel6, new
) org.netbeans.lib.awtextra.AbsoluteConstraints(20, 270, 820,
;

8
0
)
)
;
41

tbllend.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));


tbllend.setFont(new java.awt.Font("Times New
Roman", 0, 14)); // NOI18N tbllend.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {}, new String [] {}));
jScrollPane1.setViewportView(tbllend);getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(20, 360, 1110, 300));

jLabel2.setBorder(javax.swing.BorderFactory.createLine
2 Borde r(new java.awt.Color(0, 0, 0),
) getContentPane().add(jLabel2, new
)
org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10,
;
1130,660)) ;
jLabel1.setBorder(javax.swing.BorderFactory.createLine
2 Bord( new java.awt.Color(0, 0, 0),
) getContentPane().add(jLabel1, new
) org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0,
1150,
680));; jList1.setModel(newjavax.swing.AbstractListModel<String>() { String[] strings =
{ "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; public int getSize() { return strings.length; }
public String getElementAt(int i) { return strings[i]; }
});
jScrollPane2.setViewportView(jList1);

getContentPane().add(jScrollPane2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(990, 390, -1, -1));

pack(); }// </editor-fold>

private void txtmidKeyReleased(java.awt.event.KeyEvent evt) { try


{
String sql="SELECT `name`,`type` FROM `addmember` WHERE
mid='"+txtmid.getText()+"'";
pst=(com.mysql.jdbc.PreparedStatement) conn.prepareStatement(sql); rs=pst.executeQuery();
if(rs.next()) {
txtmname.setText(rs.getString("name"));
txtmtype.setText(rs.getString("type"));

} else {
txtmname.setText(""); txtmtype.setText(""); }

}
catch(Exception e)
{
JOptionPane.showMessageDialog(rootPane, e);
}
42

private void txtbidKeyReleased(java.awt.event.KeyEvent evt) { try


{
String sql="SELECT `name`, `book_type` FROM `addbook` WHERE
bid='"+txt- bid.getText()+"'";
pst=(com.mysql.jdbc.PreparedStatement) conn.prepareStatement(sql); rs=pst.executeQuery();
if(rs.next()) {
txtbname.setText(rs.getString("name")); txtbtype.setText(rs.getString("book_type"));
} else {
txtbname.setText(""); txtbtype.setText(""); }

}
catch(Exception e)
{
JOptionPane.showMessageDialog(rootPane, e);
}}
private void tablelord()
{ try
{
String sql="SELECT `record_no`, `mid`, `bid`, `i_date`, `r_date` FROM
`booklend` "; pst=(com.mysql.jdbc.PreparedStatement) conn.prepareStatement(sql);
rs=pst.executeQuery();
tbllend.setModel(net.proteanit.sql.DbUtils.resultSetToTableModel(rs));
}
catch(Exception e)
{
JOptionPane.showConfirmDialog(rootPane,e);
}}
private void cleanFild()
{ txtmid.setText(""); txtmname.setText(""); txtbid.setText(""); txtbname.setText("");
txtmtype.setText(""); txtbtype.setText("");
}
private void update()
{try{
String sql="UPDATE `addbook` SET `mark`='1' WHERE bid='"+txtbid.getText()+"'";
pst=(PreparedStatement)conn.prepareStatement(sql); pst.execute();
JOptionPane.showMessageDialog(rootPane, "Update Success"); tablelord();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(rootPane, e); }
43

} private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { String


rno=txtrno.getText();
String mid=txtmid.getText(); String bid=txtbid.getText(); String
idate=txtidate.getText(); String rdate=txtredate.getText();

try{

String sql="INSERT INTO `booklend`(`record_no`, `mid`, `bid`,


`i_date`, `r_date`,mark) VALUES('"+rno+"','"+ mid+"','"+
bid+"','"+idate+"','"+rdate+"','0')";
PreparedStatement pst=(PreparedStatement)conn.prepareStatement(sql); pst.execute();
JOptionPane.showMessageDialog(rootPane, "successfully insert");
}
catch(Exception e) {

JOptionPane.showMessageDialog(rootPane, " SORRY BOOK ALLREDY


ISSUE "); }

update(); tablelord(); cleanFild(); autoId();


}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {


cleanFild();
}

private void txtmidActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your


handling code here:
}

private void autoId()


{ try
{
String sql="SELECT `record_no` FROM `booklend`ORDER
1 BY record_no DESC LIMIT
44

"
; pst=(com.mysql.jdbc.PreparedStatement)
conn.prepareStatement(sql); rs=pst.executeQuery(); if(rs.next())
{
String rnno=rs.getString("record_no"); int co=rnno.length(); String txt=rnno.substring(0,2);
String num=rnno.substring(2,co); int n=Integer.parseInt(num); n++;
String Snum=Integer.toString(n); String ftxt=txt+Snum; txtrno .setText(ftxt);

else {
txtrno.setText("RN1000");

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

// Variables declaration - do not modify private javax.swing.JButton jButton2; private


javax.swing.JButton jButton3; private javax.swing.JLabel jLabel1; private javax.swing.JLabel
jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private
javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; 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.JLabel jLabel9; private
javax.swing.JList<String> jList1; private javax.swing.JScrollPane jScrollPane1; private
javax.swing.JScrollPane jScrollPane2; private javax.swing.JTabletbllend;
private javax.swing.JTextField txtbid; private javax.swing.JTextField txtbname; private
javax.swing.JTextField txtbtype; private javax.swing.JTextField txtidate; private
javax.swing.JTextField txtmid; private javax.swing.JTextField txtmname; private
45

javax.swing.JTextField txtmtype; private javax.swing.JTextField txtredate; private


javax.swing.JButtontxtrno; // End of variables declaration
}

(Add Member)

package Interface;

import com.mysql.jdbc.Connection; import com.mysql.jdbc.PreparedStatement; import


java.awt.HeadlessException; importjava.sql.ResultSet;
import java.sql.SQLException; import javax.swing.JOptionPane;

import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
/**
*
* @author dheeru
*/
public class AddMembers extends javax.swing.JInternalFrame/**
* Creates new form AddMembers
*/
Connection conn=null; PreparedStatement pst=null; ResultSet rs=null; public AddMembers() {
initComponents(); conn=DBConnect.connect(); autoId(); tablelord();
} /**
* This method is called from within the constructor to initialize theform. * WARNING:
Do NOT modify this code. The content of this method isalways * regenerated by the FormEditor.
*/ @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents()
{ jLabel2 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new
javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jLabel11 = new
javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel();
46

jLabel8.setFont(new java.awt.Font("Times New Roman", 1,


24)); // NOI18N jLabel8.setText("DOB");
getContentPane().add(jLabel8, new
1 org.netbeans.lib.awtextra.AbsoluteConstraints(50, 260, -1, -
)
)
;

jLabel9.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jLabel9.setText("Gender");
getContentPane().add(jLabel9, new
1 org.netbeans.lib.awtextra.AbsoluteConstraints(50, 320, -1, -
)
)
;
47
48

jLabel10.setFont(new java.awt.Font("Times New Roman", 1, 24));


// NOI18N jLabel10.setText("Address"); getContentPane().add(jLabel10,
new
org.netbeans.lib.awtextra.AbsoluteConstraints(430, 110, - 1, -1));

jLabel11.setFont(new java.awt.Font("Times New Roman", 1, 24));


// NOI18N jLabel11.setText("Email"); getContentPane().add(jLabel11,
new
org.netbeans.lib.awtextra.AbsoluteConstraints(430, 180, - 1, -1));

jLabel12.setFont(new java.awt.Font("Times New Roman", 1, 24));


// NOI18N jLabel12.setText("Contac No");
getContentPane().add(jLabel12, new
org.netbeans.lib.awtextra.AbsoluteConstraints(430, 250, - 1, -1));

jLabel13.setFont(new java.awt.Font("Times New Roman", 1, 24));


// NOI18N jLabel13.setText("Member Type");
getContentPane().add(jLabel13, new
org.netbeans.lib.awtextra.AbsoluteConstraints(430, 310, - 1, -1));

txtmid.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
txtmidActionPerformed(evt);
}
});
getContentPane().add(txtmid, new
org.netbeans.lib.awtextra.AbsoluteConstraints(180, 100, 230, 40));
getContentPane().add(txtname, new
org.netbeans.lib.awtextra.AbsoluteConstraints(180, 150, 230, 40));
getContentPane().add(txtnic, new
org.netbeans.lib.awtextra.AbsoluteConstraints(180, 200, 230,
40));
cmbgender.setModel(new
javax.swing.DefaultComboBoxModel<>(new
String[] { "Selecte Gender", "Male", "Female", "Other" }));
cmbgender.addActionListener(new java.awt.event.ActionListener() {
public
void actionPerformed(java.awt.event.ActionEvent evt) {
cmbgenderActionPerformed(evt);
}
});
getContentPane().add(cmbgender, new
org.netbeans.lib.awtextra.AbsoluteConstraints(180, 310, 230, 40));
49

cmbmemtype.setModel(new
javax.swing.DefaultComboBoxModel<>(new String[] { "Select
Member
Type", "Student", "Teacher" }));
getContentPane().add(cmbmemtype, new
org.netbeans.lib.awtextra.AbsoluteConstraints(580, 300, 250, 40));
txtaddress.setColumns(20); txtaddress.setRows(5);
jScrollPane1.setViewportView(txtaddress);

getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(580, 90, 250, 60));

btndelete.setFont(new java.awt.Font("Times New Roman", 1, 24));


// NOI18N btndelete.setIcon(new
javax.swing.ImageIcon("C:\\Users\\dheeru\\Downloads\\rubbish-
bin.png")); // NOI18N btndelete.setText("Delete");
btndelete.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
btndeleteActionPerformed(evt);
}
}); getContentPane().add(btndelete, new
org.netbeans.lib.awtextra.AbsoluteConstraints(860, 290, 250, 50));

btnadd.setFont(new java.awt.Font("Times New Roman", 1, 24)); //


NOI18N btnadd.setIcon(new
javax.swing.ImageIcon("C:\\Users\\dheeru\\Downloads\\add.png"));
// NOI18N
btnadd.setText("Add");
btnadd.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
btnaddActionPerformed(evt);
}
});
getContentPane().add(btnadd, new
org.netbeans.lib.awtextra.AbsoluteConstraints(860, 100, 250, 60));
btnupdate.setFont(new java.awt.Font("Times New Roman", 1, 24)); //
NOI18N btnupdate.setIcon(new
javax.swing.ImageIcon("C:\\Users\\dheeru\\Downloads\\refresh.png
"));
// NOI18N
btnupdate.setText("Update");
btnupdate.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
btnupdateActionPerformed(evt);
50

}
});
getContentPane().add(btnupdate, new
org.netbeans.lib.awtextra.AbsoluteConstraints(860, 190, 250, 60));

jLabel14.setBorder(javax.swing.BorderFactory.createLineBord
2 er(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel14, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(850, 90,
270, 260)); getContentPane().add(datebath, new
org.netbeans.lib.awtextra.AbsoluteConstraints(180, 260, 230, 40));

jLabel4.setBorder(javax.swing.BorderFactory.createLineBorde
2 r(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel4, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(30, 80, 1100,
280));

tbldetails.setBorder(javax.swing.BorderFactory.createLineBorder(ne
w java.awt.Color(0, 0, 0))); tbldetails.setFont(new java.awt.Font("Times
New
Roman", 0, 14)); // NOI18N tbldetails.setModel(new
javax.swing.table.DefaultTableModel(
new Object [][] {}, new String [] {}));
tbldetails.addMouseListener(new java.awt.event.MouseAdapter() {
public void
mouseClicked(java.awt.event.MouseEvent evt) {
tbldetailsMouseClicked(evt);}});
jScrollPane2.setViewportView(tbldetails);getContentPane().add(jSc
rollPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(30, 370,
1100, 280));
jLabel3.setBorder(javax.swing.BorderFactory.createLineBorde
2 r(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel3, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(20, 70, 1120,
590));

jLabel1.setBorder(javax.swing.BorderFactory.createLineBorde
2 r(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel1, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(5, 0, 1150,
670));

pack();
}// </editor-fold>

private void cmbgenderActionPerformed(java.awt.event.ActionEvent evt) { //


TODO add your handling code here: } private void
btnaddActionPerformed(java.awt.event.ActionEvent evt) { String

mid=txtmid.getText();
String name=txtname.getText(); String nic=txtnic.getText();
String birthday=
((JTextField)datebath.getDateEditor().getUiComponent()).getText(); String
gender=cmbgender.getSelectedItem().toString();
String address=txtaddress.getText(); String email=txtemail.getText(); String
contac=txtcontac.getText();
String type=cmbmemtype.getSelectedItem().toString();

try{
String sql="INSERT INTO `addmember`(`mid`, `name`, `nic`,
`birthday`, `gender`, `ad- dress`, `email`, `contac`, `type`)
VALUES('"+mid+"','"+name+"','"+nic+"','"+birthday+"','"+gen-
der+"','"+address+"','"+email+"','"+contac+"','"+type+"')";
PreparedStatement pst=(PreparedStatement)conn.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(rootPane, "successfully insert");
}
catch(Exception e) {

JOptionPane.showMessageDialog(rootPane, "Please fill all Colon");


}
cleanFild(); autoId();
52

tablelord();

private void tbldetailsMouseClicked(java.awt.event.MouseEvent evt) {


DefaultTableModel tmodel=( DefaultTableModel)tbldetails.getModel(); int
selectrowindex=tbldetails.getSelectedRow();
txtmid.setText(tmodel.getValueAt(selectrowindex,0).toString());
txtname.setText(tmodel.getValueAt(selectrowindex,1).toString());
txtnic.setText(tmodel.getValueAt(selectrowindex,2).toString());
(( JTextField)datebath.getDateEditor().getUiComponent()).setText(tmode
l.getValueAt(selec- trowindex,3).toString());
cmbgender.setSelectedItem(tmodel.getValueAt(selectrowindex,4).toString());
txtaddress.setText(tmodel.getValueAt(selectrowindex,5).toString());
txtemail.setText(tmodel.getValueAt(selectrowindex,6).toString());
txtcontac.setText(tmodel.getValueAt(selectrowindex,7).toString());
cmbmemtype.setSelectedItem(tmodel.getValueAt(selectrowindex,8).toString(
));
}

private void btnupdateActionPerformed(java.awt.event.ActionEvent evt) { String


mid=txtmid.getText();
String name=txtname.getText(); String nic=txtnic.getText();
String birthday=
((JTextField)datebath.getDateEditor().getUiComponent()).getText(); String
gender=cmbgender.getSelectedItem().toString();
String address=txtaddress.getText(); String email=txtemail.getText(); String
contac=txtcontac.getText();
String type=cmbmemtype.getSelectedItem().toString();

try
{
String sql=("UPDATE `addmember` SET
`name`='"+name+"',`nic`='"+nic+"',`birth-
day`='"+birthday+"',`gender`='"+gender+"',`address`='"+address+"',`email`='"
+email+"',`con- tac`='"+contac+"',`type`='"+type+"' WHERE
mid='"+txtmid.getText()+"'");
pst=(PreparedStatement) conn.prepareStatement(sql); pst.execute();

JOptionPane.showMessageDialog(rootPane, "UPDATE SUCCESS"); tablelord();


}
catch(HeadlessException | SQLException e)
{
JOptionPane.showMessageDialog(rootPane, e); }

}
53

private void btndeleteActionPerformed(java.awt.event.ActionEvent evt) { try {


String sql="DELETE FROM `addmember` WHERE
mid='"+txtmid.getText()+"'"; pst=(PreparedStatement) conn.prepareStatement(sql);
pst.execute();
JOptionPane.showMessageDialog(rootPane, "DELETE SUCCESS"); tablelord();
} catch (HeadlessException | SQLException e) {
JOptionPane.showMessageDialog(rootPane, e); }

private void txtmidActionPerformed(java.awt.event.ActionEvent evt) { // TODO


add your handling code here:
}

private void tablelord()


{ try {
String sql="SELECT `mid`, `name`, `nic`, `birthday`, `gender`, `address`, `email`,
`contac`,
`type` FROM `addmember` "; pst=(PreparedStatement) conn.prepareStatement(sql);
rs=pst.executeQuery();
tbldetails.setModel(net.proteanit.sql.DbUtils.resultSetToTableModel(rs));
}
catch(Exception e)
{
JOptionPane.showConfirmDialog(rootPane,e);
}
}

private void autoId()


{ try {
String sql="SELECT `mid` FROM `addmember`ORDER BY mid DESC LIMIT 1";
pst=(PreparedStatement) conn.prepareStatement(sql); rs=pst.executeQuery();

if(rs.next())
{
String rnno=rs.getString("mid"); int co=rnno.length();
54

String txt=rnno.substring(0,2); String num=rnno.substring(2,co); int


n=Integer.parseInt(num); n++;
String Snum=Integer.toString(n); String ftxt=txt+Snum; txtmid .setText(ftxt);

} else {
txtmid.setText("MI1000");

}}
catch(Exception e)
{
JOptionPane.showMessageDialog(rootPane, e);
}}
private void cleanFild()
{ txtmid.setText(""); txtname.setText(""); txtnic.setText("");
((JTextField)datebath.getDateEditor().getUiComponent()).setText("");
cmbgender.setSelectedIndex(0);
txtaddress.setText(""); txtemail.setText(""); txtcontac.setText("");
cmbmemtype.setSelectedIndex(0); }

// Variables declaration - do not modify private javax.swing.JButton btnadd; private


javax.swing.JButton btndelete; private javax.swing.JButton btnupdate;
private javax.swing.JComboBox<String> cmbgender; private
javax.swing.JComboBox<String> cmbmemtype; private
com.toedter.calendar.JDateChooser datebath; private javax.swing.JLabel jLabel1; private
javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11;

private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private


javax.swing.JLabel jLabel14; 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.JLabel jLabel9;
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane
jScrollPane2; private javax.swing.JTable tbldetails;
55

private javax.swing.JTextArea txtaddress; private javax.swing.JTextField txtcontac;


private javax.swing.JTextField txtemail; private
javax.swing.JTextField txtmid; private javax.swing.JTextField txtname; private
javax.swing.JTextField txtnic;
// End of variables declaration
}

(Add Book)

package Interface;

import com.mysql.jdbc.Connection; import com.mysql.jdbc.PreparedStatement;


import java.awt.HeadlessException; importjava.sql.ResultSet;
import java.sql.SQLException; import javax.swing.JOptionPane; import
javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;

/**
*
* @author dheeru
*/
55

public class AddBook extends javax.swing.JInternalFrame {

/**
* Creates new form AddBook
*/
Connection conn=null; PreparedStatement pst=null; ResultSet rs=null;

public AddBook() { initComponents(); conn=DBConnect.connect(); autoId();


tablelord(); cleanFild();
}

/**
* This method is called from within the constructor to initialize theform. *
WARNING: Do NOT modify this code. The content of this method isalways *
regenerated by the FormEditor.
*/ @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code"> private void
initComponents() {

jLabel1 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 =


new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new
javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new
javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new
javax.swing.JLabel(); txtbid = new javax.swing.JTextField(); txtname = new
javax.swing.JTextField(); txtbcode = new javax.swing.JTextField(); txtprice = new
javax.swing.JTextField(); datebath = new com.toedter.calendar.JDateChooser();
cmbcategory = new javax.swing.JComboBox<>(); cmbbooktype = new
javax.swing.JComboBox<>(); jScrollPane2 = new javax.swing.JScrollPane();
txtpublisher = new javax.swing.JTextArea(); btnadd = new javax.swing.JButton();
56

btnupdate = new javax.swing.JButton(); btndelete = new


javax.swing.JButton(); jLabel11 = new javax.swing.JLabel(); jLabel2 = new
javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane(); booktable = new
javax.swing.JTable(); jLabel12 = new javax.swing.JLabel();setClosable(true);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

jLabel1.setFont(new java.awt.Font("Times New Roman", 3, 36)); // NOI18N


jLabel1.setText("Books");
jLabel1.setBorder(java x.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0),2 getContentPane().add(jLabel1, new )
org.netbeans.lib.awtextra.AbsoluteConstraints(10, 10, 1110,)
;

4
0
)
)
;

jLabel3.setFont(new java.awt.Font("Times New Roman", 1,


24)); // NOI18N jLabel3.setText("Book Id");
getContentPane().add(jLabel3, new
1 org.netbeans.lib.awtextra.AbsoluteConstraints(30, 70, -1, -
)
)
;

jLabel4.setFont(new java.awt.Font("Times New Roman", 1,


24)); // NOI18N jLabel4.setText("Name");
getContentPane().add(jLabel4, new
1 org.netbeans.lib.awtextra.AbsoluteConstraints(30, 140, -1, -
)
)
;

jLabel5.setFont(new java.awt.Font("Times New Roman", 1,


24)); // NOI18N jLabel5.setText("B Code");
getContentPane().add(jLabel5, new
1 org.netbeans.lib.awtextra.AbsoluteConstraints(30, 210, -1 ,
)
)
;
57

jLabel6.setFont(new java.awt.Font("Times New Roman", 1,


24)); // NOI18N jLabel6.setText("Date"); getContentPane().add(jLabel6, new

o beans.lib.awtextra.AbsoluteConstraints(30, 280, -1, - r g


.
net

jLabel7.setFont(new java.awt.Font("Times New Roman", 1,


24)); // NOI18N jLabel7.setText("Category");
getContentPane().add(jLabel7, new
1 org.netbeans.lib.awtextra.AbsoluteConstraints(410, 70, -1, -
)
)
;

jLabel8.setFont(new .awt.Font("Times New Roman", 1, 24)); // NOI


jLabel8.setText("Book Type"); getContentPane().add(jLabel8,
new
3 org.netbeans.lib.awtextra.AbsoluteConstraints(410, 140, -1, 0
)
)
;

jLabel9.setFont(new java.awt.Font("Times New Roman", 1,


24)); // NOI18N jLabel9.setText("Publisher"); getContentPane().add(jLabel9,
new
- org.netbeans.lib.awtextra.AbsoluteConstraints(410, 210, -1,
1
)
)
;

jLabel10.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jLabel10.setText("Price"); getContentPane().add(jLabel10, new
org.netbeans.lib.awtextra.AbsoluteConstraints(410, 280, - 1, -1));
getContentPane().add(txtbid, new
org.netbeans.lib.awtextra.AbsoluteConstraints(130, 70, 250,
40));
getContentPane().add(txtname, new
org.netbeans.lib.awtextra.AbsoluteConstraints(130, 130,
250,40)); getContentPane().add(txtbcode, new
org.netbeans.lib.awtextra.AbsoluteConstraints(130, 200, 250, 40));

txtprice.addActionListener(new java.awt.event.ActionListener() { public void


actionPerformed(java.awt.event.ActionEvent evt) { txtpriceActionPerformed(evt);}});
getContentPane().add(txtprice, new
org.netbeans.lib.awtextra.AbsoluteConstraints(540, 270, 250, 40));
getContentPane().add(datebath, new
org.netbeans.lib.awtextra.AbsoluteConstraints(130,270, 250, 40));

cmbcategory.setModel(new
javax.swing.DefaultComboBoxModel<>(new String[] { "Category Type",
"Language", "Technology", "Histry", "Other" })); getContentPane().add(cmbcategory, new
org.netbeans.lib.awtextra.AbsoluteConstraints(540, 60, 250, 40));

cmbbooktype.setModel(new
javax.swing.DefaultComboBoxModel<>(new String[] { "Book type",
"Borrow", "Read Only" })); getContentPane().add(cmbbooktype, new
59

btnadd.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


btnadd.setText("Add");
btnadd.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) { btnaddActionPerformed(evt);
getContentPane().add(btnadd, new
org.netbeans.lib.awtextra.AbsoluteConstraints(840, 80, 250,

}
}
)
;

btnupdate.setFont(new java.awt.Font("Times New Roman", 1, 24)); //


NOI18N btnupdate.setText("Update"); btnupdate.addActionListener(new
java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt)
{ btnupdateActionPerformed(evt);
}
}); getContentPane().add(btnupdate, new
org.netbeans.lib.awtextra.AbsoluteConstraints(840, 160, 250, 60));

btndelete.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


btndelete.setText("Delete");
btndelete.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) { btndeleteActionPerformed(evt);
}
}); getContentPane().add(btndelete, new
org.netbeans.lib.awtextra.AbsoluteConstraints(840, 240, 250, 60));

2 jLabel11.setBorder(javax.swing.BorderFactory.createLineBorder(new
) java.awt.Color(0, 0, 0),getContentPane().add(jLabel11, new
) org.netbeans.lib.awtextra.AbsoluteConstraints(820, 60,
290, 250));

jLabel2.setFont(new java.awt.Font("Times New Roman", 0,


18)); // NOI18N
2 jLabel2.setBorder(javax.swing.BorderFactory.createLineBorde
) r(new java.awt.Color(0, 0, 0),getContentPane().add(jLabel2,
) new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 50,
; 1110,
270));booktable.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0,
0)));

booktable.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N


booktable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] {
},
60

new String [] {

} ));
booktable.setAlignmentX(1.0F); booktable.setAlignmentY(1.0F);
booktable.setRowHeight(25);
booktable.addMouseListener(new java.awt.event.MouseAdapter() { public void
mouseClicked(java.awt.event.MouseEvent evt) { booktableMouseClicked(evt);
}
}); jScrollPane1.setViewportView(booktable);

getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(12, 331, 1110, 320));

jLabel12.setBorder(javax.swing.BorderFactory.createLineBord
2 er(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel12, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1140,
660));

pack();
}// </editor-fold>

private void btnaddActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your


handling code here:
String bid=txtbid.getText(); String name=txtname.getText();
String b_code=txtbcode.getText();
String date=
((JTextField)datebath.getDateEditor().getUiComponent()).getText(); String
category=cmbcategory.getSelectedItem().toString();
String publisher=txtpublisher.getText(); String price=txtprice.getText();
String booktype=cmbbooktype.getSelectedItem().toString();

try{
String sql="INSERT INTO `addbook`(`bid`, `name`, `b_code`, `date`,
`category`,
`book_type`, `publisher`, `price`, `mark`) VAL-
61

UES('"+bid+"','"+name+"','"+b_code+"','"+date+"','"+category+"','"+booktype
+"','"+pub- lisher+"','"+price+"','0')";
PreparedStatement pst=(PreparedStatement)conn.prepareStatement(sql); pst.execute();
JOptionPane.showMessageDialog(rootPane, "successfully insert");
}
catch(Exception e) {

JOptionPane.showMessageDialog(rootPane, "please fill all colon");


}
cleanFild(); autoId(); tablelord();
}
private void tablelord()
{ try
{
String sql="SELECT `bid`, `name`, `b_code`, `date`, `category`, `book_type`,
`publisher`,
`price` FROM `addbook` "; pst=(PreparedStatement) conn.prepareStatement(sql);
rs=pst.executeQuery();
booktable.setModel(net.proteanit.sql.DbUtils.resultSetToTableModel(rs));
}
catch(Exception e)
{
JOptionPane.showConfirmDialog(rootPane,e);
}}
private void autoId()
{ try
{
String sql="SELECT `bid` FROM `addbook`ORDER BY bid DESC LIMIT
1"; pst=(PreparedStatement) conn.prepareStatement(sql);
rs=pst.executeQuery(); if(rs.next())
{
String rnno=rs.getString("bid"); int co=rnno.length();
String txt=rnno.substring(0,2); String num=rnno.substring(2,co); int
n=Integer.parseInt(num); n++;

String Snum=Integer.toString(n); String ftxt=txt+Snum; txtbid .setText(ftxt);

} else {
txtbid.setText("BI1000");

}}
62

catch(Exception e)
{
JOptionPane.showMessageDialog(rootPane, e);
}}
private void cleanFild()
{ txtbid.setText(""); txtname.setText(""); txtbcode.setText("");
((JTextField)datebath.getDateEditor().getUiComponent()).setText("");
cmbcategory.setSelectedIndex(0); txtpublisher.setText(""); txtprice.setText("");
cmbbooktype.setSelectedIndex(0);
} private void btnupdateActionPerformed(java.awt.event.ActionEvent evt) {
String bid=txtbid.getText();
String name=txtname.getText(); String b_code=txtbcode.getText();
String date=
((JTextField)datebath.getDateEditor().getUiComponent()).getText(); String
category=cmbcategory.getSelectedItem().toString();
String publisher=txtpublisher.getText(); String price=txtprice.getText();
String booktype=cmbbooktype.getSelectedItem().toString();

try
{
String sql=("UPDATE `addbook` SET
`name`='"+name+"',`b_code`='"+b_code+"',`date`='"+date+"',`category`='"+ca te-
gory+"',`book_type`='"+booktype+"',`publisher`='"+publisher+"',`price`='"+pr ice+"'
WHERE bid='"+txtbid.getText()+"'");
pst=(PreparedStatement) conn.prepareStatement(sql); pst.execute();

JOptionPane.showMessageDialog(rootPane, "UPDATE SUCCESS"); tablelord();


cleanFild();
}
catch(HeadlessException | SQLException e)
{
JOptionPane.showMessageDialog(rootPane, e); }

private void btndeleteActionPerformed(java.awt.event.ActionEvent evt) { try {


63

String sql="DELETE FROM `addbook` WHERE bid='"+txtbid.getText()+"'";


pst=(PreparedStatement) conn.prepareStatement(sql); pst.execute();
JOptionPane.showMessageDialog(rootPane, "DELETE SUCCESS"); tablelord();
cleanFild();
} catch (HeadlessException | SQLException e) {
JOptionPane.showMessageDialog(rootPane, e);
}
}

private void txtpriceActionPerformed(java.awt.event.ActionEvent evt) { // TODO add


your handling code here: }

private void booktableMouseClicked(java.awt.event.MouseEvent evt) {


DefaultTableModel tmodel=( DefaultTableModel)booktable.getModel(); int
selectrowindex=booktable.getSelectedRow();
txtbid.setText(tmodel.getValueAt(selectrowindex,0).toString());
txtname.setText(tmodel.getValueAt(selectrowindex,1).toString());
txtbcode.setText(tmodel.getValueAt(selectrowindex,2).toString());
(( JTextField)datebath.getDateEditor().getUiComponent()).setText(tmode
l.getValueAt(selec- trowindex,3).toString());
cmbcategory.setSelectedItem(tmodel.getValueAt(selectrowindex,4).toString() );
txtpublisher.setText(tmodel.getValueAt(selectrowindex,6).toString());
txtprice.setText(tmodel.getValueAt(selectrowindex,7).toString());
cmbbooktype.setSelectedItem(tmodel.getValueAt(selectrowindex,5).toString(
));
}

// Variables declaration - do not modify private javax.swing.JTable booktable; private


javax.swing.JButton btnadd; private javax.swing.JButton btndelete; private javax.swing.JButton
btnupdate; private javax.swing.JComboBox<String> cmbbooktype; private
javax.swing.JComboBox<String> cmbcategory; private com.toedter.calendar.JDateChooser
datebath; private javax.swing.JLabeljLabel1; private javax.swing.JLabel jLabel10; private
javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; 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.JLabeljLabel9;
64

private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane


jScrollPane2; private javax.swing.JTextField txtbcode; private javax.swing.JTextField txtbid;
private javax.swing.JTextField txtname; private javax.swing.JTextField txtprice; private
javax.swing.JTextArea txtpublisher;
// End of variables declaration }

(Return Book)

package Interface;

import com.mysql.jdbc.Connection;
import com.mysql.jdbc.PreparedStatement; import
java.awt.HeadlessException; import java.awt.print.PrinterException;
importjava.sql.ResultSet;
import java.sql.SQLException; import java.time.LocalDate; import
java.time.temporal.ChronoUnit; import java.util.logging.Level; import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
*
* @author asus
*/
public class Return extends javax.swing.JInternalFrame {

/**
* Creates new form Return
*/
Connection conn=null; PreparedStatement pst=null; ResultSet rs=null; public Return() {
initComponents(); conn=DBConnect.connect(); }

/**
65

* This method is called from within the constructor to initialize theform. *


WARNING: Do NOT modify this code. The content of this method isalways * regenerated by
the FormEditor.
*/ @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code"> private void
initComponents() {

jLabel3 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new


javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel();
txtbid = new javax.swing.JTextField(); txtmid = new javax.swing.JTextField(); txtlateday = new
javax.swing.JTextField(); txtfine = new javax.swing.JTextField(); jLabel4 = new
javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 =
newjavax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); txtbill = new
javax.swing.JTextArea(); jLabel2 = newjavax.swing.JLabel();

setClosable(true);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
65

jLabel3.setFont(new java.awt.Font("Times New Roman", 1,


36)); // NOI18N jLabel3.setText("Return");
jLabel3.setBorder(javax.swing.BorderFactory.createLineBord
2 er(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel3, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(20, 20, 1070,

7
0
)
)
;

jLabel6.setFont(new java.awt.Font("Times New Roman", 1,


24)); // NOI18N jLabel6.setText("Book ID");
getContentPane().add(jLabel6, new
- org.netbeans.lib.awtextra.AbsoluteConstraints(30, 180, 110, 1
)
)
;

jLabel7.setFont(new java.awt.Font("Times New Roman", 1, 24)); //


NOI18N jLabel7.setText("Member ID"); getContentPane().add(jLabel7, new
- org.netbeans.lib.awtextra.AbsoluteConstraints(30, 270, 130, 1
)
)
;

jLabel8.setFont(new java.awt.Font("Times New Roman", 1,


24)); // NOI18N jLabel8.setText("Late days");
getContentPane().add(jLabel8, new
- org.netbeans.lib.awtextra.AbsoluteConstraints(30, 360, 110, 1
)
)
;

-
1
)
)
66

j etFont(new java.awt.Font("Times New Roman", 1, 24)); // L NOI18N


jLabel9.setText("Fine"); a getContentPane().add(jLabel9, new
b org.netbeans.lib.awtextra.AbsoluteConstraints(30, 440, 100, e
l
9
.s

txtbid.addActionListener(new java.awt.event.ActionListener() { public void


actionPerformed(java.awt.event.ActionEvent evt) { txtbidActionPerformed(evt);
}
}); txtbid.addKeyListener(new java.awt.event.KeyAdapter() { public void
keyReleased(java.awt.event.KeyEvent evt) { txtbidKeyReleased(evt);
}
});
getContentPane().add(txtbid, new
5 org.netbeans.lib.awtextra.AbsoluteConstraints(190, 170, 220,
0
) getContentPane().add(txtmid, new
) org.netbeans.lib.awtextra.AbsoluteConstraints(190, 260,
;
220, 50));

txtlateday.addActionListener(new java.awt.event.ActionListener() {
67

public void actionPerformed(java.awt.event.ActionEvent evt) {


txtlatedayActionPerformed(evt);
}
}); getContentPane().add(txtlateday, new
org.netbeans.lib.awtextra.AbsoluteConstraints(190, 350, 220, 50));
getContentPane().add(txtfine, new
org.netbeans.lib.awtextra.AbsoluteConstraints(190, 430, 220, 50));

jLabel4.setBorder(javax.swing.BorderFactory.createLineBorde
2 r(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel4, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(20, 120, 420,
400));

jButton1.setFont(new java.awt.Font("Times New Roman", 0, 36)); // NOI18N


jButton1.setText("Return");
jButton1.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt);
}
}); getContentPane().add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(20, 560, 400, 70));

jButton2.setFont(new java.awt.Font("Times New Roman", 0, 36)); // NOI18N


jButton2.setText("Print");
jButton2.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt);
}
}); getContentPane().add(jButton2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(810, 560, 240, 70));

txtbill.setColumns(20);
txtbill.setFont(new java.awt.Font("Monospaced", 0, 24)); // NOI18N
txtbill.setRows(5);
jScrollPane1.setViewportView(txtbill);

getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(770, 120, 310, 390));

jLabel2.setBorder(javax.swing.BorderFactory.createLineBorder(new
java.awt.Color(0, 0, 0), 2));

getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1100,
650));
68

pack();
}// </editor-fold>

private void txtlatedayActionPerformed(java.awt.event.ActionEvent evt) { // TODO


add your handling code here: }

private void txtbidKeyReleased(java.awt.event.KeyEvent evt) { try


{
String sql="SELECT `mid`, `r_date` FROM `booklend`
WHEREbid='"+txt- bid.getText()+"'andmark='0'";
pst=(com.mysql.jdbc.PreparedStatement) conn.prepareStatement(sql);
rs=pst.executeQuery();
if(rs.next())
{ txtmid.setText(rs.getString("mid")); String r_date=rs.getString("r_date");
LocalDate today=LocalDate.now(); LocalDate rday=LocalDate.parse(r_date); Long
day_gap=ChronoUnit.DAYS.between(rday, today); if(day_gap>0)
{
txtlateday.setText(day_gap.toString()); long fine=5*day_gap;
txtfine.setText(String.valueOf(fine));
} else {
txtlateday.setText("0"); txtfine.setText("0");
}
}}
catch(Exception e)
{ } } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String bid=txtbid.getText();
String mid=txtmid.getText(); String ldate=txtlateday.getText();
Stringfine=txtfine.getText(); try{
String sql="INSERT INTO `bookreturn`(`bid`, `mid`, `late_days`,
`fine`) VAL- UES('"+bid+"','"+ mid+"','"+ ldate+"','"+fine+"')";
java.sql.PreparedStatement
pst=(java.sql.PreparedStatement)conn.prepareStatement(sql);
69

pst.execute(); update();

bill(); returnMark(); clean();


}
catch(Exception e) {

JOptionPane.showMessageDialog(rootPane, "please enter Book ID");


}
}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { try {


txtbill.print();
} catch (PrinterException ex) {
Logger.getLogger(Return.class.getName()).log(Level.SEVERE, null, ex);
}
}

private void txtbidActionPerformed(java.awt.event.ActionEvent evt) { // TODO add


your handling code here: }

private void bill()


{
txtbill.setText("============================="+"\n+"
+"Prasad Pollytechnic Library"+"\n"
+"No of Days\t"+ txtlateday.getText()+"\n"
+"Amount\t"+txtfine.getText()+"\n"
+"================================");
}

private void update()


{ try{
String sql="UPDATE `addbook` SET `mark`='0' WHERE
bid='"+txtbid.getText()+"'";
pst=(PreparedStatement)(java.sql.PreparedStatement)conn.prepareStatement(s ql);
pst.execute();
70

}
catch(Exception e) {

JOptionPane.showMessageDialog(rootPane, e);
}
}

private void returnMark()


{ try{
String sql="UPDATE `booklend` SET `mark`='1' WHERE
bid='"+txtbid.getText()+"'";
pst=(PreparedStatement)(java.sql.PreparedStatement)conn.prepareStatement(s ql);
pst.execute();

}
catch(Exception e) {

JOptionPane.showMessageDialog(rootPane, e);
}}
private void clean()
{ try {
String sql="DELETE FROM `booklend` WHERE
bid='"+txtbid.getText()+"'"; pst=(PreparedStatement) conn.prepareStatement(sql);
pst.execute();
//JOptionPane.showMessageDialog(rootPane, "DELETE SUCCESS");
// tablelord();
} catch (HeadlessException | SQLException e) {
JOptionPane.showMessageDialog(rootPane, e); }

// Variables declaration - do not modify private javax.swing.JButton jButton1;


private javax.swing.JButton jButton2; private javax.swing.JLabel jLabel2; private
javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private


javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private
javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextField txtbid; private
71

javax.swing.JTextArea txtbill; private javax.swing.JTextField txtfine; private


javax.swing.JTextField txtlateday; private javax.swing.JTextField txtmid;
// End of variables declaration }

(AllBook)

package Interface;

import com.mysql.jdbc.Connection; import com.mysql.jdbc.PreparedStatement;


import java.awt.print.PrinterException; import java.sql.ResultSet; import
java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane;

/**
*
* @author neelu
*/
public class Allbooks extends javax.swing.JInternalFrame {

/**
* Creates new form AddMembers
*/
Connection conn=null; PreparedStatement pst=null; ResultSet rs=null;

public Allbooks() { initComponents(); conn=DBConnect.connect(); tablelord();


71

/**
* This method is called from within the constructor to initialize theform. *
WARNING: Do NOT modify this code. The content of this method isalways *
regenerated by the FormEditor.
*/ @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code"> private void
initComponents() {

jLabel15 = new javax.swing.JLabel(); txtsearch = new javax.swing.JTextField();


jLabel2 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 =
new javax.swing.JButton(); jScrollPane1 = new javax.swing.JScrollPane(); txtallbook =
new javax.swing.JTable(); jLabel3 = newjavax.swing.JLabel(); jLabel1 =
newjavax.swing.JLabel();

setClosable(true);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

jLabel15.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jLabel15.setText("Book Name"); getContentPane().add(jLabel15, new
org.netbeans.lib.awtextra.AbsoluteConstraints(700, 20, 130, 30));

txtsearch.setFont(new java.awt.Font("Times New Roman", 0, 24)); // NOI18N


txtsearch.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtsearchActionPerformed(evt);
}
}); txtsearch.addKeyListener(new java.awt.event.KeyAdapter() { public void
keyReleased(java.awt.event.KeyEvent evt) { txtsearchKeyReleased(evt);
}
}); getContentPane().add(txtsearch, new
org.netbeans.lib.awtextra.AbsoluteConstraints(860, 20, 250, 40));

jLabel2.setFont(new java.awt.Font("Times New Roman", 3, 36)); // NOI18N


jLabel2.setText(" All Books");
jLabel2.setBorder(javax.swing.BorderFactory.createLineBord
2 er(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel2, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(20, 10, 1100,

6
0
)
)
;
72

jButton1.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jButton1.setText("Print");
jButton1.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt);
}
}); getContentPane().add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(870, 590, 190, 50));

jButton2.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jButton2.setText("Clear");
jButton2.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt);
}
}); getContentPane().add(jButton2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(610, 590, 190, 50));

txtallbook.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N


txtallbook.setModel(new javax.swing.table.DefaultTableModel( new Object [][] {
}, new String [] {

} ));
jScrollPane1.setViewportView(txtallbook);

getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(32, 80, 1080, 490));

);
2
)

j tBorder(javax.swing.BorderFactory.createLineBorder(new
L java.awt.Color(0, 0, 0),
a
b getContentPane().add(jLabel3, new
e org.netbeans.lib.awtextra.AbsoluteConstraints(20, 70, 1100, l
3
.se
590));
73

jLabel1.setBorder(javax.swing.BorderFactory.createLineBorde
2 r(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel1, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(5, 0, 1130,
670));

pack();
}// </editor-fold>

private void txtsearchActionPerformed(java.awt.event.ActionEvent evt) {

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { txtsearch.setText("");


tablelord();
}

private void txtsearchKeyReleased(java.awt.event.KeyEvent evt) { try


{
String sql="SELECT `bid`, `name`, `b_code`, `date`, `category`, `book_type`, `publisher`,
`price` FROM `addbook`WHERE name LIKE '%"+txtsearch.getText()+"%'";
pst=(PreparedStatement) conn.prepareStatement(sql); rs=pst.executeQuery();
txtallbook.setModel(net.proteanit.sql.DbUtils.resultSetToTableModel(rs));
}
catch(Exception e)
{
JOptionPane.showConfirmDialog(rootPane,e);
}
}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try {


txtallbook.print();
} catch (PrinterException ex) {
Logger.getLogger(Return.class.getName()).log(Level.SEVERE, null, ex);
}
}

private void tablelord()


{ try {
String sql="SELECT `bid`, `name`, `b_code`, `date`, `category`, `book_type`, `publisher`,
`price` FROM `addbook` ";
pst=(PreparedStatement) conn.prepareStatement(sql);
74

rs=pst.executeQuery();
txtallbook.setModel(net.proteanit.sql.DbUtils.resultSetToTableModel(rs));
}
catch(Exception e)
{
JOptionPane.showConfirmDialog(rootPane,e);
}
}

// Variables declaration - do not modify private javax.swing.JButton jButton1; private


javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3;
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable txtallbook;
private javax.swing.JTextField txtsearch;
// End of variables declaration }

(AllMember)

package Interface;

import com.mysql.jdbc.Connection; import com.mysql.jdbc.PreparedStatement; import


java.awt.print.PrinterException; import java.sql.ResultSet; import java.util.logging.Level; import
java.util.logging.Logger; import javax.swing.JOptionPane;

/**
*
* @author dheeru
*/
public class Allmember extends javax.swing.JInternalFrame {

/**

* Creates new form AddMembers


*/
75

Connection conn=null; PreparedStatement pst=null; ResultSet rs=null;

public Allmember() { initComponents(); conn=DBConnect.connect(); tablelord();


}

/**
* This method is called from within the constructor to initialize theform. * WARNING: Do
NOT modify this code. The content of this method isalways * regenerated by the FormEditor.
*/ @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code"> private void initComponents() {

jLabel15 = new javax.swing.JLabel(); txtsearch = new javax.swing.JTextField(); jLabel2 = new


javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton();
jScrollPane1 = new javax.swing.JScrollPane(); tblallmember = new javax.swing.JTable(); jLabel3 =
newjavax.swing.JLabel(); jLabel1 = newjavax.swing.JLabel();

setClosable(true);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

jLabel15.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jLabel15.setText("Member Name"); getContentPane().add(jLabel15, new
org.netbeans.lib.awtextra.AbsoluteConstraints(660, 30, 160, 30));

txtsearch.setFont(new java.awt.Font("Times New Roman", 0, 24)); // NOI18N


txtsearch.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { txtsearchActionPerformed(evt);
}

}); txtsearch.addKeyListener(new java.awt.event.KeyAdapter() { public void


keyReleased(java.awt.event.KeyEvent evt) { txtsearchKeyReleased(evt);
}
}); getContentPane().add(txtsearch, new
org.netbeans.lib.awtextra.AbsoluteConstraints(850, 20, 250, 40));
76

jLabel2.setFont(new java.awt.Font("Times New Roman", 3, 36)); // NOI18N


jLabel2.setText(" All Member"); jLabel2.setBorder(javax.swing.BorderFactory.createLineBord
2 er(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel2, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(20, 10, 1100,

6
0
)
)
;

jButton1.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jButton1.setText("Print");
jButton1.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt);
}
}); getContentPane().add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(870, 590, 170, 50));

jButton2.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jButton2.setText("Clear");
jButton2.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt);
}
}); getContentPane().add(jButton2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(620, 590, 170, 50));

tblallmember.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N


tblallmember.setModel(new javax.swing.table.DefaultTableModel( new Object [][] {},
new String [] {}
));

jScrollPane1.setViewportView(tblallmember);

getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(32, 80, 1070, 490));

jLabel3.setBorder(javax.swing.BorderFactory.createLineBorde
2 r(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel3, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(20, 70, 1100,
580));
77

jLabel1.setBorder(javax.swing.BorderFactory.createLineBorde
2 r(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel1, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(5, 0, 1130,
660));

pack();
}// </editor-fold>

private void txtsearchActionPerformed(java.awt.event.ActionEvent evt) {

private void txtsearchKeyReleased(java.awt.event.KeyEvent evt) { try


{
String sql="SELECT `mid`, `name`, `nic`, `birthday`, `gender`, `address`, `email`, `contac`,
`type` FROM `addmember` WHERE name LIKE'%"+txtsearch.getText()+"%'";
pst=(PreparedStatement) conn.prepareStatement(sql); rs=pst.executeQuery();
tblallmember.setModel(net.proteanit.sql.DbUtils.resultSetToTableModel(rs));
}
catch(Exception e)
{
JOptionPane.showConfirmDialog(rootPane,e); }
}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { txtsearch.setText("");


tablelord();
}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try {


tblallmember.print();
} catch (PrinterException ex) {
Logger.getLogger(Return.class.getName()).log(Level.SEVERE, null, ex);
}
}

private void tablelord()


{ try {
String sql="SELECT `mid`, `name`, `nic`, `birthday`, `gender`, `address`, `email`, `contac`,
`type` FROM `addmember`"; pst=(PreparedStatement) conn.prepareStatement(sql);
rs=pst.executeQuery(); tblallmember.setModel(net.proteanit.sql.DbUtils.resultSetToTableModel(rs));
}
catch(Exception e)
{
JOptionPane.showConfirmDialog(rootPane,e);
}
}
78

// Variables declaration - do not modify private javax.swing.JButton jButton1; private


javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3;
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable tblallmember; private
javax.swing.JTextField txtsearch;
// End of variables declaration }

(Lend History)

package Interface;

import com.mysql.jdbc.Connection; import com.mysql.jdbc.PreparedStatement; import


java.awt.print.PrinterException; import java.sql.ResultSet; import java.util.logging.Level; import
java.util.logging.Logger; import javax.swing.JOptionPane; import javax.swing.JTextField;

/**
*

* @author neelam
*/
public class LendHistry extends javax.swing.JInternalFrame {

/**
* Creates new form AddMembers
*/
Connection conn=null; PreparedStatement pst=null; ResultSet rs=null;

public LendHistry() { initComponents(); conn=DBConnect.connect(); tablelord();


}
private void initComponents() {

jLabel15 = new javax.swing.JLabel(); txtsearch = new javax.swing.JTextField(); jLabel2 = new


javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton();
79

jScrollPane1 = new javax.swing.JScrollPane(); tbllendhistry = new javax.swing.JTable(); jLabel3 =


newjavax.swing.JLabel(); jLabel1 = newjavax.swing.JLabel();

setClosable(true);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

jLabel15.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jLabel15.setText("Member ID"); getContentPane().add(jLabel15, new
org.netbeans.lib.awtextra.AbsoluteConstraints(690, 30, 160, 30));

txtsearch.setFont(new java.awt.Font("Times New Roman", 0, 24)); // NOI18N


txtsearch.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { txtsearchActionPerformed(evt);
}

}); txtsearch.addKeyListener(new java.awt.event.KeyAdapter() { public void


keyReleased(java.awt.event.KeyEvent evt) { txtsearchKeyReleased(evt);
}
}); getContentPane().add(txtsearch, new
org.netbeans.lib.awtextra.AbsoluteConstraints(870, 20, 240, 40));

jLabel2.setFont(new java.awt.Font("Times New Roman", 3, 36)); // NOI18N


jLabel2.setText("Lend Histry"); jLabel2.setBorder(javax.swing.BorderFactory.createLineBord
2 er(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel2, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(20, 10, 1110,

6
0
)
)
;

jButton1.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jButton1.setText("Print");
80

jButton1.addActionListener(new java.awt.event.ActionListener() { public void


actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt);
}
}); getContentPane().add(jButton1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(930, 590, 160, 40));

jButton2.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


jButton2.setText("Clear");
jButton2.addActionListener(new java.awt.event.ActionListener() { public void
actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt);
}
}); getContentPane().add(jButton2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(720, 590, 160, 40));

tbllendhistry.setFont(new java.awt.Font("Times New Roman", 0, 14)); // NOI18N


tbllendhistry.setModel(new javax.swing.table.DefaultTableModel( new Object [][] {

},

new String [] {

} ));
jScrollPane1.setViewportView(tbllendhistry);

getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(32, 80, 1090, 490));

jLabel3.setBorder(javax.swing.BorderFactory.createLineBorde
2 r(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel3, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(20, 70, 1110,
580));

jLabel1.setBorder(javax.swing.BorderFactory.createLineBorde
2 r(new java.awt.Color(0, 0, 0),
)
) getContentPane().add(jLabel1, new
; org.netbeans.lib.awtextra.AbsoluteConstraints(5, 0, 1140,
81

660));

pack(); }// </editor-fold>

private void txtsearchActionPerformed(java.awt.event.ActionEvent evt) {

private void txtsearchKeyReleased(java.awt.event.KeyEvent evt) { try


{
String sql="SELECT `record_no`, `mid`, `bid`, `i_date`,
`r_date`FROM `booklend` WHERE mid LIKE'%"+txtsearch.getText()+"%'";
pst=(PreparedStatement) conn.prepareStatement(sql); rs=pst.executeQuery();
tbllendhistry.setModel(net.proteanit.sql.DbUtils.resultSetToTableModel(rs));
} catch(Exception e)
{
JOptionPane.showConfirmDialog(rootPane,e);
}
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try {


tbllendhistry.print();
} catch (PrinterException ex) {
Logger.getLogger(Return.class.getName()).log(Level.SEVERE, null, ex); }
} 81
private void lendFilter()
{

}
private void tablelord()
{ try {
String sql="SELECT `record_no`, `mid`, `bid`, `i_date`, `r_date` FROM `booklend`";
pst=(PreparedStatement) conn.prepareStatement(sql); rs=pst.executeQuery();
tbllendhistry.setModel(net.proteanit.sql.DbUtils.resultSetToTableModel(rs));
}
catch(Exception e)
{
JOptionPane.showMessageDialog(rootPane,e);
}
}
// Variables declaration - do not modify private javax.swing.JButton jButton1; private
javax.swing.JButton jButton2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3;
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTable tbllendhistry; private
javax.swing.JTextField txtsearch; }
82

8. SYSTEM TESTING

8.1 Testing:
It is process use to identify correctnesscompletenessand qualities of developed computer software.

OR

A good test is one that has a high probability of finding an as yet, undiscovered error.

8.1.1 Level of testing

Unit Testing

Integration Test-

System Testing

{Structure of testing}

8.1.2 UnitTesting:-
Testing of an individual software component or module is termed as Unit testing. It is typically done
by the programmer and not by testers, as it requires a detailed knowledge of the internal program
design and code. It may also require developing test drive modules or test harnesses.

8.1.2.1 IntegrationTesting

The testing of combined parts of an application to determine if they function correctly together is
Integration testing. There are two methods of doing Integration Testing Bottom-up Integration testing
and Top Down Integration testing.

a) Bottom-Up integrationtesting
b) Top-Down integrationtesting
83

Top-Downintegrationtestingthehighestlevelmodulesaretestedfirstandprogressivelylower-level
modules are tested after that. In a comprehensive software development environment, bottom-up
test- ing is usually done first, followed by top-downtesting..

8.1.2.2 SystemTesting
A level of the software testing process where a complete, integrated system/software is tested. The
purpose of this test is to evaluate the system’s compliance with the specified requirements. System
testing there are two types:-

8.1.2.2.1 AlphaTesting
8.1.2.2.2 BetaTesting

a) Alphatesting

This test is the first stage of testing and will be performed amongst the teams
(developer and QA
teams).Unittesting,integrationtestingandsystemtestingwhencombinedareknownasalphatesting.
During this phase, the following will be tested in theapplication:

• SpellingMistakes.
• BrokenLinks.  CloudyDirections.

• The Application will be tested on machines with the lowest specification to test loading
times and any latencyproblems.

c) BetaTesting

This test is performed after Alpha testing has been successfully performed. In beta testing a
sampleoftheintendedaudienceteststheapplication.Betatestingisalsoknownasprerelease testing. Beta
test versions of software are ideally distributed to a wide
audience on the Web, partlytogivetheprograma"real-
world"testandpartlytoprovideapreviewofthenextrelease. In this phase the audience will be testing
thefollowing:
• Users will install, run the application and send their feedback to the projectteam.
• Typographical errors, confusing application flow, and evencrashes.
84

• Getting the feedback, the project team can fix the problems before releasing the software to
the actualusers.

• The more issues you fix that solve real user problems, the higher the quality of your ap-
plication willbe.
• Having a higher-quality application when you release to the general public will increase
customersatisfaction.

8.1.2.3 PerformanceTesting:-
Thistermisoftenusedinterchangeablywith‘stress’and‘load’testing.Performancet estingisdoneto
check whether the system meets the performance requirements. Different performance and load tools are
used to do thistesting.

1. StressTesting:
This testing is done when a system is stressed beyond its specifications in order to check how
andwhenitfails.Thisisperformedunderheavyloadlikeputtinglargenumberbeyondstorage capacity, complex
database queries, continuous input to the system or databaseload.

2. VolumeTesting:
Volume testing is a type of non-functional testing performed by the performance testing team.The
software or application undergoes a huge amount of data and Volume Testing checks the system
behavior and response time of the application when the system came across such a high volume of data.
This high volume of data may impact the system’sper- formance and speed of the processingtime.

3. CompatibilityTesting:-

It is a testing type in which it validates how software behaves and runs in a different envi-
ronment, web servers, hardware, and network environment. Compatibility testing ensures that
software can run on a different configuration, different database, different browsers, and their
versions. Compatibility testing is performed by the testing team.
85

4. SecurityTesting:-

Itisatypeoftestingperformedbyaspecialteamoftesters.Asystemcanbepenetratedby
anyhackingway.Securitytestingisdonetocheckhowthesoftwareorapplicationorweb- site is secure from
internal and external threats. This testing includes how much software is secure from the malicious
program, viruses and how secure and strong theauthorization
andauthenticationprocessesare.Italsocheckshowsoftwarebehavesforanyhackersattack and malicious
programs and how software is maintained for data security after such a hacker attack.

8.1.3 Testing ofmethod

8.1.2.4 Black boxtesting:-


Internal system design is not considered in this type of testing. Tests are based on the requirements
and functionality.

8.1.2.5 White box testing:-

White box testing is based on the knowledge about the internal logic of an application’s code.
It is also known as Glass box Testing. Internal software and code working should be known for
per-
formingthistypeoftesting.Underthesetestsarebasedonthecoverageofcodestatements, branches, paths,
conditionsetc.
86

10. CONCLUSION

From a proper analysis of positive point and constraints on the component, it can be safely that the
desktop application is a highly efficient GUI based component.

This desktop application is work properly and meting all user requirements.
87

11. REFERENCE

The book taken as guidance for the completion of the project are:

1.) Java Swing Programing.


2.) Database Management System MariaDB.

FOR JAVA INSTALLATION

WWW.ORACAL.COM

FORMARIADB
WWW.ORACAL.COM

WEB SITES
www.javatpiont.comwww.w3school.com
88

12 BIBLIOGRAPHY
 Java Complete Refrence By Herbertshield
 Database programming with JDBC and Java By George Reese.
 Java and xml by BrettMcLaughlin
 WIKIPEDIA,URL :http://www.wikipedia.org.  Answers.com,online
dictionary,encyclopedia

NEELAM PAL

545/9 SAGAR VIHAR COLONY PARA ROAD RAJAJIPURAM

LUCKNOW-226017

MOB.NO: 8929701793, 8604118070

EMAIL ID: neelamsinghpal3100@gmail.com

OBJECTIVE
89

To be a part of an organization where I use my skill and knowledge to deliver value added result
and work the best of my ability to acquire success.

PROFESSIONAL QUALIFICATION

• Completed Computer Science Engineering Diploma from Government Poly-


technicUnnao.
• Pursuing B.tech branch Computer Science Engineering from GCRG Group of In- stitutions
inLucknow.
• Certification in Web Developer from Softpro India.Pvt.Ltd Lucknow in2015.
• Certification in Web Developer from Indian Institute of HardwareTechnology in 2018.

TECHNICAL SKILLS

• Web developer in HTML &CSS.


• Knowledge of ASP.NET & C, C#,JAVA.
• Operating System –Windows7/Windows 8/Windows10.

ACADEMIC CREDENTIALS

• Pursuing B.tech from GCRG Group ofInstitutions.


• Completed Diploma from Govt. Polytechnic Unnao in2015-2016.
• Intermediate from Navyug kanya Mahavidyalay Inter Colleage in2012.
• High School from S B N Inter College in2010.

WORK EXPERIENCE

• Web designing & development with the help of SUMMERTRANING.


• Summer Training project “E Banking Solution”, “ONLINE
COMPETATIVE PRO- GRAMMINGPORTAL”.

AREA OF INTEREST
90

• Writing poems, quotations, playingbadminton.


• Givingpresentation.

PERSONAL DETAILS

• Father’s name: Mr. JAGANNATHPAL


• Date of Birth:20-01-1997
• Marital Status:Unmarried
• Language Known: Hindi&English
• Nationality:Indian
• Strengths: Positive Attitude & SelfMotivator

DECLARATION

I hereby declare that the information provided by me is true to the best of my knowledge and
belief.

Place: Lucknow [NEELAM PAL]

You might also like