JLibrary Managment System Documentation

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 68

2019

Java Project
LIBRARY MANAGEMENT SYSTEM DOCUMENTATION
Introduction

There are 10 java files within the project each defining the GUI composition and database
Connection of the project. This project is prepared to facilitate and improve the way our university
library work and it can be optimize the regulation of this but in this documentation, we are not going to
explain how to use the software instated we will focus on explaining how each segment of code is used
to achieve respective task performed by the software.

Classes

There are several classes in jdk for so many purposes with well-equipped documentation but
they are not the only classes available for programmers since now a day thanks to internet we have to
many development teams and talented individuals all over the world contributing countless classes with
solutions for previously unavailable problems making the programing world efficient and fast. So, we
used both internal jdk and external custom classes to prepare the software. I group this classes in to two
and they are listed below.

Custom Classes

1. For GUI form


a. ADU_School_project.Home;
b. ADU_School_project.About;
c. ADU_School_project.Loger;
d. ADU_School_project.Adminstrator;
e. ADU_School_project.Option;
f. ADU_School_project.Appruve;
g. ADU_School_project.Book_Registration;
2. For Database
a. ADU_School_project.db;
3. For Data Cominication
a. ADU_School_project.Transfer;

Classes From JDK

1. For sql database


a. java.sql.Connection;
b. java.sql.PreparedStatement;
c. java.sql.ResultSet;
d. java.sql.SQLException;

2. for Swing and awt


a. java.awt.Dimension;
b. java.awt.HeadlessException;
c. java.awt.Toolkit;
d. javax.swing.JOptionPane;
e. javax.swing.UnsupportedLookAndFeelException;

3. for calander and time


a. java.util.Calendar;
b. java.util.GregorianCalendar;

Classes from Other Sources

1. For Theme
a. import com.jtattoo.plaf.aluminium.AluminiumLookAndFeel;
b. import com.jtattoo.plaf.hifi.HiFiLookAndFeel;
c. import com.jtattoo.plaf.mcwin.McWinLookAndFeel;

Source code For each GUI form and the hole Project

Home
package ADU_School_project;

import static ADU_School_project.Signup_Form.signichure;

import java.awt.Dimension;

import java.awt.HeadlessException;

import java.awt.Toolkit;

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import java.sql.SQLException;

import java.util.Calendar;

import java.util.GregorianCalendar;

import javax.swing.JOptionPane;

import javax.swing.UnsupportedLookAndFeelException;
public class Home extends javax.swing.JFrame {

static Connection conn = null;

static ResultSet rs = null;

static PreparedStatement pst = null;

String choice = "";

Calendar cal = new GregorianCalendar ();

int month = cal.get(Calendar.MONTH);

int year = cal.get(Calendar.YEAR);

int day = cal.get(Calendar.DATE);

int minute = cal.get(Calendar.MINUTE);

int Time = cal.get(Calendar.HOUR);

String dater = ""+day+"/"+month+"/"+year+"";

int glob=1;

String the_time="1 Hour";

public boolean timer(int initial,int initials,int glob){

if(glob!=0){

int elapseT = Time-initial;

if(elapseT==0){

return true;

}if(elapseT==1){

int y = 60 - initials;

int elapsed=minute+y;

if(elapsed<60){

return true;

}else{

return false;

}}else{return false; }
}else{return true; }}

private void combbomaster(){

cheak.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ADU_School_project/New.png")));

int x = type.getSelectedIndex();

if(x==0){

choice = "title";

}else if(x==1){

choice = "id";

} else if(x==2){

choice = "auter";

} else if(x==3){

choice = "collage";

} else{

choice = "department";

}}

public Home() {

initComponents();

feed = "no";

choice = "title";

conn = db.java_db();

Toolkit toolkit = getToolkit();

Dimension size = toolkit.getScreenSize();

setLocation(size.width/2 - getWidth()/2,size.height/2 - getHeight()/2);

private void initComponents() {

buttonGroup1 = new javax.swing.ButtonGroup();

p6 = new javax.swing.JPanel();
jLabel10 = new javax.swing.JLabel();

jButton2 = new javax.swing.JButton();

jPanel5 = new javax.swing.JPanel();

jPanel1 = new javax.swing.JPanel();

p2 = new javax.swing.JPanel();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

jLabel4 = new javax.swing.JLabel();

nam = new javax.swing.JTextField();

time = new javax.swing.JComboBox<>();

dep = new javax.swing.JTextField();

p3 = new javax.swing.JPanel();

jLabel5 = new javax.swing.JLabel();

collage = new javax.swing.JComboBox<>();

p4 = new javax.swing.JPanel();

jLabel6 = new javax.swing.JLabel();

jLabel8 = new javax.swing.JLabel();

appruve = new javax.swing.JButton();

cheak = new javax.swing.JLabel();

sname = new javax.swing.JTextField();

sid = new javax.swing.JTextField();

rip = new javax.swing.JLabel();

returning = new javax.swing.JButton();

p1 = new javax.swing.JPanel();

student_id = new javax.swing.JTextField();

type = new javax.swing.JComboBox<>();

jMenuBar1 = new javax.swing.JMenuBar();


jMenu1 = new javax.swing.JMenu();

jMenuItem1 = new javax.swing.JMenuItem();

jMenuItem11 = new javax.swing.JMenuItem();

jSeparator3 = new javax.swing.JPopupMenu.Separator();

jMenuItem3 = new javax.swing.JMenuItem();

jMenu6 = new javax.swing.JMenu();

about = new javax.swing.JMenuItem();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setTitle("Home");

setMinimumSize(new java.awt.Dimension(950, 550));

setPreferredSize(new java.awt.Dimension(950, 550));

p6.setBackground(new java.awt.Color(204, 204, 204));

jLabel10.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N

jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel10.setText("Librery managment");

jButton2.setText("Logout");

jButton2.addActionListener(new java.awt.event.ActionListener() {

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

jButton2ActionPerformed(evt);

});

org.jdesktop.layout.GroupLayout p6Layout = new org.jdesktop.layout.GroupLayout(p6);

p6.setLayout(p6Layout);

p6Layout.setHorizontalGroup(

p6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(p6Layout.createSequentialGroup()
.add(jLabel10, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)

.add(jButton2)

.add(21, 21, 21))

);

p6Layout.setVerticalGroup(

p6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(p6Layout.createSequentialGroup()

.add(p6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(p6Layout.createSequentialGroup()

.addContainerGap()

.add(jLabel10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 80,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))

.add(p6Layout.createSequentialGroup()

.add(28, 28, 28)

.add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 40,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))

.add(0, 0, Short.MAX_VALUE))

);

jPanel5.setBackground(new java.awt.Color(204, 204, 204));

p2.setBackground(new java.awt.Color(204, 204, 204));

jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14));

jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel2.setText("Book Name :");

jLabel3.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel3.setText("Department :");
jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel4.setText("Time :");

nam.setEditable(false);

nam.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

time.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

time.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "1 Hour", "2 Hour", "3


Hour", "4 Hour" }));

time.setEnabled(false);

dep.setEditable(false);

dep.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

org.jdesktop.layout.GroupLayout p2Layout = new org.jdesktop.layout.GroupLayout(p2);

p2.setLayout(p2Layout);

p2Layout.setHorizontalGroup(

p2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(org.jdesktop.layout.GroupLayout.TRAILING, p2Layout.createSequentialGroup()

.add(51, 51, 51)

.add(p2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)

.add(p2Layout.createSequentialGroup()

.add(jLabel3)

.add(18, 18, 18)

.add(dep))

.add(org.jdesktop.layout.GroupLayout.LEADING, p2Layout.createSequentialGroup()

.add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 83,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(18, 18, 18)

.add(nam))

.add(org.jdesktop.layout.GroupLayout.LEADING, p2Layout.createSequentialGroup()
.add(16, 16, 16)

.add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 67,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(18, 18, 18)

.add(time, 0, 111, Short.MAX_VALUE)))

.add(20, 20, 20))

);

