Advjava Report
Advjava Report
DEPARMENT OF
COMPUTER ENGNIEERING
3. LITERATURE REVIEW:
a. Brief Introduction:
b. Technology used :
c. Assumptions :
2 Processor - Intel-i5
3 RAM - 8 GB
• ER Diagram:
• Database:
• Java:
SOURCE CODE :
import javax.swing.*;
import java.awt.*; import
java.awt.event.*; import
java.sql.*;
import javax.swing.table.DefaultTableModel;
hn = new JLabel("LIBRARY
SYSTEM"); lg = new
JLabel("LOGIN"); un =
new JLabel("USERNAME");
pa = new JLabel("PASSWORD");
txtun=new
JTextField(); txtpa=new
JPasswordField(); btnOk=new
JButton("OK"); btnCan=new
JButton("CANCEL");
Font f1=new
Font("Arial",Font.BOLD,30);
pa.setFont(f1); lg.setFont(f1);
un.setFont(f1);
hn.setForeground(Color.yellow); lg.setForeground(Color.blue);
un.setForeground(Color.black); pa.setForeground(Color.black);
Background.setBounds(0,0,750,700);
hn.setBounds(150,100,600,100);
lg.setBounds(330,200,600,100);
un.setBounds(150,300,600,100);
pa.setBounds(150,370,600,100);
txtun.setBounds(450,340,200,30);
txtpa.setBounds(450,405,200,30);
btnOk.setBounds(250,570,100,40);
btnCan.setBounds(400,570,100,40);
btnOk.addActionListener(this);
btnCan.addActionListener(this);
c.add(Background);
Background.add(hn);
Background.add(lg);
Background.add(un);
Background.add(pa);
Background.add(txtun);
Background.add(txtpa);
Background.add(btnOk);
Background.add(btnCan);
}
public void actionPerformed(ActionEvent e)
{
String user = txtun.getText();
String pass = txtpa.getText();
if(user.equals("Admin") && pass.equals("TYCM4"))
{
if(e.getSource()==btnOk)
{
JOptionPane.showMessageDialog(null, "Successfully Login!!");
setVisible(false);
new LibraryHome();
}
}
else
{
JOptionPane.showMessageDialog(null, "Invalid Username &
Password");
}
}
public static void main(String args[])
{
Login lh1=new Login();
lh1.setSize(750,700);
lh1.setVisible(true);
lh1.setTitle("Library Management System");
lh1.setDefaultCloseOperation(EXIT_ON_CLOSE);
}
}
class LibraryHome extends JFrame implements ActionListener
{
JButton b1,b2,b3,b4,b5,b6;
JLabel l1,l2;
LibraryHome()
{
Container c=getContentPane();
c.setLayout(null);
l1.setBounds(0,0,1200,700);
l2.setBounds(300,100,600,100);
b1.setBounds(120,300,280,70);
b2.setBounds(470,300,280,70);
b3.setBounds(820,300,280,70);
b4.setBounds(120,500,280,70);
b5.setBounds(470,500,280,70);
b6.setBounds(820,500,280,70);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b6.addActionListener(this);
c.add(l1);
l1.add(l2);
l1.add(b1);
l1.add(b2);
l1.add(b3); l1.add(b4);
l1.add(b5); l1.add(b6);
setVisible(true);
setTitle("Library Home");
setSize(1200,700);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{
NewStudent ns1=new NewStudent();
}
else if(ae.getSource()==b2)
{
NewBook nb1=new NewBook();
}
else if(ae.getSource()==b3)
{
Statistics s1=new Statistics();
}
else if(ae.getSource()==b4)
{
IssueBook n1=new IssueBook();
}
else if(ae.getSource()==b5)
{
ReturnBook n1=new ReturnBook();
}
else if(ae.getSource()==b6)
{
int res=JOptionPane.showConfirmDialog(null,"Do you want to logout
the serviece?");
if(res==JOptionPane.OK_OPTION)
{
setVisible(false);
}
}
}
}
class NewStudent extends JFrame implements ActionListener
{
JTextField tf1,tf2,tf3,tf4;
JButton btn1,btn2;
NewStudent()
{
setLayout(null);
ImageIcon ic1=new ImageIcon("Frame.jpg");
JLabel jl1=new JLabel(ic1);
ImageIcon ic3=new
ImageIcon("Update.png"); btn2=new
JButton("Update",ic3); tf1=new JTextField(10);
tf2=new JTextField(10); tf3=new
JTextField(10); tf4=new JTextField(10);
Font f1=new
Font("Arial",Font.BOLD,25);
jl2.setFont(f1); jl3.setFont(f1);
jl4.setFont(f1);
jl5.setFont(f1); btn1.setFont(f1);
btn2.setFont(f1);
jl1.setBounds(0,0,700,600);
jl2.setBounds(100,150,200,50);
jl3.setBounds(100,230,200,50);
jl4.setBounds(100,310,200,50);
jl5.setBounds(100,390,200,50);
jl6.setBounds(150,30,600,50);
btn1.setBounds(120,470,200,50); btn2.setBounds(350,470,200,50);
tf1.setBounds(400,150,200,40); tf2.setBounds(400,230,200,40);
tf3.setBounds(400,310,200,40);
tf4.setBounds(400,390,200,40);
btn1.addActionListener(this);
btn2.addActionListener(this);
add(jl1);
jl1.add(jl2);
jl1.add(jl3);
jl1.add(jl4);
jl1.add(jl5);
jl1.add(jl6);
jl1.add(btn1);
jl1.add(btn2);
jl1.add(tf1);
jl1.add(tf2);
jl1.add(tf3);
jl1.add(tf4);
setVisible(true);
setTitle("Add New Student");
setSize(700,600);
}
public void actionPerformed(ActionEvent ae)
{ try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","syste m");
System.out.println("Database Connection Successfull!!!");
Statement stmt=con.createStatement();
if(ae.getSource()==btn1)
{
int cnt=stmt.executeUpdate("insert into Student
values('"+tf1.getText()+"',"+Integer.parseInt(tf2.getText())+",'"+tf3.getText()+"',"+Long.par
seLong(tf4.getText())+")");
System.out.println("record insert successfully "+cnt);
if(cnt>0)
JOptionPane.showMessageDialog(null,"Record Saved
Successfully!!!");
else
JOptionPane.showMessageDialog(null,"Record Not
Saved!!!");
}
else
{
int cnt=stmt.executeUpdate("update Student set
sname='"+tf1.getText()+"',rollno="+Integer.parseInt(tf2.getText())+",
branch='"+tf3.getText()+"',mobileno="+Integer.parseInt(tf4.getText())+" where
rollno="+Integer.parseInt(tf2.getText()));
System.out.println("record update successfully "+cnt);
if(cnt>0)
JOptionPane.showMessageDialog(null,"Record Updated
Successfully!!!");
else
JOptionPane.showMessageDialog(null,"Record Not
Updated!!!");
}
ResultSet rs=stmt.executeQuery("select * from Student");
while(rs.next())
{
System.out.println(rs.getString(1)+" "+rs.getInt(2)+"
"+rs.getString(3)+" "+rs.getLong(4));
}
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
setVisible(false);
}
}
class NewBook extends JFrame implements ActionListener
{
JTextField tf1,tf2,tf3,tf4;
JButton btn1,btn2;
NewBook()
{
setLayout(null);
ImageIcon ic1=new ImageIcon("Frame.jpg");
JLabel jl1=new JLabel(ic1);
Font f1=new
Font("Arial",Font.BOLD,25);
jl2.setFont(f1); jl3.setFont(f1);
jl4.setFont(f1);
jl5.setFont(f1); btn1.setFont(f1);
btn2.setFont(f1);
jl1.setBounds(0,0,700,600); jl2.setBounds(100,150,200,50);
jl3.setBounds(100,230,200,50);
jl4.setBounds(100,310,200,50);
jl5.setBounds(100,390,200,50);
jl6.setBounds(150,30,600,50);
btn1.setBounds(120,470,200,50);
btn2.setBounds(350,470,200,50);
tf1.setBounds(400,150,200,40);
tf2.setBounds(400,230,200,40);
tf3.setBounds(400,310,200,40);
tf4.setBounds(400,390,200,40);
btn1.addActionListener(this);
btn2.addActionListener(this);
add(jl1);
jl1.add(jl2);
jl1.add(jl3);
jl1.add(jl4);
jl1.add(jl5);
jl1.add(jl6);
jl1.add(btn1);
jl1.add(btn2);
jl1.add(tf1);
jl1.add(tf2); jl1.add(tf3);
jl1.add(tf4); setVisible(true);
setTitle("Add New Book");
setSize(700,600);
}
public void actionPerformed(ActionEvent ae)
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","syste m");
System.out.println("Database Connection Successfull!!!");
Statement stmt=con.createStatement();
if(ae.getSource()==btn1)
{
int cnt=stmt.executeUpdate("insert into Book
values('"+tf1.getText()+"',"+Integer.parseInt(tf2.getText())+",'"+tf3.getText()+"',"+Integer.p
arseInt(tf4.getText())+")");
System.out.println("record insert successfully "+cnt);
if(cnt>0)
JOptionPane.showMessageDialog(null,"Book Record
Saved Successfully!!!");
else
JOptionPane.showMessageDialog(null,"Book Not
Issued!!!");
}
else
{
int cnt=stmt.executeUpdate("update Book set
bname='"+tf1.getText()+"',bid="+Integer.parseInt(tf2.getText())+",
publisher='"+tf3.getText()+"',price="+Integer.parseInt(tf4.getText())+" where
bid="+Integer.parseInt(tf2.getText()));
System.out.println("record update successfully "+cnt);
if(cnt>0)
JOptionPane.showMessageDialog(null,"Record Updated
Successfully!!!");
else
JOptionPane.showMessageDialog(null,"Record Not
Updated!!!");
}
ResultSet rs=stmt.executeQuery("select * from Book");
while(rs.next())
{
System.out.println(rs.getString(1)+" "+rs.getInt(2)+"
"+rs.getString(3)+" "+rs.getInt(4));
}
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
setVisible(false);
}
}
class Statistics extends JFrame
{
JTable jt;
JScrollPane jsp;
Statistics()
{
setLayout(null);
ImageIcon ic1=new ImageIcon("Frame.jpg");
JLabel jl1=new JLabel(ic1);
JLabel jl2=new JLabel("Books Details");
JLabel jl3=new JLabel("Issued Books Details");
Font f1=new
Font("Arial",Font.BOLD|Font.ITALIC,30);
jl2.setForeground(Color.yellow);
jl3.setForeground(Color.yellow); jl2.setFont(f1);
jl3.setFont(f1);
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","syste m");
System.out.println("Database Connection Successfull!!!");
Statement stmt1=con.createStatement();
Statement stmt2=con.createStatement();
ResultSetMetaData rsmd1=rs1.getMetaData();
ResultSetMetaData rsmd2=rs2.getMetaData();
DefaultTableModel model1=(DefaultTableModel)j1.getModel();
DefaultTableModel model2=(DefaultTableModel)j2.getModel();
int cols1=rsmd1.getColumnCount();
int cols2=rsmd2.getColumnCount();
String[] colName1=new String[cols1];
String[] colName2=new String[cols2];
for(int i=0; i<cols1; i++)
{
colName1[i]=rsmd1.getColumnName(i+1);
}
for(int i=0; i<cols2; i++)
{
colName2[i]=rsmd2.getColumnName(i+1);
}
model1.setColumnIdentifiers(colName1);
model2.setColumnIdentifiers(colName2);
//fetching data
while(rs1.next())
{
String bname=rs1.getString(1);
String bid=Integer.toString(rs1.getInt(2));
String publisher=rs1.getString(3);
String price=Integer.toString(rs1.getInt(4));
String tData1[]={bname,bid,publisher,price};
model1.addRow(tData1);
}
while(rs2.next())
{
String bid=Integer.toString(rs2.getInt(1));
String rollno=Integer.toString(rs2.getInt(2));
String idate=rs2.getString(3);
String ddate=rs2.getString(4);
String tData2[]={bid,rollno,idate,ddate};
model2.addRow(tData2);
}
con.close();
}
catch(Exception e)
{
System.out.println(e);
}
jl1.setBounds(0,0,800,600); jl2.setBounds(150,30,600,50);
jl3.setBounds(150,330,600,50);
jsp1.setBounds(50,100,700,175);
jsp2.setBounds(50,400,700,150);
add(jl3);
add(jl2);
add(jsp1);
add(jsp2);
add(jl1);
setVisible(true);
setTitle("statistics of Books");
setSize(800,600);
}
}
class IssueBook extends JFrame implements ActionListener
{
JTextField tf1,tf2,tf3,tf4;
JButton btn;
IssueBook()
{
setLayout(null);
ImageIcon ic1=new ImageIcon("Frame.jpg");
JLabel jl1=new JLabel(ic1);
Font f1=new
Font("Arial",Font.BOLD,25);
jl2.setFont(f1); jl3.setFont(f1);
jl4.setFont(f1);
jl5.setFont(f1); btn.setFont(f1);
jl1.setBounds(0,0,700,600);
jl2.setBounds(100,150,200,50);
jl3.setBounds(100,230,200,50);
jl4.setBounds(100,310,320,50);
jl5.setBounds(100,390,325,50); jl6.setBounds(150,30,600,50);
btn.setBounds(250,470,150,50);
tf1.setBounds(400,150,200,40);
tf2.setBounds(400,230,200,40);
tf3.setBounds(400,310,200,40);
tf4.setBounds(400,390,200,40);
btn.addActionListener(this);
add(jl1);
jl1.add(jl2);
jl1.add(jl3);
jl1.add(jl4);
jl1.add(jl5);
jl1.add(jl6);
jl1.add(btn);
jl1.add(tf1);
jl1.add(tf2);
jl1.add(tf3);
jl1.add(tf4);
setVisible(true);
setTitle("Issue Book");
setSize(700,600);
}
public void actionPerformed(ActionEvent ae)
{
try
{ Class.forName("oracle.jdbc.driver.OracleDriver");
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","syste m");
System.out.println("Database Connection Successfull!!!");
Statement stmt=con.createStatement();
Font f1=new
Font("Arial",Font.BOLD,25); jl2.setFont(f1);
jl3.setFont(f1);
jl4.setFont(f1); jl5.setFont(f1);
btn.setFont(f1);
jl1.setBounds(0,0,700,600);
jl2.setBounds(100,150,200,50);
jl3.setBounds(100,230,200,50);
jl4.setBounds(100,310,310,50);
jl5.setBounds(100,390,310,50);
jl6.setBounds(150,30,600,50);
btn.setBounds(230,470,200,50);
tf1.setBounds(400,150,200,40);
tf2.setBounds(400,230,200,40);
tf3.setBounds(400,310,200,40);
tf4.setBounds(400,390,200,40);
btn.addActionListener(this);
add(jl1);
jl1.add(jl2);
jl1.add(jl3);
jl1.add(jl4);
jl1.add(jl5);
jl1.add(jl6); jl1.add(btn);
jl1.add(tf1); jl1.add(tf2);
jl1.add(tf3);
jl1.add(tf4);
setVisible(true);
setTitle("Return Book");
setSize(700,600);
}
public void actionPerformed(ActionEvent ae)
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection
con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","syste m");
System.out.println("Database Connection Successfull!!!");
Statement stmt=con.createStatement();
To, Develop the best fit system to the library .A library has ability to
perform any task in the library successfully. The library professionals are
manager of library and information center, they should have some basic
managerial skills for managing the different sections of the library. In this
project we develop some skills like Technical skill, Human skill, Conceptual
skill, Presentation skill, Communication skill, Planning skill, etc. It can be
develop without formalized training for some.
1. Object-Oriented Programming:
Object Oriented Programming approach introduces class and object style
of coding that deals with the concepts of inheritance, encapsulation, abstraction,
polymorphism. We have used various OOP features to bind the data and
function together, so as to improve stability and safety.
3. Packages in Java:
Java package is an advanced level of achieving abstraction in the Java
Programming Language. We have understood and implemented various
predefined packages in Java and various methods present in it. It enables a
better and efficient way of achieving abstraction in java.
5. Teamwork:
We develop this skill which consists of a collaborative effort of a team to
achieve common goal and to complete a project in the effective way.
9. APPLICATIONS OF THIS MICRO-PROJECT:
• A library management system is software that uses to maintain the record of the
library.
• It contain work like the number of available books in the library.
• The number of books are issued or returning or renewing a book or late fine charge
record.
• It eliminates paper-based process and reduces operation cost and saves time of the
library management .
• The paper based process might incur data loss,However in case of library
management system it is much secure and reliable.
10. References:
• https://github.com/topics/library-management-system?l=java
• https://www.geeksforgeeks.org/library-management-system-usingswitch-
statement-in-java/
• https://www.edureka.co/blog/library-management-system-project-injava
• https://www.javatpoint.com/library-management-system-in-java-swing