Project Report
Project Report
Project Report
Project Report
Submitted By:-
Apart from the efforts of team, the success of any project depends largely on
the encouragement and guidelines of many others. We take this opportunity
to express our gratitude to the people who have been instrumental in the
successful completion of this project. The completion of any inter-
disciplinary project depends upon cooperation, co-ordination and combined
efforts of several sources of knowledge. We are eternally grateful to our
teacher Arti Debnath for her even willingness to give us valuable advice
and direction under which we executed this project. Her constant guidance
and willingness to share her vast knowledge made us understand this project
and its manifestations in great depths and helped us to complete the assigned
tasks.
Project Guide
Arti Debnath
ABSTRACT
1.1 PURPOSE
1.2 SCOPE
1.3 DEFINITIONS, ACRONYMS,
and ABBREVIATIONS
1.4 REFERENCES
1.5 OVERVIEW
1.1 PURPOSE
A library management system can help you seamlessly transition
from manually managed libraries to automated libraries, making
them more efficient and effective. The library management
system’s primary role is to securely keep all data on materials
discovered in a library in a cloud data storage. The purpose of
this project is to computerize all details regarding patient details
and hospital details
1.2 SCOPE
The critical functions of cataloging and circulation of books is
done automatically by the library management system software.
Entry of new books, deletion of old books and updating of the
member and book database becomes simple. The books
borrowed, returned, lost or misplaced can be tracked by the
system.
1.3 DEFINITIONS, ACRONYMS, and
ABBREVIATIONS
Advantages
Disadvantages
❖ User Interfaces
● This section provides a detailed description of all
inputs into and outputs from the system. It also
gives a description of the hardware, software and
communication interfaces and provides basic
prototypes of the user interface.
● The protocol used shall be HTTP.
● The Port number used will be 80.
● There shall be logical address of the system in
IPv4 format.
❖ Hardware Interface
▪ Laptop/Desktop PC-Purpose of this is to give
information when Student’s or admin See’s
information about Books, Available and
ReturnDetails . To perform such Action it
need very efficient computer otherwise due to
that reason Student’s have to wait for a long
time to get what they ask for.
▪ Wi-Fi router - Wi-Fi router is used to for
internetwork operations inside of a Library
and simply data transmission from pc’s to
sever.
❖ Software Interfaces
▪ JDK 1.8 - Java is fast, secure, and reliable.
From laptops to data centers, game consoles to
scientific supercomputers, cell phones to the
Internet,
▪ Mysql server - Database connectivity and
management
▪ OS Windows 7/8/8.1- Very user friendly and
common OS
▪ JRE 1.8 - JAVA Runtime Environment for
run Java Application and System
2.1.2 System Specifications
2.1.2.1 H/W Requirement
Core i3 processor
8 GB Ram.
20 GB of hard disk space in terminal machines
1TB hard disk space in Server Machine
2.1.2.2 S/W Requirement
Windows 7 or above operating system
JRE 1.8
Mysql server
User
Case Diagram:
User Case Description :
After login this one is first page. In this page we have seven button
and each button having different functionality.In this page there is
an arrow button which is used to change position of other buttons.
In this page we can see all the details of the books available in the
library.It also have a button to add new book this page.
import javax.swing.JOptionPane;
/*
*/
/**
* @author gtmsn
*/
/**
*/
public Login() {
initComponents();
setExtendedState(JFrame.MAXIMIZED_BOTH);
/**
*/
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_
ON_CLOSE);
setUndecorated(true);
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setText("Username");
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(520, 380, -1,
30));
jLabel2.setText("Password");
getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(520, 420, 80,
40));
getContentPane().add(jTextField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(650, 390, 400, -
1));
jPasswordField1.setBackground(new java.awt.Color(255,
255, 204));
jPasswordField1.setFont(new java.awt.Font("Tahoma", 1,
14)); // NOI18N
getContentPane().add(jPasswordField1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(650, 430, 400, -
1));
jButton1.setIcon(new
javax.swing.ImageIcon("C:\\Users\\gtmsn\\OneDrive\\Docum
ents\\NetBeansProjects\\Library Management System\\Icon
1\\login.png")); // NOI18N
jButton1.setText("Login");
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(650, 480, -1, -
1));
jButton2.setIcon(new
javax.swing.ImageIcon("C:\\Users\\gtmsn\\OneDrive\\Docum
ents\\NetBeansProjects\\Library Management System\\Icon
1\\red-x-mark-transparent-background-3.png")); // NOI18N
jButton2.setText("Close");
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(960, 480, -1, -
1));
jLabel3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/Login.jpg"))); //
NOI18N
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1430, -1));
pack();
}// </editor-fold>
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
if(jTextField1.getText().equals("admin") &&
jPasswordField1.getText().equals("admin"))
setVisible(false);
new MainLayer().setVisible(true);
else
JOptionPane.showMessageDialog(null,"Incorrect
Username or Password");
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
System.exit(0);
}
/**
*/
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Login.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(Login.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException
ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(jav
a.util.logging.Level.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new Login().setVisible(true);
}
});
}
Main Layer.java:
public class MainLayer extends javax.swing.JFrame {
public MainLayer() {
initComponents();
@SuppressWarnings("unchecked")
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_
ON_CLOSE);
setUndecorated(true);
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setText("RATNAM LIBRARY");
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(480, 30, -1, -1));
getContentPane().add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(80, 180, -1, -1));
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(600, 150, 200, -
1));
getContentPane().add(jLabel5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(1020, 170, -1, -
1));
jButton2.setText("Issue Book");
jButton2.addActionListener(new
java.awt.event.ActionListener() {
jButton2ActionPerformed(evt);
});
getContentPane().add(jButton2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(530, 520, -1, -1));
jButton3.addActionListener(new
java.awt.event.ActionListener() {
jButton3ActionPerformed(evt);
});
getContentPane().add(jButton3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(960, 520, -1, -1));
jButton4.addActionListener(new
java.awt.event.ActionListener() {
jButton4ActionPerformed(evt);
});
getContentPane().add(jButton4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(450, 650, -1, -1));
jButton5.setText("Student Registration");
jButton5.addActionListener(new
java.awt.event.ActionListener() {
jButton5ActionPerformed(evt);
});
getContentPane().add(jButton5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(600, 720, -1, -1));
jButton6ActionPerformed(evt);
});
getContentPane().add(jButton6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(810, 650, -1, -1));
jButton7.setText("Book Details");
jButton7.addActionListener(new
java.awt.event.ActionListener() {
jButton7ActionPerformed(evt);
});
getContentPane().add(jButton7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(100, 520, -1, -1));
jButton8.setFont(new java.awt.Font("Tahoma", 1, 14)); //
NOI18N
jButton8.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/exit.png"))); //
NOI18N
jButton8.setText("LOG OUT");
jButton8.addActionListener(new
java.awt.event.ActionListener() {
jButton8ActionPerformed(evt);
});
getContentPane().add(jButton8, new
org.netbeans.lib.awtextra.AbsoluteConstraints(1207, 698, -1, -
1));
getContentPane().add(jLabel6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
jLabel7.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/Book
Details.png"))); // NOI18N
getContentPane().add(jLabel7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(70, 120, -1, -1));
jLabel8.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/Issue
Book.png"))); // NOI18N
getContentPane().add(jLabel8, new
org.netbeans.lib.awtextra.AbsoluteConstraints(610, 140, -1, -1));
jLabel9.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/Return
Books.png"))); // NOI18N
getContentPane().add(jLabel9, new
org.netbeans.lib.awtextra.AbsoluteConstraints(1020, 180, -1, -
1));
jLabel10.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/books-1281581
(1) (1).png"))); // NOI18N
getContentPane().add(jLabel10, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
}// </editor-fold>
private void
jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
anb.setVisible(true);
this.setVisible(false);
private void
jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
r.setVisible(true);
this.setVisible(false);
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
ib.setVisible(true);
this.setVisible(false);
private void
jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
rb.setVisible(true);
this.setVisible(false);
}
private void
jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
ibs.setVisible(true);
this.setVisible(false);
private void
jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
bd.setVisible(true);
this.setVisible(false);
private void
jButton8ActionPerformed(java.awt.event.ActionEvent evt) {
setVisible(false);
new Login().setVisible(true);
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(AddNewBook.class.getName())
.log(java.util.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(AddNewBook.class.getName())
.log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(AddNewBook.class.getName())
.log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException
ex) {
java.util.logging.Logger.getLogger(AddNewBook.class.getName())
.log(java.util.logging.Level.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new MainLayer().setVisible(true);
});
}
Issue Book:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
import java.text.SimpleDateFormat;
import java.util.Date;
Connection con;
Statement stmt;
ResultSet rs;
String query;
/**
*/
public IssueBook() {
initComponents();
/**
*/
@SuppressWarnings("unchecked")
t1 = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
t2 = new javax.swing.JTextField();
t3 = new javax.swing.JTextField();
t4 = new javax.swing.JTextField();
t5 = new javax.swing.JTextField();
t6 = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_
ON_CLOSE);
setUndecorated(true);
addWindowListener(new java.awt.event.WindowAdapter() {
public void
windowActivated(java.awt.event.WindowEvent evt) {
OnCreate(evt);
});
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setText("Issue Book");
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(590, 180, -1, -
1));
jLabel2.setText("Student Id");
getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(500, 240, -1, -
1));
t1.setFont(new java.awt.Font("Tahoma", 0, 14)); //
NOI18N
t1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
t1ActionPerformed(evt);
});
t1.addKeyListener(new java.awt.event.KeyAdapter() {
t1KeyReleased(evt);
});
getContentPane().add(t1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(630, 240, 130, -
1));
jLabel3.setText("Student Name");
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(500, 290, -1, -
1));
t2.setFont(new java.awt.Font("Tahoma", 0, 14)); //
NOI18N
t2.setEnabled(false);
getContentPane().add(t2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(630, 290, 261, -
1));
jLabel4.setText("Book Id");
getContentPane().add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(500, 350, -1, -
1));
t3.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
t3ActionPerformed(evt);
});
t3.addKeyListener(new java.awt.event.KeyAdapter() {
t3KeyReleased(evt);
}
});
getContentPane().add(t3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(630, 340, 129, -
1));
jLabel5.setText("Book name");
getContentPane().add(jLabel5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(500, 440, -1, -
1));
t4.setEnabled(false);
getContentPane().add(t4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(630, 440, 261, -
1));
jLabel6.setText("Issue Date");
getContentPane().add(jLabel6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(500, 490, -1, -
1));
t5.setFont(new java.awt.Font("Tahoma", 0, 14)); //
NOI18N
t5.setEnabled(false);
t5.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
t5ActionPerformed(evt);
});
getContentPane().add(t5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(630, 490, 133, -
1));
jButton1.setText("Issue");
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(590, 540, -1, -
1));
jButton2.setText("Cancel");
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(760, 540, -1, -
1));
jButton3.setText("Home");
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(500, 610, -1, -
1));
jButton4.setText("Book Details");
jButton4.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
});
getContentPane().add(jButton4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(610, 610, -1, -
1));
jButton5.setText("Return Book");
jButton5.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
});
getContentPane().add(jButton5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(760, 610, -1, -
1));
jButton6.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
});
getContentPane().add(jButton6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(920, 610, -1, -
1));
jButton7.setText("Student Registration");
jButton7.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
});
getContentPane().add(jButton7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(310, 610, -1, -
1));
t6.setEnabled(false);
getContentPane().add(t6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(630, 390, 48, -
1));
jLabel7.setText("Available");
getContentPane().add(jLabel7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(500, 390, -1, -
1));
getContentPane().add(jLabel8, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
jLabel9.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/new
back.jpg"))); // NOI18N
getContentPane().add(jLabel9, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
}// </editor-fold>
private void
jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
mn.setVisible(true);
this.setVisible(false);
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
if(t2.getText().equals(""))
JOptionPane.showMessageDialog(this,"PLS REGISTER
YOUR NAME ");
else
try
connect();
rs=stmt.executeQuery(query);
rs.next();
if(t6.getText().equals("YES"))
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(this,"Book
with id = "+t3.getText()+" has been issued to "+t2.getText());
query="update books set Available='NO' where
BookId='"+t3.getText()+"';";
stmt.executeUpdate(query);
if(t6.getText().equals("NO"))
JOptionPane.showMessageDialog(this,"Book
with this id is not available currently");
if(t6.getText().equals(""))
JOptionPane.showMessageDialog(this,"There
is no book in the library with this id");
t4.setText("");
t1.setText("");
t2.setText("");
t3.setText("");
t6.setText("");
disconnect();
}
catch(SQLException e)
if(e.getErrorCode()==1062)
JOptionPane.showMessageDialog(this,"A
student can only get a single book from library at a time ");
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
mn.setVisible(true);
this.setVisible(false);
private void
jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
private void
jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
rb.setVisible(true);
this.setVisible(false);
private void
jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
r.setVisible(true);
this.setVisible(false);
private void
jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
ibs.setVisible(true);
this.setVisible(false);
}
try
connect();
rs=stmt.executeQuery(query);
if(rs.next())
SName=rs.getString("StudentName");
Address=rs.getString("Address");
SStream=rs.getString("Stream");
SClass=rs.getString("Class");
t2.setText(SName);
else
t2.setText("");
disconnect();
catch(Exception e)
{
System.out.println(e);
t5.setText(format.format(date));
try
connect();
rs=stmt.executeQuery(query);
if(rs.next())
t6.setText(rs.getString("Available"));
t4.setText(rs.getString("BookName"));
else
t6.setText("");
t4.setText("");
disconnect();
}
catch(Exception e)
System.out.println(e);
/**
*/
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(ReturnBook.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(ReturnBook.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException
ex) {
java.util.logging.Logger.getLogger(ReturnBook.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new IssueBook().setVisible(true);
});
try
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/library?useSSL=false&autoRecon
nect=true","root","root");
stmt=con.createStatement();
catch(Exception e)
System.out.println(e);
JOptionPane.showMessageDialog(this,"connection
error");
try
con.close();
catch(Exception e)
{}
}
// Variables declaration - do not modify
Book Details:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
Connection con;
Statement stmt;
ResultSet rs;
String query;
String BId,Bname,Bauthor,strm,cls,avl;
/**
*/
public BookDetails() {
initComponents();
/**
*/
@SuppressWarnings("unchecked")
b1 = new javax.swing.ButtonGroup();
r1 = new javax.swing.JRadioButton();
r2 = new javax.swing.JRadioButton();
c1 = new javax.swing.JComboBox<>();
c2 = new javax.swing.JComboBox<>();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_
ON_CLOSE);
setUndecorated(true);
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
b1.add(r1);
r1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
r1ActionPerformed(evt);
});
getContentPane().add(r1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(300, 230, -1, -
1));
b1.add(r2);
r2.setText("Search By Class");
r2.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
r2ActionPerformed(evt);
}
});
getContentPane().add(r2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(300, 280, -1, -
1));
c1.setModel(new
javax.swing.DefaultComboBoxModel<>(new String[] { "Select
Stream", "Science", "Commerce", "Arts" }));
c1.setEnabled(false);
c1.addActionListener(new java.awt.event.ActionListener()
{
public void
actionPerformed(java.awt.event.ActionEvent evt) {
c1ActionPerformed(evt);
});
getContentPane().add(c1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(480, 270, 185,
29));
c2.setModel(new
javax.swing.DefaultComboBoxModel<>(new String[] { "Select
Class" }));
c2.setEnabled(false);
c2.addActionListener(new java.awt.event.ActionListener()
{
public void
actionPerformed(java.awt.event.ActionEvent evt) {
c2ActionPerformed(evt);
});
getContentPane().add(c2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(760, 270, 155,
29));
txt1.setEnabled(false);
txt1.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
txt1ActionPerformed(evt);
});
txt1.addKeyListener(new java.awt.event.KeyAdapter() {
});
getContentPane().add(txt1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(480, 230, 185, -
1));
table.setModel(new javax.swing.table.DefaultTableModel(
},
new String [] {
));
table.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL
_COLUMNS);
jScrollPane2.setViewportView(table);
if (table.getColumnModel().getColumnCount() > 0) {
table.getColumnModel().getColumn(0).setPreferredWidth(40);
table.getColumnModel().getColumn(1).setPreferredWidth(210);
table.getColumnModel().getColumn(2).setPreferredWidth(150);
table.getColumnModel().getColumn(3).setPreferredWidth(40);
table.getColumnModel().getColumn(4).setPreferredWidth(40);
table.getColumnModel().getColumn(5).setPreferredWidth(40);
getContentPane().add(jScrollPane2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(300, 330, 778,
262));
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(750, 230, 160,
26));
jButton2.setText("Home");
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(350, 620, 94, -
1));
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(530, 620, 105, -
1));
jButton4.setText("Return Book");
jButton4.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
});
getContentPane().add(jButton4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(700, 620, -1, -
1));
jButton5.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
});
getContentPane().add(jButton5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(870, 620, -1, -
1));
jLabel1.setText("Book Details");
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(580, 180, -1, -
1));
getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
jLabel3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/new
back.jpg"))); // NOI18N
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
}// </editor-fold>
c1.disable();c2.disable();
txt1.enable();
private void
txt1ActionPerformed(java.awt.event.ActionEvent evt) {
}
private void r2ActionPerformed(java.awt.event.ActionEvent
evt) {
txt1.disable();
c1.enable();
try
connect();
rs=stmt.executeQuery(query);
DefaultTableModel
model=(DefaultTableModel)table.getModel();
model.setRowCount(0);
while(rs.next())
Object[] row =
{rs.getString("BookId"),rs.getString("BookName"),rs.getString("A
uthorName"),rs.getString("Stream"),rs.getString("Class"),rs.getSt
ring("Available")};
model.addRow(row);
disconnect();
catch(Exception e)
System.out.println(e);
c2.enable();
if(c1.getSelectedItem()=="Science")
c2.removeAllItems();
c2.addItem("Select
Class");c2.addItem("FYBScCS");c2.addItem("SYBScCS");c2.addIt
em("TYBScCS");
}
if(c1.getSelectedItem()=="Arts")
c2.removeAllItems();
c2.addItem("Select
Class");c2.addItem("FYBA");c2.addItem("SYBA");c2.addItem("TY
BA");
if(c1.getSelectedItem()=="Commerce")
c2.removeAllItems();
c2.addItem("Select
Class");c2.addItem("FYBCom");c2.addItem("SYBCom");c2.addIte
m("TYBCom");
DefaultTableModel
model=(DefaultTableModel)table.getModel();
model.setRowCount(0);
String txt=txt1.getText();
if(txt.equals(""))
System.out.println("");
else
{
try
connect();
rs=stmt.executeQuery(query);
while(rs.next())
Object[] row =
{rs.getString("BookId"),rs.getString("BookName"),rs.getString("A
uthorName"),rs.getString("Stream"),rs.getString("Class"),rs.getSt
ring("Available")};
model.addRow(row);
disconnect();
catch(Exception e)
System.out.println(e);
}
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
anb.setVisible(true);
this.setVisible(false);
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
mn.setVisible(true);
this.dispose();
private void
jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
ib.setVisible(true);
this.setVisible(false);
private void
jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
private void
jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
ibs.setVisible(true);
this.setVisible(false);
/**
*/
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(BookDetails.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(BookDetails.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(BookDetails.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException
ex) {
java.util.logging.Logger.getLogger(BookDetails.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new BookDetails().setVisible(true);
});
try
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/library?useSSL=false&autoRecon
nect=true","root","root");
stmt=con.createStatement();
catch(Exception e)
{
System.out.println(e);
JOptionPane.showMessageDialog(this,"connection
error");
try
con.close();
catch(Exception e)
{}
}
Register Student:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
Connection con;
Statement stmt;
ResultSet rs;
String query;
String BId,Bname,Bauthor,strm,cls,avl;
/**
*/
public BookDetails() {
initComponents();
/**
*/
@SuppressWarnings("unchecked")
b1 = new javax.swing.ButtonGroup();
r1 = new javax.swing.JRadioButton();
r2 = new javax.swing.JRadioButton();
c1 = new javax.swing.JComboBox<>();
c2 = new javax.swing.JComboBox<>();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_
ON_CLOSE);
setUndecorated(true);
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
b1.add(r1);
r1.setFont(new java.awt.Font("Tahoma", 0, 13)); //
NOI18N
r1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
r1ActionPerformed(evt);
});
getContentPane().add(r1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(300, 230, -1, -
1));
b1.add(r2);
r2.setText("Search By Class");
r2.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
r2ActionPerformed(evt);
});
getContentPane().add(r2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(300, 280, -1, -
1));
c1.setModel(new
javax.swing.DefaultComboBoxModel<>(new String[] { "Select
Stream", "Science", "Commerce", "Arts" }));
c1.setEnabled(false);
c1.addActionListener(new java.awt.event.ActionListener()
{
public void
actionPerformed(java.awt.event.ActionEvent evt) {
c1ActionPerformed(evt);
});
getContentPane().add(c1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(480, 270, 185,
29));
c2.setModel(new
javax.swing.DefaultComboBoxModel<>(new String[] { "Select
Class" }));
c2.setEnabled(false);
c2.addActionListener(new java.awt.event.ActionListener()
{
public void
actionPerformed(java.awt.event.ActionEvent evt) {
c2ActionPerformed(evt);
});
getContentPane().add(c2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(760, 270, 155,
29));
txt1.setEnabled(false);
txt1.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
txt1ActionPerformed(evt);
});
txt1.addKeyListener(new java.awt.event.KeyAdapter() {
txt1KeyReleased(evt);
}
});
getContentPane().add(txt1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(480, 230, 185, -
1));
table.setModel(new javax.swing.table.DefaultTableModel(
},
new String [] {
));
table.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL
_COLUMNS);
jScrollPane2.setViewportView(table);
if (table.getColumnModel().getColumnCount() > 0) {
table.getColumnModel().getColumn(0).setPreferredWidth(40);
table.getColumnModel().getColumn(1).setPreferredWidth(210);
table.getColumnModel().getColumn(2).setPreferredWidth(150);
table.getColumnModel().getColumn(3).setPreferredWidth(40);
table.getColumnModel().getColumn(4).setPreferredWidth(40);
table.getColumnModel().getColumn(5).setPreferredWidth(40);
getContentPane().add(jScrollPane2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(300, 330, 778,
262));
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(750, 230, 160,
26));
jButton2.setText("Home");
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(350, 620, 94, -
1));
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(530, 620, 105, -
1));
jButton4.setText("Return Book");
jButton4.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
});
getContentPane().add(jButton4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(700, 620, -1, -
1));
jButton5.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
});
getContentPane().add(jButton5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(870, 620, -1, -
1));
jLabel1.setText("Book Details");
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(580, 180, -1, -
1));
getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
jLabel3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/new
back.jpg"))); // NOI18N
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
}// </editor-fold>
c1.disable();c2.disable();
txt1.enable();
private void
txt1ActionPerformed(java.awt.event.ActionEvent evt) {
}
private void r2ActionPerformed(java.awt.event.ActionEvent
evt) {
txt1.disable();
c1.enable();
try
connect();
rs=stmt.executeQuery(query);
DefaultTableModel
model=(DefaultTableModel)table.getModel();
model.setRowCount(0);
while(rs.next())
Object[] row =
{rs.getString("BookId"),rs.getString("BookName"),rs.getString("A
uthorName"),rs.getString("Stream"),rs.getString("Class"),rs.getSt
ring("Available")};
model.addRow(row);
disconnect();
catch(Exception e)
System.out.println(e);
c2.enable();
if(c1.getSelectedItem()=="Science")
c2.removeAllItems();
c2.addItem("Select
Class");c2.addItem("FYBScCS");c2.addItem("SYBScCS");c2.addIt
em("TYBScCS");
}
if(c1.getSelectedItem()=="Arts")
c2.removeAllItems();
c2.addItem("Select
Class");c2.addItem("FYBA");c2.addItem("SYBA");c2.addItem("TY
BA");
if(c1.getSelectedItem()=="Commerce")
c2.removeAllItems();
c2.addItem("Select
Class");c2.addItem("FYBCom");c2.addItem("SYBCom");c2.addIte
m("TYBCom");
DefaultTableModel
model=(DefaultTableModel)table.getModel();
model.setRowCount(0);
String txt=txt1.getText();
if(txt.equals(""))
System.out.println("");
else
{
try
connect();
rs=stmt.executeQuery(query);
while(rs.next())
Object[] row =
{rs.getString("BookId"),rs.getString("BookName"),rs.getString("A
uthorName"),rs.getString("Stream"),rs.getString("Class"),rs.getSt
ring("Available")};
model.addRow(row);
disconnect();
catch(Exception e)
System.out.println(e);
}
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
anb.setVisible(true);
this.setVisible(false);
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
mn.setVisible(true);
this.dispose();
private void
jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
ib.setVisible(true);
this.setVisible(false);
private void
jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
this.setVisible(false);
private void
jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
ibs.setVisible(true);
this.setVisible(false);
/**
*/
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(BookDetails.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(BookDetails.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(BookDetails.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException
ex) {
java.util.logging.Logger.getLogger(BookDetails.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new BookDetails().setVisible(true);
});
try
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/library?useSSL=false&autoRecon
nect=true","root","root");
stmt=con.createStatement();
catch(Exception e)
{
System.out.println(e);
JOptionPane.showMessageDialog(this,"connection
error");
try
con.close();
catch(Exception e)
{}
}
Return Book:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.swing.JOptionPane;
Connection con;
Statement stmt;
ResultSet rs;
String query;
Date date=new Date();
/**
*/
public ReturnBook() {
initComponents();
/**
*/
@SuppressWarnings("unchecked")
t1 = new javax.swing.JTextField();
t2 = new javax.swing.JTextField();
t3 = new javax.swing.JTextField();
t4 = new javax.swing.JTextField();
t6 = new javax.swing.JTextField();
t5 = new javax.swing.JTextField();
setUndecorated(true);
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setText("Return Book");
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(560, 170, -1, -
1));
jLabel2.setText("Student Id");
getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(530, 240, -1, -
1));
t1.addActionListener(new java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
t1ActionPerformed(evt);
});
t1.addKeyListener(new java.awt.event.KeyAdapter() {
t1KeyReleased(evt);
});
getContentPane().add(t1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(690, 230, 118, -
1));
jLabel3.setText("Student Name");
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(530, 290, -1, -
1));
t2.setEnabled(false);
getContentPane().add(t2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(690, 280, 207, -
1));
jLabel4.setText("Book Id");
getContentPane().add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(530, 330, -1, -
1));
t3.setEnabled(false);
getContentPane().add(t3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(690, 330, 122, -
1));
jLabel5.setText("Book name");
getContentPane().add(jLabel5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(530, 390, -1, -
1));
getContentPane().add(t4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(690, 390, 302, -
1));
jLabel6.setText("Return Date");
getContentPane().add(jLabel6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(530, 490, -1, -
1));
t6.setEnabled(false);
getContentPane().add(t6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(690, 490, 127, -
1));
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(550, 530, -1, -
1));
jButton2.setText("Cancel");
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(730, 530, -1, -
1));
jButton3.setText("Home");
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(440, 600, -1, -
1));
jButton4.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
});
getContentPane().add(jButton4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(550, 600, -1, -
1));
jButton5.setText("Issue Book");
jButton5.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
});
getContentPane().add(jButton5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(730, 600, -1, -
1));
jButton6.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
});
getContentPane().add(jButton6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(870, 600, -1, -
1));
jLabel7.setText("Issued On");
getContentPane().add(jLabel7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(530, 450, -1, -
1));
t5.setEnabled(false);
getContentPane().add(t5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(690, 440, 127, -
1));
getContentPane().add(jLabel8, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
jLabel9.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/new
back.jpg"))); // NOI18N
getContentPane().add(jLabel9, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
}// </editor-fold>
}
private void
jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
mn.setVisible(true);
this.setVisible(false);
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
mn.setVisible(true);
this.setVisible(false);
private void
jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
bd.setVisible(true);
this.setVisible(false);
private void
jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
IssueBook ib=new IssueBook();
ib.setVisible(true);
this.setVisible(false);
private void
jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
ibs.setVisible(true);
this.setVisible(false);
try
connect();
rs=stmt.executeQuery(query);
int i=0;
while(rs.next())
i++;
t2.setText(rs.getString("StudentName"));
t3.setText(rs.getString("BookId"));
t4.setText(rs.getString("BookName"));
t5.setText(rs.getString("IssueDate"));
disconnect();
if(i==0)
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
catch(Exception e)
System.out.println(e);
t6.setText(format.format(date));
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
try
connect();
rs=stmt.executeQuery(query);
if(rs.next())
query+=t2.getText()+"','"+t3.getText()+"','"+t4.getText()+"','"+t5.g
etText()+"','"+t6.getText()+"');";
stmt.executeUpdate(query);
stmt.executeUpdate(query);
stmt.executeUpdate(query);
disconnect();
JOptionPane.showMessageDialog(this,"Thank you!
visit again");
t4.setText("");
t1.setText("");
t2.setText("");
t3.setText("");
t5.setText("");
else
JOptionPane.showMessageDialog(this,"No book is
issued on this id currently");
catch(SQLException e)
JOptionPane.showMessageDialog(this,e);
/**
*/
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(ReturnBook.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(ReturnBook.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException
ex) {
java.util.logging.Logger.getLogger(ReturnBook.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new ReturnBook().setVisible(true);
});
try
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/library?useSSL=false&autoRecon
nect=true","root","root");
stmt=con.createStatement();
catch(Exception e)
System.out.println(e);
JOptionPane.showMessageDialog(this,"connection
error");
try
con.close();
catch(Exception e)
{}
}
// Variables declaration - do not modify
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
Connection con;
Statement stmt;
String query;
/**
*/
public AddNewBook() {
initComponents();
}
/**
*/
@SuppressWarnings("unchecked")
c3 = new javax.swing.JComboBox<>();
c4 = new javax.swing.JComboBox<>();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_
ON_CLOSE);
setUndecorated(true);
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel1.setText("Book Id");
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(350, 230, -1, -
1));
txt2.setFont(new java.awt.Font("Tahoma", 0, 14)); //
NOI18N
getContentPane().add(txt2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(470, 230, 160, -
1));
jLabel2.setText("Book Name");
getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(350, 290, -1, -
1));
getContentPane().add(txt3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(470, 280, 160, -
1));
jLabel3.setText("Author");
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(350, 330, -1, -
1));
txt4.setFont(new java.awt.Font("Tahoma", 0, 14)); //
NOI18N
getContentPane().add(txt4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(470, 320, 160, -
1));
jLabel4.setText("Stream");
getContentPane().add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(350, 380, -1, -
1));
jLabel5.setText("Class");
getContentPane().add(jLabel5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(350, 430, -1, -
1));
jButton1.setText("Add");
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(350, 480, 116, -
1));
jButton2.setText("Cancel");
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(530, 480, 104, -
1));
c3.setModel(new
javax.swing.DefaultComboBoxModel<>(new String[] { "Select
Stream", "Commerce", "Science", "Arts" }));
c3.addActionListener(new java.awt.event.ActionListener()
{
public void
actionPerformed(java.awt.event.ActionEvent evt) {
c3ActionPerformed(evt);
});
getContentPane().add(c3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(470, 380, 160, -
1));
c4.setModel(new
javax.swing.DefaultComboBoxModel<>(new String[] { "Select
Class" }));
c4.addActionListener(new java.awt.event.ActionListener()
{
public void
actionPerformed(java.awt.event.ActionEvent evt) {
c4ActionPerformed(evt);
});
getContentPane().add(c4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(470, 430, 160, -
1));
getContentPane().add(jLabel6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(330, 170, -1, -
1));
jButton3.setText("Home");
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(330, 560, -1, -
1));
jButton4.setText("Issue Book");
jButton4.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
});
getContentPane().add(jButton4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(440, 560, -1, -
1));
jButton5.setBackground(new java.awt.Color(0, 102, 102));
jButton5.setText("Return Book");
jButton5.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
});
getContentPane().add(jButton5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(580, 560, -1, -
1));
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
});
getContentPane().add(jButton6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(710, 560, -1, -
1));
jButton7.setText("Book Details");
jButton7.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton7ActionPerformed(evt);
});
getContentPane().add(jButton7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(880, 560, -1, -
1));
getContentPane().add(jLabel7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
jLabel8.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/new
back.jpg"))); // NOI18N
getContentPane().add(jLabel8, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
}// </editor-fold>
if(c3.getSelectedItem()=="Science")
c4.removeAllItems();
c4.addItem("Select
Class");c4.addItem("FYBScCS");c4.addItem("SYBScCS");c4.addIt
em("TYBScCS");
if(c3.getSelectedItem()=="Arts")
c4.removeAllItems();
c4.addItem("Select
Class");c4.addItem("FYBA");c4.addItem("SYBA");c4.addItem("TY
BA");
if(c3.getSelectedItem()=="Commerce")
c4.removeAllItems();
c4.addItem("Select
Class");c4.addItem("FYBCom");c4.addItem("SYBCom");c4.addIte
m("TYBCom");
private void
jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
mn.setVisible(true);
this.setVisible(false);
}
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
mn.setVisible(true);
this.setVisible(false);
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
if(txt2.getText().equals(""))
JOptionPane.showMessageDialog(this,"Please enter
Book id");
else if(txt3.getText().equals(""))
JOptionPane.showMessageDialog(this,"Please enter
Book name");
else if(txt4.getText().equals(""))
JOptionPane.showMessageDialog(this,"Please enter
author name");
JOptionPane.showMessageDialog(this,"Please select
stream");
else
try
connect();
stmt.executeUpdate(query);
disconnect();
txt2.setText("");
txt3.setText("");
txt4.setText("");
c3.setSelectedIndex(0);
c4.removeAllItems();
c4.addItem("Select Class");
catch(SQLException e)
{
if(e.getErrorCode()==1062)
JOptionPane.showMessageDialog(this,"BookId is a
primary key\nduplicate entry is not allowed\nit should be
unique");
else
JOptionPane.showMessageDialog(this,"connection
error");
private void
jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
ib.setVisible(true);
this.setVisible(false);
private void
jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
rb.setVisible(true);
this.setVisible(false);
private void
jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
ibs.setVisible(true);
this.setVisible(false);
private void
jButton7ActionPerformed(java.awt.event.ActionEvent evt) {
bd.setVisible(true);
this.setVisible(false);
/**
*/
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(AddNewBook.class.getName())
.log(java.util.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(AddNewBook.class.getName())
.log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException
ex) {
java.util.logging.Logger.getLogger(AddNewBook.class.getName())
.log(java.util.logging.Level.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
new AddNewBook().setVisible(true);
});
try
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/library?useSSL=false&autoRecon
nect=true","root","root");
stmt=con.createStatement();
catch(Exception e)
JOptionPane.showMessageDialog(this,"connection
error");
try
con.close();
catch(Exception e)
{}
}
// Variables declaration - do not modify
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
Connection con;
Statement stmt;
ResultSet rs;
String query;
/**
*/
public IssuedBooks() {
initComponents();
/**
*/
@SuppressWarnings("unchecked")
c1 = new javax.swing.JComboBox<>();
c2 = new javax.swing.JComboBox<>();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_
ON_CLOSE);
setUndecorated(true);
getContentPane().setLayout(new
org.netbeans.lib.awtextra.AbsoluteLayout());
getContentPane().add(jLabel1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(490, 170, -1, -
1));
table.setModel(new javax.swing.table.DefaultTableModel(
},
new String [] {
));
jScrollPane1.setViewportView(table);
if (table.getColumnModel().getColumnCount() > 0) {
table.getColumnModel().getColumn(0).setPreferredWidth(40);
table.getColumnModel().getColumn(1).setPreferredWidth(150);
table.getColumnModel().getColumn(2).setPreferredWidth(30);
table.getColumnModel().getColumn(3).setPreferredWidth(150);
table.getColumnModel().getColumn(4).setPreferredWidth(200);
table.getColumnModel().getColumn(5).setPreferredWidth(60);
}
getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(290, 300, 828,
246));
jButton1.setText("Home");
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(290, 580, -1, -
1));
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(400, 580, -1, -
1));
jButton3.setText("AddNewBook");
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(550, 580, -1, -
1));
jButton4.setText("Issue Book");
jButton4.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
});
getContentPane().add(jButton4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(700, 580, -1, -
1));
jButton5.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
});
getContentPane().add(jButton5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(840, 580, -1, -
1));
jButton6.setText("Student Registration");
jButton6.addActionListener(new
java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton6ActionPerformed(evt);
});
getContentPane().add(jButton6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(980, 580, -1, -
1));
c1.setModel(new
javax.swing.DefaultComboBoxModel<>(new String[] { "Select
Stream", "Commerce", "Science", "Arts" }));
c1.addActionListener(new java.awt.event.ActionListener()
{
public void
actionPerformed(java.awt.event.ActionEvent evt) {
c1ActionPerformed(evt);
});
getContentPane().add(c1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(460, 220, -1, -
1));
c2.setModel(new
javax.swing.DefaultComboBoxModel<>(new String[] { "Select
Class" }));
c2.addActionListener(new java.awt.event.ActionListener()
{
public void
actionPerformed(java.awt.event.ActionEvent evt) {
c2ActionPerformed(evt);
});
getContentPane().add(c2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(810, 220, -1, -
1));
jLabel2.setText("Stream");
getContentPane().add(jLabel2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(390, 220, -1, -
1));
jLabel3.setText("Class");
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(750, 220, -1, -
1));
getContentPane().add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
jLabel5.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/new
back.jpg"))); // NOI18N
getContentPane().add(jLabel5, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
}// </editor-fold>
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
mn.setVisible(true);
this.setVisible(false);
if(c1.getSelectedItem()=="Science")
c2.removeAllItems();
c2.addItem("Select
Class");c2.addItem("FYBScCS");c2.addItem("SYBScCS");c2.addIt
em("TYBScCS");
}
if(c1.getSelectedItem()=="Arts")
c2.removeAllItems();
c2.addItem("Select
Class");c2.addItem("FYBA");c2.addItem("SYBA");c2.addItem("TY
BA");
if(c1.getSelectedItem()=="Commerce")
c2.removeAllItems();
c2.addItem("Select
Class");c2.addItem("FYBCom");c2.addItem("SYBCom");c2.addIte
m("TYBCom");
try
connect();
rs=stmt.executeQuery(query);
DefaultTableModel
model=(DefaultTableModel)table.getModel();
model.setRowCount(0);
while(rs.next())
Object[] row =
{rs.getString("StudentId"),rs.getString("StudentName"),rs.getStri
ng("BookId"),rs.getString("BookName"),rs.getString("Address"),rs
.getString("IssueDate")};
model.addRow(row);
catch(Exception e)
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
bd.setVisible(true);
this.setVisible(false);
}
private void
jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
anb.setVisible(true);
this.setVisible(false);
private void
jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
ib.setVisible(true);
this.setVisible(false);
private void
jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
rb.setVisible(true);
this.setVisible(false);
private void
jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
RegisterStudent r=new RegisterStudent();
r.setVisible(true);
this.setVisible(false);
/**
*/
*/
try {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
java.util.logging.Logger.getLogger(IssuedBooks.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(IssuedBooks.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
java.util.logging.Logger.getLogger(IssuedBooks.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException
ex) {
java.util.logging.Logger.getLogger(IssuedBooks.class.getName()).
log(java.util.logging.Level.SEVERE, null, ex);
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new IssuedBooks().setVisible(true);
});
try
Class.forName("com.mysql.jdbc.Driver");
con=DriverManager.getConnection(
"jdbc:mysql://localhost:3306/library?useSSL=false&autoRecon
nect=true","root","root");
stmt=con.createStatement();
catch(Exception e)
JOptionPane.showMessageDialog(this,"connection
error");
}
public void disconnect()
try
con.close();
catch(Exception e)
{}
}
Screen :
Login:
Main Layer:
Student Register:
Issue Book:
Issue Book Details:
Return Book:
Conclusion: