0% found this document useful (0 votes)
7 views

library project Java netbeans

The document outlines the development of a Library Management System designed to automate library transactions such as adding and updating student and book information, as well as borrowing and returning books. It includes acknowledgments to contributors, hardware and software requirements, feasibility analysis, and detailed descriptions of system functionalities and user interfaces. The system aims to improve efficiency, reduce errors, and provide a user-friendly experience for library management.

Uploaded by

navyaragam0198
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

library project Java netbeans

The document outlines the development of a Library Management System designed to automate library transactions such as adding and updating student and book information, as well as borrowing and returning books. It includes acknowledgments to contributors, hardware and software requirements, feasibility analysis, and detailed descriptions of system functionalities and user interfaces. The system aims to improve efficiency, reduce errors, and provide a user-friendly experience for library management.

Uploaded by

navyaragam0198
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 53

Acknowledgement

We take this occasion to thank God, almighty for blessing us with his grace and
taking our endeavour to a successful culmination and our school Bhadrachalam
Public School & Junior College.

We extend our sincere and heartfelt thanks to our esteemed guide,


Mr. G.N.V.Raja Reddy, for providing us with the right guidance and advice at
the crucial junctures and for showing me the right way.

We also take this opportunity to express a deep sense of gratitude to our


Prinicipal Sir, Mr. G. Prabhakar Reddy.

Last but not the least, we would like to thank our friends and family for the
support and encouragement they have given us during the course of our work.

BPSJC Page 1
Introduction
The project titled Library Management System is for monitoring and
controlling the transactions in a library .The project “Library Management
System” is developed in Netbeans IDE, which mainly focuses on basic
operations In a library like adding new student, new books, and updating new
information, Searching books and students and facility to borrow and return
books.

The Library Management System is designed for a receipt and issuance of


books in the library along with the student’s details. The books received in the
library are entered in add book form and the new student is entered in the add
student form. When the student wants to get the desired book the same is
issued on the availability basis to the student. The issuance and due date for
the returning of the book is also entered into the transaction table.

PROPOSED SYSTEM:
Proposed system is an automated Library Management System. Through our
software user can add members, add books, search members, search books,
update information, edit information, borrow and return books in quick time.
Our proposed system has the following advantages.
 User friendly interface

 Fast access to database

 Less error

 More Storage Capacity

 Search facility

 Look and Feel Environment

All the manual difficulties in managing the Library have been rectified by
implementing computerization.

There are four types of actions performed by this project

BPSJC Page 2
 Insertion – Data such as names, phone numbers, identification numbers,
can be inserted and stored in case of book and student.

 Removal – Removal of the above-mentioned data can also be performed


using a few clicks.

 Search- One may search the they wished about the book or the student.

 Transactions – One can take the book from the library from the
availability basis.

Hardware & Software Requirements


Minimum Hardware Requirement

Processor: Pentinum 4 or above

Main Memory: 1GB

Video Adaptor: 4GB SVGA

Hard Disk: 20 GB

Network Card: Ethernet

Software Requirements

Platform: Windows NT/XP/7

Client Side Validation: Java/Net beans

Server Side Validation: MySQL Server

Database Connectivity: JDBC/ODBC

RDBMS: MySQL 5.1

BPSJC Page 3
FEASIBILITY
Economical Feasibility

The system is being developed is economic with respective to the conventional


to the library point of view it is cost effective in the sense the charge
eliminated the paper work completely. The system is also find effective
because the calculations are automated which are made at the end of the
semester or as per the user requirement. The result obtained contains
minimum error and are highly accurately of the data is required.

Technhical Feasibility

The technical requirement for the system is economic and it does not use any
other additional Hardware and Software.

Behavioural Feasibility

The system working is quite easy to use and learn due to its simple but
attractive interface . User requires no special training for operating the system.

BPSJC Page 4
Tables
Book_details

Student_details

Transactions

BPSJC Page 5
Subscriptions

BPSJC Page 6
Name
ER-Diagram
Phone no

DOB Roll no

Student Name

Accno Address
Book Name Student

Transaction Date of issue


Are
s
Taken

Date of return
Make Name

Accno Author