p2Layout.setVerticalGroup(

p2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(p2Layout.createSequentialGroup()

.addContainerGap(91, Short.MAX_VALUE)

.add(p2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)

.add(nam, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)

.add(jLabel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)

.add(p2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)

.add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)

.add(dep))

.add(18, 18, 18)

.add(p2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(jLabel4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 52,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(time, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 45,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))

.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

);

p3.setBackground(new java.awt.Color(204, 204, 204));

jLabel5.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N


jLabel5.setText("College :");

collage.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

collage.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Engineering and


technology", "Medicen", "Low and Social scince", "Compitional scince", "Agriculture" }));

collage.setEnabled(false);

org.jdesktop.layout.GroupLayout p3Layout = new org.jdesktop.layout.GroupLayout(p3);

p3.setLayout(p3Layout);

p3Layout.setHorizontalGroup(

p3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(p3Layout.createSequentialGroup()

.addContainerGap()

.add(jLabel5)

.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)

.add(collage, 0, 253, Short.MAX_VALUE)

.add(19, 19, 19))

);

p3Layout.setVerticalGroup(

p3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(p3Layout.createSequentialGroup()

.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.add(p3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)

.add(collage, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(jLabel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

);

p4.setBackground(new java.awt.Color(204, 204, 204));


jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel6.setText("Name :");

jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel8.setText("ID:");

appruve.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

appruve.setText("Approve");

appruve.addActionListener(new java.awt.event.ActionListener() {

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

appruveActionPerformed(evt);

});

cheak.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

sname.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

sid.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

sid.addKeyListener(new java.awt.event.KeyAdapter() {

public void keyReleased(java.awt.event.KeyEvent evt) {

sidKeyReleased(evt);

});

returning.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

returning.setText("Return");

returning.addActionListener(new java.awt.event.ActionListener() {

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

returningActionPerformed(evt);
}

});

org.jdesktop.layout.GroupLayout p4Layout = new org.jdesktop.layout.GroupLayout(p4);

p4.setLayout(p4Layout);

p4Layout.setHorizontalGroup(

p4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(org.jdesktop.layout.GroupLayout.TRAILING, p4Layout.createSequentialGroup()

.addContainerGap()

.add(p4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(p4Layout.createSequentialGroup()

.add(53, 53, 53)

.add(rip, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.add(p4Layout.createSequentialGroup()

.add(p4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)

.add(jLabel8, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.add(jLabel6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.add(9, 9, 9)))

.add(p4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(p4Layout.createSequentialGroup()

.add(94, 94, 94)

.add(cheak, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.add(31, 31, 31))

.add(p4Layout.createSequentialGroup()

.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(returning, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 115,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)

.add(appruve, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 121,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))

.add(p4Layout.createSequentialGroup()

.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)

.add(p4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(org.jdesktop.layout.GroupLayout.TRAILING, sid)

.add(sname))))

.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

);

p4Layout.setVerticalGroup(

p4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(p4Layout.createSequentialGroup()

.addContainerGap()

.add(p4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)

.add(jLabel8, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE)

.add(sid))

.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)

.add(p4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(jLabel6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 32,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(sname, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 39,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)

.add(cheak, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 29,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.add(p4Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)

.add(appruve, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 41,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(rip, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.add(org.jdesktop.layout.GroupLayout.TRAILING, returning,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))

.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

);

org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);

jPanel1.setLayout(jPanel1Layout);

jPanel1Layout.setHorizontalGroup(

jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(jPanel1Layout.createSequentialGroup()

.add(p2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(0, 0, 0)

.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(p3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.add(p4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))

);

jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel1Layout.createSequentialGroup()
.add(0, 0, 0)

.add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)

.add(p2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.add(jPanel1Layout.createSequentialGroup()

.add(p3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.add(0, 0, 0)

.add(p4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))

.add(0, 0, 0))

);

p1.setBackground(new java.awt.Color(204, 204, 204));

student_id.addKeyListener(new java.awt.event.KeyAdapter() {

public void keyReleased(java.awt.event.KeyEvent evt) {

student_idKeyReleased(evt);

});

type.setFont(new java.awt.Font("Calibri", 0, 14)); // NOI18N

type.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Book name", "Book id",


"Book auter", "collage", "Book department" }));

type.addActionListener(new java.awt.event.ActionListener() {

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

typeActionPerformed(evt);

});

org.jdesktop.layout.GroupLayout p1Layout = new org.jdesktop.layout.GroupLayout(p1);

p1.setLayout(p1Layout);
p1Layout.setHorizontalGroup(

p1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(p1Layout.createSequentialGroup()

.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.add(type, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 131,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(18, 18, 18)

.add(student_id, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 155,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.addContainerGap())

);

p1Layout.setVerticalGroup(

p1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(org.jdesktop.layout.GroupLayout.TRAILING, p1Layout.createSequentialGroup()

.addContainerGap(25, Short.MAX_VALUE)

.add(p1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)

.add(type)

.add(student_id, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE))

.addContainerGap())

);

org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);

jPanel5.setLayout(jPanel5Layout);

jPanel5Layout.setHorizontalGroup(

jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(p1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

);
jPanel5Layout.setVerticalGroup(

jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(jPanel5Layout.createSequentialGroup()

.add(p1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(0, 0, 0)

.add(jPanel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.add(0, 0, 0))

);

jMenuBar1.setFocusable(false);

jMenuBar1.setFont(new java.awt.Font("Segoe UI", 0, 14)); // NOI18N

jMenu1.setText("File");

jMenuItem1.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_N,
java.awt.event.InputEvent.CTRL_MASK));

jMenuItem1.setText("Add New Book");

jMenuItem1.addActionListener(new java.awt.event.ActionListener() {

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

jMenuItem1ActionPerformed(evt);

});

jMenu1.add(jMenuItem1);

jMenuItem11.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O,
java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));

jMenuItem11.setText("Option");

jMenuItem11.addActionListener(new java.awt.event.ActionListener() {

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

jMenuItem11ActionPerformed(evt);

}
});

jMenu1.add(jMenuItem11);

jMenu1.add(jSeparator3);

jMenuItem3.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_E,
java.awt.event.InputEvent.ALT_MASK | java.awt.event.InputEvent.CTRL_MASK));

jMenuItem3.setText("Exit");

jMenuItem3.addActionListener(new java.awt.event.ActionListener() {

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

jMenuItem3ActionPerformed(evt);

});

jMenu1.add(jMenuItem3);

jMenuBar1.add(jMenu1);

jMenu6.setText("Help");

about.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F1, 0));

about.setText("About");

about.addActionListener(new java.awt.event.ActionListener() {

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

aboutActionPerformed(evt);

});

jMenu6.add(about);

jMenuBar1.add(jMenu6);

setJMenuBar(jMenuBar1);

org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(layout.createSequentialGroup()

.add(0, 0, 0)

.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(p6, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.add(layout.createSequentialGroup()

.add(0, 0, 0)

.add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))

.add(0, 0, 0))

);

layout.setVerticalGroup(

layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(layout.createSequentialGroup()

.add(p6, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(0, 0, 0)

.add(jPanel5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

);

pack();

String feed;

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

About n = new About();

n.setVisible(true);

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


Loger log = new Loger();

log.setVisible(true);

this.dispose();

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

this.dispose();

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

Book_Registration add = new Book_Registration();

add.setVisible(true);

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

signichure = "option";

Approve conferm = new Approve();

conferm.setVisible(true);

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

try{

String sql ="select * from books where "+choice+"=? ";

pst = conn.prepareStatement(sql);

pst.setString(1,student_id.getText());

rs=pst.executeQuery();

while(rs.next()){

nam.setText(rs.getString("title"));

dep.setText(rs.getString("department"));

collage.setSelectedItem(rs.getString("collage"));
}

pst.close();

rs.close();

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

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

combbomaster(); // TODO add your handling code here:

static String thime="windows.Windows";

int cheaker = 0;

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

String sql = "delete from user where idnum = ?";

try{

pst= conn.prepareStatement(sql);

pst.setString(1,sid.getText());

pst.execute();

sname.setText("");

sid.setText("");

pst.close();

rs.close();

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

} }

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

int h=0;
try{

String sql ="select * from user where idnum=? ";

pst = conn.prepareStatement(sql);

pst.setString(1,sid.getText());

rs=pst.executeQuery();

String add1 =rs.getString("name");

String add2 =rs.getString("total_time");

String add3 =rs.getString("minute");

nam.setText(rs.getString("last_book_name"));

dep.setText(rs.getString("department"));

if(timer(Integer.parseInt(add2),Integer.parseInt(add3),glob)==false){

JOptionPane.showMessageDialog(null,"This book is late!");

h=1;

sname.setText(add1);

if(h!=1){

JOptionPane.showMessageDialog(null,"A Book is tooken by this id!");

this.appruve.setEnabled(false);

returning.setEnabled(true);

pst.close();

rs.close();

}catch(HeadlessException | NumberFormatException | SQLException e){

sname.setText("");

this.appruve.setEnabled(true);

this.returning.setEnabled(false);
}

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

try{

String sq = "insert into user


(name,idnum,last_book_name,time,department,unrestricted,collage,total_time,minute) values (?,?,?,?,?,?,?,?,?)";

pst = conn.prepareStatement(sq);

pst.setString(1,sname.getText());

pst.setString(2,sid.getText());

pst.setString(3,nam.getText());

pst.setString(4,the_time);

pst.setString(5,dep.getText());

pst.setString(6,feed);

pst.setString(7,collage.getSelectedItem().toString());

pst.setString(8,""+Time);

pst.setString(9,""+minute);

sname.setText("");

sid.setText("");

dep.setText("");

nam.setText("");

sid.setText("");

pst.execute();

pst.close();

rs.close();

}catch(SQLException e){

JOptionPane.showMessageDialog(null,"this id is from repeted");

}
}

public static void main(String args[]) throws ClassNotFoundException, InstantiationException,


UnsupportedLookAndFeelException, IllegalAccessException, InstantiationException, IllegalAccessException,
UnsupportedLookAndFeelException {

try {

for (javax.swing.UIManager.LookAndFeelInfo info :


javax.swing.UIManager.getInstalledLookAndFeels()) {

if ("Windows".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

}}

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Home.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new Home().setVisible(true);

});

}
private javax.swing.JMenuItem about;

private javax.swing.JButton appruve;

private javax.swing.ButtonGroup buttonGroup1;

private javax.swing.JLabel cheak;

private javax.swing.JComboBox<String> collage;

private javax.swing.JTextField dep;

private javax.swing.JButton jButton2;

private javax.swing.JLabel jLabel10;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5;

private javax.swing.JLabel jLabel6;

private javax.swing.JLabel jLabel8;

private javax.swing.JMenu jMenu1;

private javax.swing.JMenu jMenu6;

private javax.swing.JMenuBar jMenuBar1;

private javax.swing.JMenuItem jMenuItem1;

private javax.swing.JMenuItem jMenuItem11;

private javax.swing.JMenuItem jMenuItem3;

private javax.swing.JPanel jPanel1;

private javax.swing.JPanel jPanel5;

private javax.swing.JPopupMenu.Separator jSeparator3;

private javax.swing.JTextField nam;

private javax.swing.JPanel p1;

private javax.swing.JPanel p2;

private javax.swing.JPanel p3;


private javax.swing.JPanel p4;

private javax.swing.JPanel p6;

private javax.swing.JButton returning;

private javax.swing.JLabel rip;

private javax.swing.JTextField sid;

private javax.swing.JTextField sname;

private javax.swing.JTextField student_id;

private javax.swing.JComboBox<String> time;

private javax.swing.JComboBox<String> type;

Source code for Loger

package ADU_School_project;

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Toolkit;

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import javax.swing.JOptionPane;

import javax.swing.UnsupportedLookAndFeelException;

public class Loger extends javax.swing.JFrame {

Connection conn = null;

ResultSet rs = null;

PreparedStatement pst = null;

/** Creates new form Antenna */

public Loger() {
initComponents();

conn = db.java_db();

Toolkit toolkit = getToolkit();

Dimension size = toolkit.getScreenSize();

setLocation(size.width/2 - getWidth()/2,size.height/2 - getHeight()/2);

int numb=0;

public void go(){

if(numb==3){

dispose();

private void initComponents() {

jMenu1 = new javax.swing.JMenu();

logholder = new javax.swing.JPanel();

jLabel1 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

name = new javax.swing.JTextField();

login = new javax.swing.JButton();

password = new javax.swing.JPasswordField();

choice = new javax.swing.JComboBox<>();

sign = new javax.swing.JButton();

jLabel11 = new javax.swing.JLabel();

jMenu1.setText("jMenu1");

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setTitle("Security Login");

setResizable(false);
logholder.setBackground(new java.awt.Color(225, 225, 225));

logholder.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "",
javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION,
new java.awt.Font("Tahoma", 0, 18), new java.awt.Color(102, 102, 102))); // NOI18N

logholder.setForeground(new java.awt.Color(204, 204, 204));

jLabel1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel1.setForeground(new java.awt.Color(10, 10, 10));

jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel1.setText(" Name");

jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel2.setForeground(new java.awt.Color(10, 10, 10));

jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel2.setText(" Password");

name.addActionListener(new java.awt.event.ActionListener() {

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

nameActionPerformed(evt);

});

login.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

login.setForeground(new java.awt.Color(10, 10, 10));

login.setText("Login");

login.addActionListener(new java.awt.event.ActionListener() {

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

loginActionPerformed(evt);

});

choice.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N


choice.setForeground(new java.awt.Color(10, 10, 10));

choice.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Manager", "Admin" }));

choice.setBorder(null);

choice.addActionListener(new java.awt.event.ActionListener() {

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

choiceActionPerformed(evt);

});

sign.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

sign.setForeground(new java.awt.Color(51, 51, 51));

sign.setText("Signup");

sign.addActionListener(new java.awt.event.ActionListener() {

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

signActionPerformed(evt);

});

org.jdesktop.layout.GroupLayout logholderLayout = new org.jdesktop.layout.GroupLayout(logholder);

logholder.setLayout(logholderLayout);

logholderLayout.setHorizontalGroup(

logholderLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(logholderLayout.createSequentialGroup()

.add(71, 71, 71)

.add(logholderLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)

.add(sign, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 128,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(logholderLayout.createSequentialGroup()

.add(logholderLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
.add(jLabel1)

.add(org.jdesktop.layout.GroupLayout.LEADING, jLabel2,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 95, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))

.add(18, 18, 18)

.add(logholderLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)

.add(name)

.add(logholderLayout.createSequentialGroup()

.add(choice, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.add(39, 39, 39)

.add(login, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.add(password, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 219,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))

.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

);

logholderLayout.setVerticalGroup(

logholderLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(org.jdesktop.layout.GroupLayout.TRAILING, logholderLayout.createSequentialGroup()

.add(sign, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 31,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(19, 19, 19)

.add(logholderLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)

.add(name, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(jLabel1))

.add(18, 18, 18)

.add(logholderLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)

.add(jLabel2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.add(password, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35,
org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))

.add(18, 18, 18)

.add(logholderLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(choice, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(login, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 35,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))

.addContainerGap(71, Short.MAX_VALUE))

);

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

jLabel11.setForeground(new java.awt.Color(10, 10, 10));

jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel11.setText("Librery System login");

org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(layout.createSequentialGroup()

.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(layout.createSequentialGroup()

.add(0, 0, 0)

.add(logholder, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.add(layout.createSequentialGroup()

.add(jLabel11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 495,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.add(0, 10, Short.MAX_VALUE)))

.add(0, 0, 0))
);

layout.setVerticalGroup(

layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)

.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()

.add(jLabel11, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 75,


org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)

.add(logholder, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,
org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.add(0, 0, 0))

);

logholder.getAccessibleContext().setAccessibleName("Login/Signup");

pack();

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

Signup_Form go = new Signup_Form();

go.setVisible(true);

private void loginActionPerformed(java.awt.event.ActionEvent evt)

if(this.choice.getSelectedItem().equals("Manager")){

String sql = "select id,name,password from manager where(name = ? and password = ? )";

try{

int count = 0;

pst = conn.prepareStatement(sql);

pst.setString(1, name.getText());

pst.setString(2, password.getText());
Transfer.tick2 = name.toString();

rs = pst.executeQuery();

while(rs.next()){

int id = rs.getInt(1);

Transfer.tick = id;

count = count+1;

}if(count == 1){

Transfer.tick1 = "Admin";

Home main = new Home();

main.setVisible(true);

this.dispose();

}else{

if(numb!=2){

name.setForeground(Color.red);

name.setBackground(Color.orange);

logholder.setBackground(Color.orange);

go();

numb++;

password.setForeground(Color.red);

password.setBackground(Color.orange);

password.setText("");

}else{

name.setForeground(Color.black);

setBackground(Color.yellow);

name.setBackground(Color.red);

logholder.setBackground(Color.orange);

JOptionPane.showMessageDialog(null,"If you are not manager or Admin close the Program.");


go();

numb++;

rs.close();

pst.close();

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

}else{

String sql = "select id,name,password from Admin where(name = ? and password = ? )";

if(numb<3){

try{

int count = 0;

pst = conn.prepareStatement(sql);

pst.setString(1, name.getText());

pst.setString(2, password.getText());

Transfer.tick2 = name.toString();

rs = pst.executeQuery();

while(rs.next()){

int id = rs.getInt(1);

Transfer.tick = id;

count = count+1;

}if(count == 1){

Transfer.tick1 = "Admin";

Home main = new Home();

main.setVisible(true);
this.dispose();

}else{

name.setForeground(Color.red);

name.setBackground(Color.yellow);

numb++;

name.setText("");

password.setForeground(Color.red);

password.setBackground(Color.yellow);

password.setText("");

JOptionPane.showMessageDialog(null,"Wrong");

rs.close();

pst.close();

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

}else{

dispose();

} }

public static void main(String args[]) throws ClassNotFoundException, InstantiationException,


IllegalAccessException, UnsupportedLookAndFeelException, UnsupportedLookAndFeelException {

try {

javax.swing.UIManager.LookAndFeelInfo[]
installedLookAndFeels=javax.swing.UIManager.getInstalledLookAndFeels();

for (int idx=0; idx<installedLookAndFeels.length; idx++)

if ("Windows".equals(installedLookAndFeels[idx].getName())) {

javax.swing.UIManager.setLookAndFeel(installedLookAndFeels[idx].getClassName());
break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(Loger.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Loger.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(Loger.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Loger.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new Loger().setVisible(true);

});

private javax.swing.JComboBox<String> choice;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel11;

private javax.swing.JLabel jLabel2;

private javax.swing.JMenu jMenu1;

private javax.swing.JPanel logholder;

private javax.swing.JButton login;

private javax.swing.JTextField name;

private javax.swing.JPasswordField password;

private javax.swing.JButton sign;


}

Source code for Signup_Form

package ADU_School_project;

import java.awt.Dimension;

import java.awt.Toolkit;

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

public class Signup_Form extends javax.swing.JFrame {

Connection conn = null;

ResultSet rs = null;

PreparedStatement pst = null;

static String signichure="";

public Signup_Form() {

initComponents();

setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/ADU_School_project/ico.png")));

conn = db.java_db();

Toolkit toolkit = getToolkit();

Dimension size = toolkit.getScreenSize();

setLocation(size.width/2 - getWidth()/2,size.height/2 - getHeight()/2);

private void initComponents() {

jPanel8 = new javax.swing.JPanel();

jLabel6 = new javax.swing.JLabel();

jLabel8 = new javax.swing.JLabel();

st_id = new javax.swing.JLabel();


jLabel7 = new javax.swing.JLabel();

jLabel9 = new javax.swing.JLabel();

name = new javax.swing.JTextField();

phone = new javax.swing.JTextField();

fname = new javax.swing.JTextField();

jLabel10 = new javax.swing.JLabel();

repasword = new javax.swing.JTextField();

jLabel11 = new javax.swing.JLabel();

password = new javax.swing.JPasswordField();

jPanel1 = new javax.swing.JPanel();

img = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

appruve = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

setAlwaysOnTop(true);

setResizable(false);

jPanel8.setBackground(new java.awt.Color(204, 204, 204));

jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel6.setText("Name :");

jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel8.setText("Father Name:");

st_id.setFont(new java.awt.Font("Tahoma", 0, 14));

jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel7.setText("Phone :");
jLabel9.setFont(new java.awt.Font("Tahoma", 0, 14));

name.addActionListener(new java.awt.event.ActionListener() {

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

nameActionPerformed(evt);

});

phone.addActionListener(new java.awt.event.ActionListener() {

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

phoneActionPerformed(evt);

});

fname.addActionListener(new java.awt.event.ActionListener() {

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

fnameActionPerformed(evt);

});

jLabel10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel10.setText("New Password:");

repasword.addActionListener(new java.awt.event.ActionListener() {

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

repaswordActionPerformed(evt);

});

jLabel11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel11.setText("Hint :");
javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);

jPanel8.setLayout(jPanel8Layout);

jPanel8Layout.setHorizontalGroup(

jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel8Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(name)

.addGroup(jPanel8Layout.createSequentialGroup()

.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(phone)

.addComponent(fname, javax.swing.GroupLayout.DEFAULT_SIZE, 270, Short.MAX_VALUE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(st_id, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(repasword)

.addGroup(jPanel8Layout.createSequentialGroup()

.addComponent(password, javax.swing.GroupLayout.PREFERRED_SIZE, 270,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(0, 0, Short.MAX_VALUE)))

.addContainerGap())

);

jPanel8Layout.setVerticalGroup(

jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel8Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 32,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(name, javax.swing.GroupLayout.PREFERRED_SIZE, 32,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(18, 18, 18)

.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(jPanel8Layout.createSequentialGroup()

.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel8)

.addComponent(fname, javax.swing.GroupLayout.PREFERRED_SIZE, 32,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addComponent(st_id, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addGap(18, 18, 18)

.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE)


.addComponent(jLabel9, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))

.addComponent(phone, javax.swing.GroupLayout.PREFERRED_SIZE, 32,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(18, 18, 18)

.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)

.addGroup(jPanel8Layout.createSequentialGroup()

.addComponent(password, javax.swing.GroupLayout.PREFERRED_SIZE, 31,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(0, 9, Short.MAX_VALUE)))

.addGap(0, 0, 0)

.addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, 40, Short.MAX_VALUE)

.addComponent(repasword, javax.swing.GroupLayout.PREFERRED_SIZE, 32,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(43, 43, 43))

);

jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel2.setText("Adigrat Universty Lybrary System [Sign up Form]");

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);

jPanel1.setLayout(jPanel1Layout);

jPanel1Layout.setHorizontalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addContainerGap()

.addComponent(img, javax.swing.GroupLayout.PREFERRED_SIZE, 80,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(18, 18, 18)


.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGap(30, 30, 30))

);

jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 58, Short.MAX_VALUE)

.addComponent(img, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


Short.MAX_VALUE))

.addContainerGap())

);

appruve.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ADU_School_project/Checked.png")));

appruve.setText("Approve");

appruve.addActionListener(new java.awt.event.ActionListener() {

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

appruveActionPerformed(evt);

});

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(appruve, javax.swing.GroupLayout.PREFERRED_SIZE, 134,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(21, 21, 21))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(0, 44, Short.MAX_VALUE)))

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 322, Short.MAX_VALUE)

.addComponent(appruve, javax.swing.GroupLayout.PREFERRED_SIZE, 41,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap())

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addGap(86, 86, 86)

.addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap(87, Short.MAX_VALUE)))

);

pack();

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

Transfer.nam = name.getText();

Transfer.fnam = fname.getText();

Transfer.pon = phone.getText();

Transfer.pas = password.getText();

Transfer.repas = repasword.getText();

signichure = "signup";

Approve conferm = new Approve();

conferm.setVisible(true);

this.dispose();

public static void main(String args[]) {

try {

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

if ("Windows".equals(info.getName())) {

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(Signup_Form.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Signup_Form.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (IllegalAccessException ex) {


java.util.logging.Logger.getLogger(Signup_Form.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Signup_Form.class.getName()).log(java.util.logging.Level.SEVERE, null,
ex);

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new Signup_Form().setVisible(true);

});

private javax.swing.JButton appruve;

private javax.swing.JTextField fname;

private javax.swing.JLabel img;

private javax.swing.JLabel jLabel10;

private javax.swing.JLabel jLabel11;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel6;

private javax.swing.JLabel jLabel7;

private javax.swing.JLabel jLabel8;

private javax.swing.JLabel jLabel9;

private javax.swing.JPanel jPanel1;

private javax.swing.JPanel jPanel8;

private javax.swing.JTextField name;

private javax.swing.JPasswordField password;

private javax.swing.JTextField phone;

private javax.swing.JTextField repasword;


private javax.swing.JLabel st_id;

Source Code for Option

package ADU_School_project;

import static ADU_School_project.Signup_Form.signichure;

import java.awt.Dimension;

import java.awt.Toolkit;

import java.sql.Connection;

import java.sql.PreparedStatement;

import java.sql.ResultSet;

import javax.swing.JOptionPane;

import net.proteanit.sql.DbUtils;

/**

* @author yapone

*/

public class Option extends javax.swing.JFrame {

Connection conn = null;

ResultSet rs = null;

PreparedStatement pst = null;

public Option() {

initComponents();

conn = db.java_db();

Toolkit toolkit = getToolkit();


Dimension size = toolkit.getScreenSize();

setLocation(size.width/2 - getWidth()/2,size.height/2 - getHeight()/2);

char aa='m';

update(aa);

/**

* 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() {

thimegroup = new javax.swing.ButtonGroup();

jLabel3 = new javax.swing.JLabel();

jPanel1 = new javax.swing.JPanel();

jLabel1 = new javax.swing.JLabel();

jPanel2 = new javax.swing.JPanel();

jPanel3 = new javax.swing.JPanel();

Delete = new javax.swing.JButton();

jPanel6 = new javax.swing.JPanel();

jScrollPane1 = new javax.swing.JScrollPane();

tab = new javax.swing.JTable();

jLabel2 = new javax.swing.JLabel();

choice = new javax.swing.JComboBox<>();


jLabel5 = new javax.swing.JLabel();

jPanel9 = new javax.swing.JPanel();

jLabel6 = new javax.swing.JLabel();

jLabel8 = new javax.swing.JLabel();

st_id = new javax.swing.JLabel();

jLabel7 = new javax.swing.JLabel();

name = new javax.swing.JTextField();

phone = new javax.swing.JTextField();

fname = new javax.swing.JTextField();

jLabel10 = new javax.swing.JLabel();

repasword = new javax.swing.JTextField();

jLabel11 = new javax.swing.JLabel();

password = new javax.swing.JPasswordField();

jButton1 = new javax.swing.JButton();

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

jLabel3.setText(" Submit the font size you prefer");

jLabel3.setToolTipText("");

setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

setModalExclusionType(java.awt.Dialog.ModalExclusionType.APPLICATION_EXCLUDE);

jPanel1.setBackground(new java.awt.Color(204, 204, 204));

jLabel1.setBackground(new java.awt.Color(102, 102, 102));

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

jLabel1.setForeground(new java.awt.Color(51, 51, 51));


jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel1.setText("Database and admin registration");

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);

jPanel1.setLayout(jPanel1Layout);

jPanel1Layout.setHorizontalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


Short.MAX_VALUE)

);

jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel1Layout.createSequentialGroup()

.addComponent(jLabel1)

.addGap(0, 0, 0))

);

jPanel2.setBackground(new java.awt.Color(204, 204, 204));

jPanel3.setBackground(new java.awt.Color(204, 204, 204));

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

Delete.setText("Remove");

Delete.addActionListener(new java.awt.event.ActionListener() {

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

DeleteActionPerformed(evt);

}
});

tab.setModel(new javax.swing.table.DefaultTableModel(

new Object [][] {

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null},

{null, null, null, null}

},

new String [] {

"Title 1", "Title 2", "Title 3", "Title 4"

));
jScrollPane1.setViewportView(tab);

javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);

jPanel6.setLayout(jPanel6Layout);

jPanel6Layout.setHorizontalGroup(

jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 535, Short.MAX_VALUE)

);

jPanel6Layout.setVerticalGroup(

jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel6Layout.createSequentialGroup()

.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)

.addGap(2, 2, 2))

);

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

jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel2.setText("Table");

jLabel2.setToolTipText("");

choice.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

choice.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Book", "Student", "Manager",


"Admin" }));

choice.setSelectedIndex(2);

choice.addActionListener(new java.awt.event.ActionListener() {

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

choiceActionPerformed(evt);
}

});

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

jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel5.setText("Chose");

javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);

jPanel3.setLayout(jPanel3Layout);

jPanel3Layout.setHorizontalGroup(

jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()

.addContainerGap()

.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGap(18, 18, 18)

.addComponent(choice, javax.swing.GroupLayout.PREFERRED_SIZE, 145,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(50, 50, 50)

.addComponent(Delete, javax.swing.GroupLayout.PREFERRED_SIZE, 105,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap())

.addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


Short.MAX_VALUE)

.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


Short.MAX_VALUE)

);

jPanel3Layout.setVerticalGroup(

jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 43,
javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(0, 0, 0)

.addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGap(39, 39, 39)

.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(Delete, javax.swing.GroupLayout.PREFERRED_SIZE, 30,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(choice, javax.swing.GroupLayout.PREFERRED_SIZE, 30,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 30,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(50, 50, 50))

);

jPanel9.setBackground(new java.awt.Color(204, 204, 204));

jLabel6.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel6.setText("Name :");

jLabel8.setFont(new java.awt.Font("Tahoma", 0, 14));

jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel8.setText("Father Name:");

st_id.setFont(new java.awt.Font("Tahoma", 0, 14));

jLabel7.setFont(new java.awt.Font("Tahoma", 0, 14));

jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel7.setText("Phone :");

name.addActionListener(new java.awt.event.ActionListener() {

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

nameActionPerformed(evt);
}

});

phone.addActionListener(new java.awt.event.ActionListener() {

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

phoneActionPerformed(evt);

});

fname.addActionListener(new java.awt.event.ActionListener() {

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

fnameActionPerformed(evt);

});

jLabel10.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel10.setText("New Password:");

repasword.addActionListener(new java.awt.event.ActionListener() {

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

repaswordActionPerformed(evt);

});

jLabel11.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

jLabel11.setText("Hint :");

jButton1.setText("Approve");

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

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

jButton1ActionPerformed(evt);
}

});

javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);

jPanel9.setLayout(jPanel9Layout);

jPanel9Layout.setHorizontalGroup(

jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel9Layout.createSequentialGroup()

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

.addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel9Layout.createSequentialGroup()

.addComponent(name, javax.swing.GroupLayout.PREFERRED_SIZE, 199,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(0, 0, Short.MAX_VALUE))

.addGroup(jPanel9Layout.createSequentialGroup()

.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(jPanel9Layout.createSequentialGroup()

.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 119,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addComponent(password, javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(phone)

.addComponent(repasword)

.addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel9Layout.createSequentialGroup()

.addComponent(fname, javax.swing.GroupLayout.PREFERRED_SIZE, 197,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(0, 0, Short.MAX_VALUE)))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(st_id, javax.swing.GroupLayout.DEFAULT_SIZE, 68, Short.MAX_VALUE)))

.addContainerGap())

);

jPanel9Layout.setVerticalGroup(

jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel9Layout.createSequentialGroup()

.addContainerGap()

.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 32,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(name, javax.swing.GroupLayout.PREFERRED_SIZE, 32,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(18, 18, 18)

.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addGroup(jPanel9Layout.createSequentialGroup()

.addGap(0, 0, Short.MAX_VALUE)

.addComponent(st_id, javax.swing.GroupLayout.PREFERRED_SIZE, 34,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel9Layout.createSequentialGroup()

.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(fname, javax.swing.GroupLayout.PREFERRED_SIZE, 32,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 32,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(18, 18, 18)

.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(phone, javax.swing.GroupLayout.PREFERRED_SIZE, 32,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addGap(18, 18, 18)

.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(password, javax.swing.GroupLayout.PREFERRED_SIZE, 35,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 43,


javax.swing.GroupLayout.PREFERRED_SIZE))

.addGap(18, 18, 18)

.addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(repasword, javax.swing.GroupLayout.PREFERRED_SIZE, 39,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 39,


javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap(22, Short.MAX_VALUE))))

);

javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);

jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(

jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(jPanel2Layout.createSequentialGroup()

.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addContainerGap())

);

jPanel2Layout.setVerticalGroup(

jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


Short.MAX_VALUE)

.addGroup(jPanel2Layout.createSequentialGroup()

.addContainerGap()

.addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,


Short.MAX_VALUE)

.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

);

layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addGap(0, 0, 0))

);

pack();

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

Transfer.nam = name.getText();

Transfer.fnam = fname.getText();

Transfer.pon = phone.getText();

Transfer.pas = password.getText();

Transfer.repas = repasword.getText();

signichure = "Addup";

Approve conferm = new Approve();

conferm.setVisible(true);

this.dispose();

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

int x = this.choice.getSelectedIndex();

if(x==0){

update('b');
}else if(x==1){

update('s');

}else if(x==2){

update('m');

}else{

update('a');

}}

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

int x = this.choice.getSelectedIndex();

if(x==0){

String sql = "delete from books where id = ?";

try{

pst= conn.prepareStatement(sql);

int row=tab.getSelectedRow();

String sid = (tab.getModel().getValueAt(row, 0)).toString();

pst.setString(1,sid);

pst.execute();

JOptionPane.showMessageDialog(null,"Deleted!");

update('b');

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

}else if(x==1){

String sql = "delete from user where id = ?";

try{

pst= conn.prepareStatement(sql);
int row=tab.getSelectedRow();

String sid = (tab.getModel().getValueAt(row, 0)).toString();

pst.setString(1,sid);

pst.execute();

JOptionPane.showMessageDialog(null,"Deleted!");

update('s');

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

}else if(x==2){

String sql = "delete from manager where id = ?";

try{

pst= conn.prepareStatement(sql);

int row=tab.getSelectedRow();

String sid = (tab.getModel().getValueAt(row, 0)).toString();

pst.setString(1,sid);

pst.execute();

JOptionPane.showMessageDialog(null,"Deleted!");

update('m');

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

}else{

String sql = "delete from Admin where id = ?";

try{

pst= conn.prepareStatement(sql);

int row=tab.getSelectedRow();
String sid = (tab.getModel().getValueAt(row, 0)).toString();

pst.setString(1,sid);

pst.execute();

JOptionPane.showMessageDialog(null,"Deleted!");

update('a');

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

public static void main(String args[]) {

try {

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

if ("Windows".equals(info.getName())) {

System.out.println(Transfer.thime);

javax.swing.UIManager.setLookAndFeel(info.getClassName());

break;

} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(Option.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(Option.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(Option.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Option.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);


}

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new Option().setVisible(true);

});

private javax.swing.JButton Delete;

private javax.swing.JComboBox<String> choice;

private javax.swing.JTextField fname;

private javax.swing.JButton jButton1;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel10;

private javax.swing.JLabel jLabel11;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel5;

private javax.swing.JLabel jLabel6;

private javax.swing.JLabel jLabel7;

private javax.swing.JLabel jLabel8;

private javax.swing.JPanel jPanel1;

private javax.swing.JPanel jPanel2;

private javax.swing.JPanel jPanel3;

private javax.swing.JPanel jPanel6;

private javax.swing.JPanel jPanel9;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JTextField name;


private javax.swing.JPasswordField password;

private javax.swing.JTextField phone;

private javax.swing.JTextField repasword;

private javax.swing.JLabel st_id;

private javax.swing.JTable tab;

private javax.swing.ButtonGroup thimegroup;

private void update(char a){

if ('s'==a){

try{

String sql = "select * from user";

pst = conn.prepareStatement(sql);

rs=pst.executeQuery();

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

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

}finally {

try{

rs.close();

pst.close();

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

}}

}else if ('m'==a){

try{

String sql = "select * from manager";

pst = conn.prepareStatement(sql);
rs=pst.executeQuery();

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

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

}finally {

try{

rs.close();

pst.close();

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

}}

}else if ('b'==a){

try{

String sql = "select * from books";

pst = conn.prepareStatement(sql);

rs=pst.executeQuery();

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

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

}finally {

try{

rs.close();

pst.close();

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

}
}else if ('a'==a){

try{

String sql = "select * from Admin";

pst = conn.prepareStatement(sql);

rs=pst.executeQuery();

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

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

}finally {

try{

rs.close();

pst.close();

}catch(Exception e){

JOptionPane.showMessageDialog(null,e);

}}}}

You might also like