Professional Documents
Culture Documents
AJ File
AJ File
ON
“LIBRARY MANAGEMENT SYSTEM”
&
“CALCULATOR”
Submitted in partial fulfilment
Overview
A calculator is a device that performs arithmetic operations on numbers. Basic calculators can
do only addition, subtraction, multiplication and division mathematical calculations.
Calculators are simply a tool students use to help solve problems. Since they eliminate
tedious computations and algebraic manipulations that discourage many students,
calculators allow more students to solve problems and appreciate the power and value of
mathematics in the world today. The central aim of the project was to test the hypothesis that
providing so-called calculators would improve students' performance in those parts of
the
undergraduate first-year that relied on formal reasoning skills. GUI (Graphical User
Interface) in Java is an easy-to-use visual experience builder for Java applications. It is
mainly made of graphical components like buttons, labels, windows, etc. through which the
user can interact with an application. GUI plays an important role to build easy interfaces for
Java applications. GUI Component classes, such as Button , TextField , and Label . GUI
Container classes, such as Frame and Panel . Layout managers, such as FlowLayout ,
BorderLayout and GridLayout . Custom graphics classes, such as Graphics , Color and Font .
public class mycal extends javax.swing.JFrame {
double num1=0,num2=0;
String operator=null;
public mycal() {
initComponents();
}
@SuppressWarnings("unchecked")
private void initComponents() {
B7.setText("7");
B7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
B7ActionPerformed(evt);
}
});
B2.setText("2");
B2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
B2ActionPerformed(evt);
}
});
B3.setText("3");
B3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
B3ActionPerformed(evt);
}
});
B4.setText("4");
B4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
B4ActionPerformed(evt);
}
});
B8.setText("8");
B8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
B8ActionPerformed(evt);
}
});
B9.setText("9");
B9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
B9ActionPerformed(evt);
}
});
Bdiv.setText("/");
Bdiv.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BdivActionPerformed(evt);
}
});
B5.setText("5");
B5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
B5ActionPerformed(evt);
}
});
Badd.setText("+");
Badd.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BaddActionPerformed(evt);
}
});
B6.setText("6");
B6.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
B6ActionPerformed(evt);
}
});
B1.setText("1");
B1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
B1ActionPerformed(evt);
}
});
Bsub.setText("-");
Bsub.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BsubActionPerformed(evt);
}
});
Bback.setFont(new java.awt.Font("Algerian", 0, 18)); // NOI18N
Bback.setText("BACK");
Bback.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BbackActionPerformed(evt);
}
});
B0.setText("0");
B0.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
B0ActionPerformed(evt);
}
});
Bdot.setText(".");
Bdot.setToolTipText("");
Bdot.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BdotActionPerformed(evt);
}
});
Bequal.setText("=");
Bequal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BequalActionPerformed(evt);
}
});
Bmul.setText("*");
Bmul.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BmulActionPerformed(evt);
}
});
pack();
}
}
private void B7ActionPerformed(java.awt.event.ActionEvent evt) {
t1.setText(t1.getText()+"7");
}
/**
* @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 and
feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(mycal.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(mycal.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(mycal.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(mycal.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);
}
//</editor-fold>
A Library Management System is a system that is used to maintain the records of the
library. It contains work like the number of the available books, the number of books
issued, the number of books to return or renew. It helps to maintain a database that is
useful to enter new books and records of books borrowed by the members with the
respective submission dates. It will reduce the manual work done by the librarian to
maintain the record of the library. It allows maintaining the resources in a more
operative manner that will help to save the time. It is also convenient for the librarian
to manage the process of books allocation. It is useful for students as well as a
librarian to keep the constant track of the availability of all books in a library.
This also includes a login page which provides a higher security so no one can access
the database info without permission.
SOFTWARE REQUIREMENTS:
1. JDK used: Java SE Development Kit 19.0.2
Download link:
https://downloads.apache.org/netbeans/netbeans-installers/16/Apache-
NetBeans-16-bin-windows-x64.exe.asc
Then go to Services > Databases (right click)> New connection > Browse sql Driver
Connector JDBC > NEXT > Enter User Name & Password > Next > Finish
Create a database and open main class and write connection provider code in main class.
Now connect this Connection Provider main class with every Java Page.
TABLE OF CONTENTS
1.login.java:
This page allow a user to gain access to an application by entering their username and
password or by authenticating using management system login.
a) Login1.jpeg
b) Login.png
c) Red-x-mark-transparent-background-3.png
2. home.java:
In this page we have six button and each button having different functionality.
a) library_Book_532388_1366x768.jpeg
b) member-add-on-300x300.png
c) New-book.png
d) issue book.png
e) Statistics.png
f) Exit.png
3. newStudent.java:
In this page we have multiple fields to get details of student .
a) 123456.png
b) Red-x-mark-transparent-background-3.png
c) Save-icon—1.png
4. newBook.java:
In this page we have multiple fields to add new book in our database.
a) 123456.png
b) Red-x-mark-transparent-background-3.png
c) Save-icon—1.png
5. IssueBook.java:
In this page is used to store the data of issued books .
a) 123456.png
b) Red-x-mark-transparent-background-3.png
c) Save-icon—1.png
6. ReturnBook.java:
This page is used to store the data of return books and available those books to the students.
a) Search.png
b) 123456.png
c) Red-x-mark-transparent-background-3.png
d) return-icon—1.png
7. Statistics.java:
In this page we can see details of issue books and return books.
a)123456.png
b) Red-x-mark-transparent-background-3.png
login.java
This page allow a user to gain access to an application by entering their username and
password or by authenticating using management system login.
This page connects you with the home page where you can enter or extract the data.
This page connects various pages together by using this page you can add a new
student data in the database, you can enter or add the details of new books or the data
of books which are present in the library, you can issue a book to a valid student
whose data exist into the database, you can check the details of the issued books with
the all the required details and if the page is not in need simply loged out from the
page .
This page is used to insert the data of new students into the database such as
studentID, Name, FatherName, CourseName and BranchName.
This page is used to insert the Books into the database such as BookID, Name,
Publisher, Price and Publisher Year.
This page is used to store the data of issued books ,date of issue, due date and
studentID which issues the book.
This page is used to store the data of return books and available those books to the
students for issue.
This page is used to show the statistics of return books and issue books.
Images used in this page-
123456.png- used as a background image of Frame.
Red-x-mark-transparent-background-3.png -used as a background image for close
button.
PROJECT(Connection Provider.java)
}
catch(Exception e)
{
System.out.println(e);
return null;
}
}
}
SOURCE CODE
1) login.java
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public loginPage() {
initComponents();
setExtendedState(JFrame.MAXIMIZED_BOTH);
}
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Login
background.PNG"))); // NOI18N
getContentPane().add(jLabel4, new
org.netbeans.lib.awtextra.AbsoluteConstraints(-80, 0, 1350, -1));
pack();
}// </editor-fold>
/**
* @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
and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(loginPage.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(loginPage.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(loginPage.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(loginPage.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
}
//</editor-fold>
public homePage() {
initComponents();
setExtendedState(MAXIMIZED_BOTH);
}
jLabel2.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/Library_Book_532388_1366x768.j
pg"))); // NOI18N
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
pack();
}// </editor-fold>
/**
* @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
and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(homePage.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(homePage.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(homePage.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(homePage.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
}
//</editor-fold>
import java.sql.*;
import Project.ConnectionProvider;
import javax.swing.JOptionPane;
public newStudent() {
initComponents();
}
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel7.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/123456.png"))); // NOI18N
getContentPane().add(jLabel7, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 700, -1));
pack();
}// </editor-fold>
String studentID=jTextField1.getText();
String name=jTextField2.getText();
String fatherName=jTextField3.getText();
String courseName=(String)jComboBox1.getSelectedItem();
String branchName=(String)jComboBox2.getSelectedItem();
try
{
Connection con=ConnectionProvider.getCon();
Statement st=con.createStatement();
st.executeUpdate("insert into stu
values('"+studentID+"','"+name+"','"+fatherName+"','"+courseName+"','"+branchNa
me+"')");
JOptionPane.showMessageDialog(null,"Successfully Updated");
setVisible(false);
new newStudent().setVisible(true);
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"Student ID Already Exist");
setVisible(false);
new newStudent().setVisible(true);
}
}
/**
* @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
and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(newStudent.class.getName()).log(java.util.logging
.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(newStudent.class.getName()).log(java.util.logging
.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(newStudent.class.getName()).log(java.util.logging
.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(newStudent.class.getName()).log(java.util.logging
.Level.SEVERE, null, ex);
}
//</editor-fold>
import Project.ConnectionProvider;
import java.sql.Connection;
import java.sql.Statement;
import javax.swing.JOptionPane;
import java.sql.*;
import java.text.SimpleDateFormat;
public class IssueBook extends javax.swing.JFrame {
public IssueBook() {
initComponents();
}
@SuppressWarnings("unchecked")
jLabel5.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/123456.png"))); // NOI18N
jLabel5.setText("hell");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setLocation(new java.awt.Point(325, 125));
setUndecorated(true);
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel6.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/123456.png"))); // NOI18N
getContentPane().add(jLabel6, new
org.netbeans.lib.awtextra.AbsoluteConstraints(-10, 0, -1, -1));
pack();
}// </editor-fold>
try
{
Connection con=ConnectionProvider.getCon();
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select *from book where
bookID='"+bookID+"'");
if(rs.next())
{
ResultSet rs1=st.executeQuery("select *from stu where
studentID='"+studentID+"'");
if(rs1.next())
{
st.executeUpdate("insert into issue
values('"+bookID+"','"+studentID+"','"+issueDate+"','"+dueDate+"','"+returnBook+"')
");
JOptionPane.showConfirmDialog(null,"Book Successfully Issued");
setVisible(false);
new IssueBook().setVisible(true);
}
else
{
JOptionPane.showConfirmDialog(null,"Incorrect StudentID");
}
}
else
{
JOptionPane.showConfirmDialog(null,"Incorrect BookID");
}
}
catch(Exception e)
{
JOptionPane.showConfirmDialog(null,"Connection error");
}
}
java.util.logging.Logger.getLogger(IssueBook.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(IssueBook.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(IssueBook.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(IssueBook.class.getName()).log(java.util.logging.
Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new IssueBook().setVisible(true);
}
});
}
import java.sql.*;
import Project.ConnectionProvider;
import javax.swing.JOptionPane;
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to
change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this
template
*/
/**
*
* @author HP
*/
public class returnBook extends javax.swing.JFrame {
/**
* Creates new form returnBook
*/
public returnBook() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel5.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/123456.png"))); // NOI18N
jLabel5.setText("jLabel5");
getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(0,
0, -1, -1));
pack();
}// </editor-fold>
}
else
JOptionPane.showMessageDialog(null," Book is not issued to this student.");
setVisible(false);
new returnBook().setVisible(true);
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,"Student Id already exist");
setVisible(false);
new newStudent().setVisible(true);
}
/**
* @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
and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/
plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(returnBook.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(returnBook.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(returnBook.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(returnBook.class.getName()).log(java.util.logging.Le
vel.SEVERE, null, ex);
}
//</editor-fold>
import java.sql.*;
import Project.ConnectionProvider;
import javax.swing.JOptionPane;
import net.proteanit.sql.DbUtils;
public Statistics() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setLocation(new java.awt.Point(325, 125));
setUndecorated(true);
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentShown(java.awt.event.ComponentEvent evt) {
formComponentShown(evt);
}
});
getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
getContentPane().add(jScrollPane1, new
org.netbeans.lib.awtextra.AbsoluteConstraints(30, 60, 614, 108));
getContentPane().add(jScrollPane2, new
org.netbeans.lib.awtextra.AbsoluteConstraints(30, 230, 614, 116));
jLabel3.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/123456.png"))); // NOI18N
getContentPane().add(jLabel3, new
org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, -1));
pack();
}// </editor-fold>
/**
* @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
and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Statistics.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Statistics.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Statistics.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Statistics.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
}
//</editor-fold>
1) https://youtu.be/ja_6e6CIyxY
2) https://youtu.be/-nup6K1z4Po