Library has Book


Copies

Rack no
Availability

Price

BPSJC Page 7
Login Form

This login form is made for security purpose. So only Authenticated user only can access

in to the project.

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

String user = userTF.getText();

String pwd = new String(pwdPD.getPassword());

if (user.equalsIgnoreCase("library") && pwd.equalsIgnoreCase("book")) {

JOptionPane.showMessageDialog(null, "You have logged in succesfully" + "\n" +


"Welcome to Library Management System");

new MainMenu().setVisible(true);

this.dispose();

} else {

JOptionPane.showMessageDialog(null, "Sorry....Please check your username and


password and try again.....");

userTF.setText("");

pwdPD.setText("");

userTF.requestFocus();

}}

BPSJC Page 8
Main Menu

This is the
homepage, the main menu from where one can choose what to do next.It comes instantly
after you log in successfully.

Source Code:
private void addBookMIActionPerformed(java.awt.event.ActionEvent evt) {

new addbook().setVisible(true);

this.dispose();

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

new modifybookdetails().setVisible(true);

this.dispose();

BPSJC Page 9
private void addstuMIActionPerformed(java.awt.event.ActionEvent evt) {

new Addstudent().setVisible(true);

this.dispose();

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

new modifystudentdetails().setVisible(true);

this.dispose();

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

new search_book_details().setVisible(true);

this.dispose();

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

new search_student_details().setVisible(true);

this.dispose();

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

new lend().setVisible(true);

this.dispose();

BPSJC Page 10
private void returnMIActionPerformed(java.awt.event.ActionEvent evt) {

new returnbook().setVisible(true);

this.dispose();

private void subMIMenuSelected(javax.swing.event.MenuEvent evt) {

new subscriptions().setVisible(true);

this.dispose();

private void aboutMIMenuSelected(javax.swing.event.MenuEvent evt) {

new about().setVisible(true);

this.dispose();

private void exitMIMenuSelected(javax.swing.event.MenuEvent evt) {

System.exit(0);

BPSJC Page 11
About Form

Source Code
private void returnBTNActionPerformed(java.awt.event.ActionEvent evt) {

new MainMenu().setVisible(true);

this.dispose();

BPSJC Page 12
ConnectDB Method:
package library;

import java.sql.*;

import javax.swing.JOptionPane;

public class ConnectDB {

private static Connection con = null;

private static final String url = "jdbc:mysql://localhost:3306/library";

private static final String uid = "root";

private static final String pwd = "navya";

public static Connection connectMySQL() {

try {

Class.forName("java.sql.Driver");

con = DriverManager.getConnection(url, uid, pwd);

return con;

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

return null;

BPSJC Page 13
}

Add Book

A filled up form to add a new Book to Library. On Clicking Add button it inserts the record
into Mysql table book_details.

Source Code

package library;

import java.sql.*;

import javax.swing.JOptionPane;

BPSJC Page 14
import net.proteanit.sql.DbUtils;

public class addbook extends javax.swing.JFrame {

Connection con;

Statement stmt;

ResultSet rs;

PreparedStatement pst,pst1;

public addbook() {

initComponents();

con = ConnectDB.connectMySQL();

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

String name = nameTF.getText();

int no=0;

String author = authorTF.getText();

int price = Integer.parseInt(priceTF.getText());

int rack = Integer.parseInt(rackTF.getText());

int copy = Integer.parseInt(copiesTF.getText());

String ava = avaliableTF.getText();

try{

String sql="insert into book_details values(?,?,?,?,?,?,?)";

String accnosql="select ifnull(max(accno),0)+1 as book from book_details";

String sql1 = "select * from book_details";

pst=con.prepareStatement(accnosql);

BPSJC Page 15
rs=pst.executeQuery();

if(rs.next()) {

no=rs.getInt("book");

pst1=con.prepareStatement(sql);

pst1.setString(1, name);

pst1.setInt(2, no);

pst1.setString(3,author);

pst1.setInt(4,price);

pst1.setInt(5,rack);

pst1.setInt(6,copy);

pst1.setString(7,ava);

pst1.executeUpdate();

JOptionPane.showMessageDialog(null, "The accno of the Book "+name+" is " + no);

stmt = con.createStatement();

rs = stmt.executeQuery(sql1);

bookTB.setModel(DbUtils.resultSetToTableModel(rs));

}catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

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

nameTF.setText("");

authorTF.setText("");

BPSJC Page 16
priceTF.setText("");

rackTF.setText("");

copiesTF.setText("");

avaliableTF.setText("");

nameTF.requestFocus();

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

new MainMenu().setVisible(true);

this.dispose();

Output

BPSJC Page 17
Modify Book Details

A form to Update or delete the book information

Source Code
package library;
BPSJC Page 18
import java.sql.*;

import javax.swing.JOptionPane;

import net.proteanit.sql.DbUtils;

public class modifybookdetails extends javax.swing.JFrame {

Connection con;

Statement stmt;

ResultSet rs;

public modifybookdetails() {

initComponents();

con = ConnectDB.connectMySQL();

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

nameTF.setEditable(true);

authorTF.setEditable(true);

priceTF.setEditable(true);

rackTF.setEditable(true);

copiesTF.setEditable(true);

availableTF.setEditable(true);

int row = bookTB.getSelectedRow();

int acc = Integer.parseInt(bookTB.getValueAt(row, 1).toString());

String sql = "select * from book_details where accno=" + acc;

try {

stmt = con.createStatement();

BPSJC Page 19
rs = stmt.executeQuery(sql);

rs.next();

accTF.setText(rs.getString("accNo"));

nameTF.setText(rs.getString("Book_Name"));

authorTF.setText(rs.getString("Author"));

priceTF.setText(rs.getInt("Price") + "");

rackTF.setText(rs.getInt("Rack_no") + "");

copiesTF.setText(rs.getInt("Copies") + "");

availableTF.setText(rs.getString("Availability"));

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

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

String sql = "select * from book_details";

try {

stmt = con.createStatement();

rs = stmt.executeQuery(sql);

bookTB.setModel(DbUtils.resultSetToTableModel(rs));

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

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

BPSJC Page 20
int acc = Integer.parseInt(accTF.getText());

String name = nameTF.getText();

String author = authorTF.getText();

int price = Integer.parseInt(priceTF.getText());

int rack = Integer.parseInt(rackTF.getText());

int copies = Integer.parseInt(copiesTF.getText());

String ava = availableTF.getText();

String sql = "update book_details set Book_name='" + name + "',Author='" + author +


"',Price=" + price + ",Rack_no=" + rack + ",copies=" + copies + ",Availability='" + ava + "'
where AccNo=" + acc;

try {

stmt = con.createStatement();

stmt.executeUpdate(sql);

updateTable();

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

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

int acc = Integer.parseInt(accTF.getText());

String sql = "delete from book_details where AccNo=" + acc;

try {

stmt = con.createStatement();

stmt.executeUpdate(sql);

updateTable();

} catch (Exception e) {

BPSJC Page 21
JOptionPane.showMessageDialog(null, e.getMessage());

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

accTF.setText("");

nameTF.setText("");

authorTF.setText("");

priceTF.setText("");

rackTF.setText("");

copiesTF.setText("");

availableTF.setText("");

accTF.requestFocus();

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

new MainMenu().setVisible(true);

this.dispose();

private void updateTable() {

String sql = "select * from book_details";

try {

stmt = con.createStatement();

rs = stmt.executeQuery(sql);

bookTB.setModel(DbUtils.resultSetToTableModel(rs));

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

BPSJC Page 22
}

Output

Add Student

BPSJC Page 23
A form to add a student. Clicking on add button inserts the record into Mysql table

Student_details.

Source Code
package library;

import java.sql.*;

import java.text.SimpleDateFormat;

import java.util.Calendar;

import javax.swing.JOptionPane;

import net.proteanit.sql.DbUtils;

public class Addstudent extends javax.swing.JFrame {

Connection con;

Statement stmt;

ResultSet rs;

BPSJC Page 24
PreparedStatement pst, pst1;

public Addstudent() {

initComponents();

con = ConnectDB.connectMySQL();

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

int no = 0;

String name = nameTF.getText();

String addr = addrTA.getText();

long pno = Long.parseLong(pnoTF.getText());

String date = dateTF.getText();

String sql = "insert into student_details values(?,?,?,?,?)";

String rollnosql = "select ifnull(max(rollno),0)+1 as rollno from student_details";

String sql1 = "select * from student_details";

try {

pst = con.prepareStatement(rollnosql);

rs = pst.executeQuery();

if (rs.next()) {

no = rs.getInt("rollno");

pst1 = con.prepareStatement(sql);

pst1.setInt(1, no);

pst1.setString(2, name);

pst1.setString(3, addr);

pst1.setLong(4, pno);

pst1.setString(5, date);

BPSJC Page 25
pst1.executeUpdate();

JOptionPane.showMessageDialog(null, name + " your RollNo is: " + no);

stmt = con.createStatement();

rs = stmt.executeQuery(sql1);

memberTB.setModel(DbUtils.resultSetToTableModel(rs));

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

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

nameTF.setText("");

addrTA.setText("");

pnoTF.setText("");

dateTF.setText("");

nameTF.requestFocus();

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

new MainMenu().setVisible(true);

this.dispose();

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

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

Calendar c = Calendar.getInstance();

c.setTime(jDateChooser1.getDate());

BPSJC Page 26
dateTF.setText(sdf.format(c.getTime()));

Output

BPSJC Page 27
Modify Student Details

A form to Update or delete the book information

Source Code
package library;

import java.sql.*;

import javax.swing.JOptionPane;

import net.proteanit.sql.DbUtils;

public class modifystudentdetails extends javax.swing.JFrame {

BPSJC Page 28
Connection con;

Statement stmt;

ResultSet rs;

public modifystudentdetails() {

initComponents();

con = ConnectDB.connectMySQL();

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

String sql = "select * from student_details";

try {

stmt = con.createStatement();

rs = stmt.executeQuery(sql);

studentTB.setModel(DbUtils.resultSetToTableModel(rs));

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

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

nameTF.setEditable(true);

pnoTF.setEditable(true);

dateTF.setEditable(true);

addrTA.setEditable(true);

int row = studentTB.getSelectedRow();

int no= Integer.parseInt(studentTB.getValueAt(row, 0).toString());

BPSJC Page 29
String sql = "select * from student_details where Rollno=" + no;

try {

stmt = con.createStatement();

rs = stmt.executeQuery(sql);

if (rs.next()) {

int id = rs.getInt(1);

String name = rs.getString(2);

String addr = rs.getString(3);

long pno = rs.getLong(4);

String birth = rs.getString(5);

noTF.setText(Integer.toString(id));

nameTF.setText(name);

addrTA.setText(addr);

pnoTF.setText(Long.toString(pno));

dateTF.setText(birth);

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

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

int no = Integer.parseInt(noTF.getText());

String name = nameTF.getText();

String addr = addrTA.getText();

long pno =Long.parseLong(pnoTF.getText());

BPSJC Page 30
String date = dateTF.getText();

String sql = "update student_details set Student_name='" + name + "',Address='" + addr


+

"',Phone_No=" + pno + ",Date_of_Birth='" + date + "' where Rollno=" + no;

try {

stmt = con.createStatement();

stmt.executeUpdate(sql);

updateTable();

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

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

int id = Integer.parseInt(noTF.getText());

String sql = "delete from student_details where Rollno=" + id;

try {

stmt = con.createStatement();

stmt.executeUpdate(sql);

updateTable();

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

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

noTF.setText("");

BPSJC Page 31
nameTF.setText("");

addrTA.setText("");

pnoTF.setText("");

dateTF.setText("");

noTF.requestFocus();

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

new MainMenu().setVisible(true);

this.dispose();

private void updateTable() {

String sql = "select * from student_details";

try {

stmt = con.createStatement();

rs = stmt.executeQuery(sql);

studentTB.setModel(DbUtils.resultSetToTableModel(rs));

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

Output

BPSJC Page 32
Search Book Details

We can search the book details available in the library in this form-A successful search.

Source Code
package library;

import java.sql.*;

import javax.swing.JOptionPane;

import net.proteanit.sql.DbUtils;

BPSJC Page 33
public class search_book_details extends javax.swing.JFrame {

Connection con;

Statement stmt;

ResultSet rs;

public search_book_details() {

initComponents();

con = ConnectDB.connectMySQL();

private void valueTFKeyReleased(java.awt.event.KeyEvent evt) {

String criteria;

if (accRB.isSelected()) {

criteria = "AccNo";

} else {

criteria = "Author";

String sql = "select * from book_details where " + criteria + " like '%" + valueTF.getText()
+ "%';";

try {

stmt = con.createStatement();

rs = stmt.executeQuery(sql);

bookTB.setModel(DbUtils.resultSetToTableModel(rs));

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

BPSJC Page 34
}

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

new MainMenu().setVisible(true);

this.dispose();

Output

BPSJC Page 35
Search Student Details

We can search the book details available in the library in this form-A successful search.

Source Code
package library;

BPSJC Page 36
import java.sql.*;

import javax.swing.JOptionPane;

import net.proteanit.sql.DbUtils;

public class search_student_details extends javax.swing.JFrame {

Connection con;

Statement stmt;

ResultSet rs;

public search_student_details() {

initComponents();

con = ConnectDB.connectMySQL();

private void valueTFKeyReleased(java.awt.event.KeyEvent evt) {

String criteria;

if (rollRB.isSelected()) {

criteria = "Rollno";

} else {

criteria = "Student_Name";

String sql = "select * from student_details where " + criteria + " like '%" +
valueTF.getText() + "%';";

try {

BPSJC Page 37
stmt = con.createStatement();

rs = stmt.executeQuery(sql);

memberTB.setModel(DbUtils.resultSetToTableModel(rs));

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

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

new MainMenu().setVisible(true);

this.dispose();

Output

BPSJC Page 38
Subscriptions

A form to insert the


information about magazines/newspapers subscribed to the library.

BPSJC Page 39
Source Code
package library;

import java.sql.*;

import javax.swing.JOptionPane;

import net.proteanit.sql.DbUtils;

public class subscriptions extends javax.swing.JFrame {

Connection con;

Statement stmt;

ResultSet rs;

public subscriptions() {

initComponents();

con = ConnectDB.connectMySQL();

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

String name = nameTF.getText();

int id = Integer.parseInt(idTF.getText());

String date = dateTF.getText();

int price = Integer.parseInt(priceTF.getText());

int copies = Integer.parseInt(copyTF.getText());

BPSJC Page 40
String sql = "insert into subscriptions values('" + name + "'," + id + ",'" + date + "'," +
price + "," + copies + ");";

try {

stmt = con.createStatement();

stmt.executeUpdate(sql);

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

String sql1 = "select *from subscriptions";

try {

stmt = con.createStatement();

rs = stmt.executeQuery(sql1);

subTable.setModel(DbUtils.resultSetToTableModel(rs));

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

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

nameTF.setText((String) subscribeCB.getSelectedItem());

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

nameTF.setText("");

idTF.setText("");

dateTF.setText("");

BPSJC Page 41
priceTF.setText("");

copyTF.setText("");

nameTF.requestFocus();

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

new MainMenu().setVisible(true);

this.dispose();

Output

BPSJC Page 42
Avaliability Form

Source Code
package library;

import java.sql.*;

import javax.swing.JOptionPane;

import net.proteanit.sql.DbUtils;

public class avaliability extends javax.swing.JFrame {

Connection con;

Statement stmt;

ResultSet rs;

public avaliability() {

initComponents();

con = ConnectDB.connectMySQL();

BPSJC Page 43
private void avaliableBTNActionPerformed(java.awt.event.ActionEvent evt) {

String sql = "select book_name,accno,copies from book_details;";

try {

stmt = con.createStatement();

rs = stmt.executeQuery(sql);

bookTable.setModel(DbUtils.resultSetToTableModel(rs));

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

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

int row = bookTable.getSelectedRow();

Object r = bookTable.getModel().getValueAt(row, 2);

int copy = Integer.parseInt(r.toString());

if (copy != 0) {

Object i = bookTable.getModel().getValueAt(row, 1);

int accno = Integer.parseInt(i.toString());

Object n = bookTable.getModel().getValueAt(row, 0);

String name = (String) n;

new lend(accno, name).setVisible(true);

this.dispose();

} else {

JOptionPane.showMessageDialog(null, "Sorry cannot Lend this book");

BPSJC Page 44
}

Transactions

Lend a book

A form to lend the book to the students which are available in the library.

Source Code
package library;

import java.sql.*;

import java.text.SimpleDateFormat;

import java.util.Calendar;

BPSJC Page 45
import javax.swing.JOptionPane;

import net.proteanit.sql.DbUtils;

public class lend extends javax.swing.JFrame {

Connection con;

Statement stmt;

ResultSet rs;

public lend() {

initComponents();

con = ConnectDB.connectMySQL();

public lend(int accno, String bookname) {

this();

accTF.setText(Integer.toString(accno));

nameTF.setText(bookname);

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

new avaliability().setVisible(true);

this.dispose();

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

int acc = Integer.parseInt(accTF.getText());

String name = nameTF.getText();

BPSJC Page 46
String sname = nameCB.getSelectedItem().toString();

String issue = issueTF.getText();

String retur = returnTF.getText();

JOptionPane.showMessageDialog(null, "You should return the book on " + retur);

String sql = "insert into transactions values(" + acc + ",'" + name + "','" + sname + "','" +
issue + "','" + retur + "');";

try {

stmt = con.createStatement();

stmt.executeUpdate(sql);

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

String sql1 = "select * from transactions";

try {

stmt = con.createStatement();

rs = stmt.executeQuery(sql1);

transTable.setModel(DbUtils.resultSetToTableModel(rs));

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

String sql2 = "update book_details set copies=copies-1 where accno=" + acc;

try {

stmt = con.createStatement();

stmt.executeUpdate(sql2);

} catch (Exception e) {

BPSJC Page 47
JOptionPane.showMessageDialog(null, e.getMessage());

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

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");

Calendar c = Calendar.getInstance();

c.setTime(jDateChooser1.getDate());

issueTF.setText(sdf.format(c.getTime()));

c.add(Calendar.DATE, 30);

returnTF.setText(sdf.format(c.getTime()));

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

accTF.setText("");

nameTF.setText("");

issueTF.setText("");

returnTF.setText("");

accTF.requestFocus();

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

new MainMenu().setVisible(true);

this.dispose();

Output

BPSJC Page 48
BPSJC Page 49
Return the book

A form to delete the record of the returned book by the student.

Source Code
package library;

import java.sql.*;

import javax.swing.JOptionPane;

import net.proteanit.sql.DbUtils;

public class returnbook extends javax.swing.JFrame {

Connection con;

Statement stmt;

BPSJC Page 50
ResultSet rs;

public returnbook() {

initComponents();

con = ConnectDB.connectMySQL();

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

int acc = Integer.parseInt(accTF.getText());

String sql = "delete from transactions where accno=" + acc;

try {

stmt = con.createStatement();

stmt.executeUpdate(sql);

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

String sql1 = "select Book_name,Student_Name,Date_of_Return from transactions";

try {

stmt = con.createStatement();

rs = stmt.executeQuery(sql1);

transTable.setModel(DbUtils.resultSetToTableModel(rs));

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

String sql2 = "update book_details set copies=copies+1 where accno=" + acc;

BPSJC Page 51
try {

stmt = con.createStatement();

stmt.executeUpdate(sql2);

} catch (Exception e) {

JOptionPane.showMessageDialog(null, e.getMessage());

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

accTF.setText("");

nameTF.setText("");

accTF.requestFocus();

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

new MainMenu().setVisible(true);

this.dispose();

Output

BPSJC Page 52
Conclusion:
The Library Management System is developed using NetBeans fully meets the
objectives of the system which it has been developed. The system has reached a
steady state where all bugs have been eliminated. The system is operated at a high
level of efficiency and all the students associated with the system understand its
advantage. The system solves the problem. It was intended to solve as requirement
specification.

Bibliography
1. www.W3schools.in
2. www.Cbse.nic.in

BPSJC Page 53

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy