Edited Library Project
Edited Library Project
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
JLabel lab, lab2, lab3, lab4, lab5, lab6, lab7, lab8, lab9, lab10, lab11,
lab12, lab13, lab14, lab15, lab16, lab17, lab18;
JLabel lab19, lab20, lab21, lab22, lab23, lab24, lab25, lab26, lab27, lab28,
lab29, lab30,lab31,lab32, lab33,lab34,lab35,lab36,lab37,lab38,lab39;
JLabel
lab40,lab41,lab42,lab43,lab44,lab45,lab46,lab47,lab48,lab49,lab50,lab51,lab52,lab53
,lab54,lab55,lab56,lab57,lab58,lab60;
JButton b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16,
b17, b18, b19, b20, b21, b22, b24, b25, b26, b27, b28,b29,b30,b31,b32,b33,b34;
JButton
b35,b36,b37,b38,b39,b40,b41,b42,b43,b44,b45,b46,b47,b48,b49,b50,b51,b52,b53,b54,b55
,b56;
JButton b531,b532,b533,b534,b535,b536,b537;
JButton b5311,b5312,b5313,b5314,b5315;
JButton b53111,b53112,b53113,b53114,b53115,b53116;
JTextField t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15,
t16, t17, t18, t19, t20, t21, t22,t23,t24,t25,t26,t27,t28,t29;
JTextField t30,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t111,ti,tii,tiii,tt;
JPasswordField pass,pc,pcr;
JPanel p;
JPanel p1, p2, p3, p4, p5,p6,p7;
JFrame fr,st,sd,bo,em,mn,c,dd,cr,bl,nsbl,scibl,csbl;
public Login3() {
lab = new JLabel("USER NAME ");
lab2 = new JLabel("PASSWORD");
lab53=new JLabel(" DEVELOPED BY THRED YEAR COMPUTER SCIENCE STUDENT NAMED
BALCHA IN MTU FOR LIBRARY USE ");
lab54=new JLabel(" WELL COME TO LIBRARY MANAGEMENT SYSTEM PROJECT");
lab55=new JLabel("MTU");
lab56=new JLabel(" TEPI CAMPUS");
lab57=new JLabel("ETHIOPIA");
lab53.setFont(new Font("Arial Black",Font.BOLD,9));
lab54.setFont(new Font("Serif",Font.BOLD,20));
lab55.setFont(new Font("Serif",Font.BOLD,100));
lab56.setFont(new Font("Serif",Font.BOLD,30));
lab57.setFont(new Font("Serif",Font.BOLD,140));
b1 = new JButton("login");
b2 = new JButton("exit");
b41=new JButton("clrear");
b48=new JButton("create account");
t1 = new JTextField(10);
pass = new JPasswordField(10);
p = new JPanel();
st = new JFrame();
b1.setBackground(Color.red);
b2.setBackground(Color.yellow);
b41.setBackground(Color.green);
b48.setBackground(Color.white);
lab53.setForeground(Color.blue);
lab54.setForeground(Color.red);
lab55.setForeground(Color.blue);
lab56.setForeground(Color.red);
lab57.setForeground(Color.white);
st.setSize(700, 500);
st.setAlwaysOnTop(true);
st.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
st.setVisible(true);
st.setTitle("WELCOME TO LIBRARY");
st.setResizable(false);
//ContentPane con=new ContentPane();
p.setLayout(null);
p.setBackground(new Color(0, 204, 204));
lab.setBounds(30, 30, 130, 30);
lab2.setBounds(30, 70, 130, 30);
t1.setBounds(150, 30, 130, 30);
pass.setBounds(150, 70, 130, 30);
b1.setBounds(30, 150, 130, 30);
b2.setBounds(170, 150, 130, 30);
b41.setBounds(310,150,130,30);
b48.setBounds(450,150,130,30);
lab53.setBounds(0,180,1200,50);
lab54.setBounds(10,0,1200,28);
lab55.setBounds(100,230,1200,100);
lab56.setBounds(100,300,1200,100);
lab57.setBounds(0,0,1800,600);
p.add(lab54);
p.add(lab);
p.add(b1);
p.add(t1);
p.add(b2);
p.add(lab2);
p.add(lab53);
p.add(lab55);
p.add(lab56);
p.add(lab57);
p.add(pass);
p.add(b41);
p.add(b48);
st.add(p);
b1.addActionListener(this);
b2.addActionListener(this);
b41.addActionListener(this);
b48.addActionListener(this);
}
void select() {
b3 = new JButton("Book");
b4 = new JButton("Layberarist");
b5 = new JButton("student");
b29=new JButton("Manager");
b40=new JButton("cd");
b47=new JButton("logout");
b51=new JButton("book list");
JPanel p0=new JPanel();
p = new JPanel();
p1 = new JPanel();
p7=new JPanel();
fr = new JFrame();
lab3 = new JLabel("table names");
fr.setSize(650, 600);
fr.setLocation(500, 280);
fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
fr.setVisible(true);
fr.setTitle("select table form");
p.setLayout(null);
p1.setLayout(null);
p0.setLayout(null);
p7.setLayout(null);
fr.setLayout(null);
p.setBackground(Color.red);
p1.setBackground(Color.black);
p0.setBackground(Color.yellow);
p7.setBackground(Color.yellow);
b3.setBounds(20, 10, 100, 20);
b3.setBackground(Color.green);
b4.setBounds(20, 30, 100, 20);
b4.setBackground(Color.yellow);
b5.setBounds(20, 50, 100, 20);
b5.setBackground(Color.red);
b29.setBounds(20,70,100,20);
b29.setBackground(Color.green);
b40.setBounds(20,90,100,20);
b40.setBackground(Color.red);
b47.setBounds(30,100,120,30);
b47.setBackground(Color.red);
b51.setBounds(60,100,120,30);
b51.setBackground(Color.white);
lab3.setBounds(50, 10, 100, 30);
p1.setBounds(10, 30, 150, 120);
p.setBounds(10, 10, 170, 170);
p0.setBounds(200, 10, 170, 170);
p7.setBounds(300,10,190,170);
p1.add(b3);
p1.add(b4);
p1.add(b5);
p1.add(b29);
p1.add(b40);
p0.add(b47);
p7.add(b51);
//p1.add(com);
p.add(p1);
p.add(lab3);
fr.add(p);
fr.add(p0);
fr.add(p7);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b29.addActionListener(this);
b40.addActionListener(this);
b47.addActionListener(this);
b51.addActionListener(this);
}
void stud() {
lab4 = new JLabel("Student attribute");
lab5 = new JLabel("Action");
lab6 = new JLabel("id");
lab7 = new JLabel("Name");
lab8 = new JLabel("sex");
lab9 = new JLabel("age");
lab10 = new JLabel("Dept");
lab49=new JLabel("mi");
lab50=new JLabel("Lname");
lab58=new JLabel("DATABASE");
lab58.setFont(new Font("Serif",Font.BOLD,100));
lab58.setForeground(Color.red);
b6 = new JButton("insert");
b6.setBackground(Color.gray);
b7 = new JButton("update");
b7.setBackground(Color.blue);
b7.setForeground(Color.white);
b8 = new JButton("Delete");
b8.setBackground(Color.orange);
b9 = new JButton("select");
b9.setBackground(Color.pink);
b10 = new JButton("search");
b10.setBackground(Color.black);
b10.setForeground(Color.white);
b42=new JButton("Clear");
b42.setBackground(Color.black);
b42.setForeground(Color.white);
t2 = new JTextField();
t3 = new JTextField();
t4 = new JTextField();
t5 = new JTextField();
t6 = new JTextField();
t37=new JTextField();
t38=new JTextField();
// p=new JPanel();
//p.setLayout (null);
sd = new JFrame();
sd.setSize(500, 500);
sd.setLocation(500, 280);
sd.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
sd.setVisible(true);
sd.setTitle("Student table");
p.setLayout(null);
sd.setLayout(null);
sd.setBackground(Color.red);
lab4.setBounds(30, 20, 100, 30);
lab5.setBounds(200, 20, 80, 30);
lab6.setBounds(10, 45, 30, 30);
lab7.setBounds(10, 80, 50, 30);
lab49.setBounds(10,130,30,30);
lab50.setBounds(10,170,30,30);
lab8.setBounds(10, 200, 30, 30);
lab9.setBounds(10, 230, 30, 30);
lab10.setBounds(10, 265, 30, 30);
lab58.setBounds(20,300,1000,200);
t2.setBounds(50, 45, 130, 30);
t3.setBounds(50, 80, 130, 30);
t37.setBounds(50,130,130,30);
t38.setBounds(50,170,130,30);
t4.setBounds(50, 200, 130, 30);
t5.setBounds(50, 230, 130, 30);
t6.setBounds(50, 265, 130, 30);
b6.setBounds(200, 45, 100, 30);
b7.setBounds(200, 80, 100, 30);
b8.setBounds(200, 120, 100, 30);
b9.setBounds(200, 160, 100, 30);
b10.setBounds(200, 200, 100, 30);
b42.setBounds(200,240,100,30);
sd.add(lab4);
sd.add(lab5);
sd.add(lab6);
sd.add(lab7);
sd.add(lab8);
sd.add(lab9);
sd.add(lab10);
sd.add(lab49);
sd.add(lab50);
sd.add(lab58);
//fr.add(lab7);
sd.add(t2);
sd.add(t3);
sd.add(t4);
sd.add(t5);
sd.add(t6);
sd.add(t37);
sd.add(t38);
sd.add(b6);
sd.add(b7);
sd.add(b8);
sd.add(b9);
sd.add(b10);
sd.add(b42);
b6.addActionListener(this);
b7.addActionListener(this);
b8.addActionListener(this);
b9.addActionListener(this);
b10.addActionListener(this);
b42.addActionListener(this);
}
void Emplo() {
lab11 = new JLabel("Layberarist attribute");
lab12 = new JLabel("Action");
lab13 = new JLabel("id");
lab14 = new JLabel("Name");
lab15 = new JLabel("sex");
lab16 = new JLabel("age");
lab17 = new JLabel("salar");
lab47=new JLabel("mi");
lab48=new JLabel("Lname");
lab60=new JLabel("DATABASE");
lab60.setFont(new Font("Serif",Font.BOLD,100));
lab60.setForeground(Color.red);
b11 = new JButton("insert");
b11.setBackground(Color.blue);
b11.setForeground(Color.white);
b12 = new JButton("update");
b12.setBackground(Color.green);
b13 = new JButton("Delete");
b13.setBackground(Color.yellow);
b14 = new JButton("select");
b14.setBackground(Color.red);
b15 = new JButton("search");
b15.setBackground(Color.gray);
b43=new JButton("Clear");
b43.setBackground(Color.green);
t7 = new JTextField();
t8 = new JTextField();
t9 = new JTextField();
t10 = new JTextField();
t11 = new JTextField();
t35=new JTextField();
t36=new JTextField();
em = new JFrame();
em.setSize(500, 500);
em.setLocation(360, 360);
em.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
em.setVisible(true);
em.setTitle("Layberarist TABLE");
p.setLayout(null);
em.setLayout(null);
void Book() {
lab18 = new JLabel("BOOK atribute");
lab19 = new JLabel("Action");
lab20 = new JLabel("price");
lab21 = new JLabel("Name");
lab22 = new JLabel("content");
lab31=new JLabel("authorname");
lab32=new JLabel("code");
t111 = new JTextField();
t12 = new JTextField();
t13 = new JTextField();
t23=new JTextField();
t24=new JTextField();
b16 = new JButton("insert");
b16.setBackground(Color.green);
b17 = new JButton("update");
b17.setBackground(Color.yellow);
b18 = new JButton("Delete");
b18.setBackground(Color.red);
b19 = new JButton("select");
b19.setBackground(Color.blue);
b19.setForeground(Color.white);
b20 = new JButton("search");
b20.setBackground(Color.black);
b20.setForeground(Color.white);
b44=new JButton("Clear");
b44.setBackground(Color.red);
b44.setForeground(Color.white);
bo = new JFrame();
bo.setSize(400, 400);
bo.setLocation(500, 280);
bo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
bo.setVisible(true);
bo.setTitle("BOOK MENU");
p.setLayout(null);
bo.setLayout(null);
lab18.setBounds(30, 20, 100, 30);
lab19.setBounds(200, 20, 80, 30);
lab20.setBounds(10, 45, 60, 30);
lab21.setBounds(10, 80, 80, 30);
lab22.setBounds(10, 130, 50, 30);
lab31.setBounds(10,160,50,30);
lab32.setBounds(10,190,50,30);
t111.setBounds(80, 45, 110, 30);
t12.setBounds(80, 80, 110, 30);
t13.setBounds(80, 120, 110, 30);
t23.setBounds(80,160,110,30);
t24.setBounds(80,200,110,30);
b16.setBounds(220, 45, 100, 30);
b17.setBounds(220, 80, 100, 30);
b18.setBounds(220, 120, 100, 30);
b19.setBounds(220, 160, 100, 30);
b20.setBounds(220, 200, 100, 30);
b44.setBounds(220,240,100,30);
bo.add(lab18);
bo.add(lab19);
bo.add(lab20);
bo.add(t111);
bo.add(lab21);
bo.add(lab22);
bo.add(lab31);
bo.add(t12);
bo.add(t13);
bo.add(t23);
bo.add(b16);
bo.add(b17);
bo.add(b18);
bo.add(b19);
bo.add(b20);
bo.add(b44);
bo.add(t24);
bo.add(lab32);
b16.addActionListener(this);
b17.addActionListener(this);
b18.addActionListener(this);
b19.addActionListener(this);
b20.addActionListener(this);
b44.addActionListener(this);
}
void mana(){
lab33 = new JLabel("MANAGER attribute");
lab34 = new JLabel("Action");
lab35 = new JLabel("id");
lab36 = new JLabel("Name");
lab37 = new JLabel("sex");
lab38 = new JLabel("age");
lab51=new JLabel("mi");
lab52=new JLabel("lname");
lab39 = new JLabel("salar");
b30 = new JButton("insert");
b30.setBackground(Color.blue);
b30.setForeground(Color.white);
b31 = new JButton("update");
b31.setBackground(Color.green);
b32 = new JButton("Delete");
b32.setBackground(Color.yellow);
b33 = new JButton("select");
b33.setBackground(Color.red);
b34 = new JButton("search");
b34.setBackground(Color.gray);
b45=new JButton("Clear");
b45.setBackground(Color.red);
t25 = new JTextField();
t26= new JTextField();
t27= new JTextField();
t28 = new JTextField();
t29 = new JTextField();
t39=new JTextField();
t40=new JTextField();
//CREATE TABLE FOR MANAGER
mn = new JFrame();
mn.setSize(450, 450);
mn.setLocation(360, 360);
mn.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mn.setVisible(true);
mn.setTitle("MANAGER TABLE");
p.setLayout(null);
mn.setLayout(null);
lab33.setBounds(30, 20, 100, 30);
lab34.setBounds(200, 20, 80, 30);
lab35.setBounds(10, 45, 30, 30);
lab36.setBounds(10, 80, 50, 30);
lab51.setBounds(10, 120, 30, 30);
lab52.setBounds(10, 160, 30, 30);
lab37.setBounds(10, 200, 30, 30);
lab38.setBounds(10, 240, 30, 30);
lab39.setBounds(10, 280, 30, 30);
t25.setBounds(50, 45, 130, 30);
t26.setBounds(50, 80, 130, 30);
t39.setBounds(50, 120, 130, 30);
t40.setBounds(50, 160, 130, 30);
t27.setBounds(50, 200, 130, 30);
t28.setBounds(50, 240, 130, 30);
t29.setBounds(50, 280, 130, 30);
b30.setBounds(200, 45, 100, 30);
b31.setBounds(200, 80, 100, 30);
b32.setBounds(200, 120, 100, 30);
b33.setBounds(200, 160, 100, 30);
b34.setBounds(200, 200, 100, 30);
b45.setBounds(200,240,100,30);
mn.add(lab33);
mn.add(lab34);
mn.add(lab35);
mn.add(lab36);
mn.add(lab51);
mn.add(lab52);
mn.add(lab37);
mn.add(lab38);
mn.add(lab39);
mn.add(t25);
mn.add(t26);
mn.add(t39);
mn.add(t40);
mn.add(t27);
mn.add(t28);
mn.add(t29);
mn.add(b30);
mn.add(b31);
mn.add(b32);
mn.add(b33);
mn.add(b34);
mn.add(b45);
b30.addActionListener(this);
b31.addActionListener(this);
b32.addActionListener(this);
b33.addActionListener(this);
b34.addActionListener(this);
b45.addActionListener(this);
}
void cd()
{
lab40 = new JLabel("CD atribute");
lab46=new JLabel("Action");
lab41 = new JLabel("CD code");
lab42 = new JLabel("Title");
lab43 = new JLabel("ISBN NO");
lab44 = new JLabel("Edition");
lab45 =new JLabel("Publication");
b35 = new JButton("insert");
b35.setBackground(Color.blue);
b35.setForeground(Color.white);
b36 = new JButton("update");
b36.setBackground(Color.green);
b37 = new JButton("Delete");
b37.setBackground(Color.yellow);
b38 = new JButton("select");
b38.setBackground(Color.red);
b39= new JButton("search");
b39.setBackground(Color.black);
b39.setForeground(Color.white);
b46=new JButton("Clear");
t30 = new JTextField();
t31 = new JTextField();
t32 = new JTextField();
t33=new JTextField();
t34=new JTextField();
//create table for cd
c = new JFrame();
c.setSize(450, 450);
c.setLocation(360, 360);
c.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
c.setVisible(true);
c.setTitle("CD TABLE");
p.setLayout(null);
c.setLayout(null);
lab40.setBounds(30, 20, 100, 30);
lab46.setBounds(200, 20, 80, 30);
lab41.setBounds(10, 45, 80, 30);
lab42.setBounds(10, 80, 30, 30);
lab43.setBounds(10, 130, 50, 30);
lab44.setBounds(10, 170, 30, 30);
lab45.setBounds(10, 200, 30, 30);
t30.setBounds(80, 45, 110, 30);
t31.setBounds(80, 80, 110, 30);
t32.setBounds(80, 120, 110, 30);
t33.setBounds(80,160,110,30);
t34.setBounds(80,200,110,30);
b35.setBounds(200, 45, 100, 30);
b36.setBounds(200, 80, 100, 30);
b37.setBounds(200, 120, 100, 30);
b38.setBounds(200, 160, 100, 30);
b39.setBounds(200, 200, 100, 30);
b46.setBounds(200,240,100,30);
c.add(lab40);
c.add(lab41);
c.add(lab42);
c.add(lab43);
c.add(lab44);
c.add(lab45);
c.add(lab46);
c.add(t30);
c.add(t31);
c.add(t32);
c.add(t33);
c.add(t34);
c.add(b35);
c.add(b36);
c.add(b37);
c.add(b38);
c.add(b39);
c.add(b46);
b35.addActionListener(this);
b36.addActionListener(this);
b37.addActionListener(this);
b38.addActionListener(this);
b39.addActionListener(this);
b46.addActionListener(this);
}
void booklist(){
b52=new JButton("social science boook list");
b52.setBackground(Color.blue);
b52.setForeground(Color.white);
b53=new JButton("natural science boook list");
b53.setBackground(Color.blue);
b53.setForeground(Color.white);
b54=new JButton("exit");
b54.setBackground(Color.black);
b54.setForeground(Color.white);
bl=new JFrame();
bl.setSize(450, 450);
bl.setLocation(360, 360);
bl.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
bl.setVisible(true);
p.setLayout(null);
bl.setLayout(null);
b52.setBounds(20, 45, 400, 30);
b53.setBounds(20, 80, 400, 30);
b54.setBounds(200,180,60,30);
bl.add(b52);
bl.add(b53);
bl.add(b54);
b52.addActionListener(this);
b53.addActionListener(this);
b54.addActionListener(this);
}
void nasbl(){
b531=new JButton("school of computing and informatics boook list");
b531.setBackground(Color.blue);
b531.setForeground(Color.white);
b532=new JButton("enginering boook list");
b532.setBackground(Color.blue);
b532.setForeground(Color.white);
b533=new JButton("natural and computional science boook list");
b533.setBackground(Color.blue);
b533.setForeground(Color.white);
b534=new JButton("public health boook list");
b534.setBackground(Color.blue);
b534.setForeground(Color.white);
b535=new JButton("other health boook list");
b535.setBackground(Color.blue);
b535.setForeground(Color.white);
b536=new JButton("agricaltural boook list");
b536.setBackground(Color.blue);
b536.setForeground(Color.white);
b537=new JButton("veternary boook list");
b537.setBackground(Color.blue);
b537.setForeground(Color.white);
b55=new JButton("exit");
b55.setBackground(Color.red);
b55.setForeground(Color.white);
nsbl=new JFrame();
nsbl.setSize(450, 450);
nsbl.setLocation(360, 360);
nsbl.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
nsbl.setVisible(true);
p.setLayout(null);
nsbl.setLayout(null);
b531.setBounds(20, 45, 400, 30);
b532.setBounds(20, 80, 400, 30);
b533.setBounds(20, 115, 400, 30);
b534.setBounds(20, 150, 400, 30);
b535.setBounds(20, 185, 400, 30);
b536.setBounds(20, 220, 400, 30);
b537.setBounds(20, 255, 400, 30);
b55.setBounds(200,350,60,30);
nsbl.add(b531);
nsbl.add(b532);
nsbl.add(b533);
nsbl.add(b534);
nsbl.add(b535);
nsbl.add(b536);
nsbl.add(b537);
nsbl.add(b55);
b531.addActionListener(this);
b532.addActionListener(this);
b533.addActionListener(this);
b534.addActionListener(this);
b535.addActionListener(this);
b536.addActionListener(this);
b537.addActionListener(this);
b55.addActionListener(this);
}
void socibl(){
b5311=new JButton("computer science boook list");
b5311.setBackground(Color.blue);
b5311.setForeground(Color.white);
b5312=new JButton("information science boook list");
b5312.setBackground(Color.blue);
b5312.setForeground(Color.white);
b5313=new JButton("information technology boook list");
b5313.setBackground(Color.blue);
b5313.setForeground(Color.white);
b5314=new JButton("information system boook list");
b5314.setBackground(Color.blue);
b5314.setForeground(Color.white);
b5315=new JButton("software enginering boook list");
b5315.setBackground(Color.blue);
b5315.setForeground(Color.white);
scibl=new JFrame();
scibl.setSize(450, 450);
scibl.setLocation(360, 360);
scibl.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
scibl.setVisible(true);
p.setLayout(null);
scibl.setLayout(null);
b5311.setBounds(20, 45, 400, 30);
b5312.setBounds(20, 80, 400, 30);
b5313.setBounds(20, 115, 400, 30);
b5314.setBounds(20, 150, 400, 30);
b5315.setBounds(20, 185, 400, 30);
scibl.add(b5311);
scibl.add(b5312);
scibl.add(b5313);
scibl.add(b5314);
scibl.add(b5315);
b5311.addActionListener(this);
b5312.addActionListener(this);
b5313.addActionListener(this);
b5314.addActionListener(this);
b5315.addActionListener(this);
}
void compbl(){
b53111=new JButton("java boook list");
b53111.setBackground(Color.blue);
b53111.setForeground(Color.white);
b53112=new JButton("database boook list");
b53112.setBackground(Color.blue);
b53112.setForeground(Color.white);
b53113=new JButton("aligorism boook list");
b53113.setBackground(Color.blue);
b53113.setForeground(Color.white);
b53114=new JButton("networking boook list");
b53114.setBackground(Color.blue);
b53114.setForeground(Color.white);
b53115=new JButton("html boook list");
b53115.setBackground(Color.blue);
b53115.setForeground(Color.white);
b53116=new JButton("introductio to c++ boook list");
b53116.setBackground(Color.blue);
b53116.setForeground(Color.white);
csbl=new JFrame();
csbl.setSize(450, 450);
csbl.setLocation(360, 360);
csbl.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
csbl.setVisible(true);
p.setLayout(null);
csbl.setLayout(null);
b53111.setBounds(20, 45, 400, 30);
b53112.setBounds(20, 80, 400, 30);
b53113.setBounds(20, 115, 400, 30);
b53114.setBounds(20, 150, 400, 30);
b53115.setBounds(20, 185, 400, 30);
b53116.setBounds(20, 220, 400, 30);
csbl.add(b53111);
csbl.add(b53112);
csbl.add(b53113);
csbl.add(b53114);
csbl.add(b53115);
csbl.add(b53116);
b53111.addActionListener(this);
b53112.addActionListener(this);
b53113.addActionListener(this);
b53114.addActionListener(this);
b53115.addActionListener(this);
b53116.addActionListener(this);
}
void creat(){
JLabel ti=new JLabel("user name");
JLabel tii=new JLabel("new password");
JLabel tiii=new JLabel("confirm password");
tt=new JTextField();
pc=new JPasswordField();
pcr=new JPasswordField();
b49=new JButton("OK");
b50=new JButton("exit");
cr=new JFrame();
cr.setSize(600, 500);
cr.setLocation(500, 280);
cr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
cr.setVisible(true);
cr.setTitle("CREATE USER ACCOUNT");
ti.setBounds(10, 80, 120, 30);
tii.setBounds(10, 130, 120, 30);
tiii.setBounds(10,180,120,30);
tt.setBounds(120, 80, 420, 30);
pc.setBounds(120, 130, 110, 30);
pcr.setBounds(120,180,110,30);
b49.setBounds(100,220,60,30);
b50.setBounds(100,260,60,30);
p.setLayout(null);
cr.setLayout(null);
cr.add(ti);
cr.add(tii);
cr.add(tiii);
cr.add(tt);
cr.add(pc);
cr.add(pcr);
cr.add(b49);
cr.add(b50);
b49.addActionListener(this);
b50.addActionListener(this);
}
void select2() {
dd = new JFrame();
JTextArea rr = new JTextArea();
String st, k, a, c, h;
dd.add(rr);
dd.setSize(700, 500);
dd.setVisible(true);
dd.setLocation(300, 200);
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book","root","123");
stmt = con.createStatement();
rs = stmt.executeQuery("select *from stud");
ResultSetMetaData metaData = rs.getMetaData();
int numberOfColumns = metaData.getColumnCount();
st = " DATA OF STUDENTS \n\n";
rr.setText(st);
for (int i = 1; i <= numberOfColumns; i++) {
st = metaData.getColumnName(i);
rr.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
rr.append(st + " \t");
a = " ";
rr.append(a);
}
h = "\n";
rr.append(h);
k =
"__________________________________________________________________________________
_________________________\n";
rr.append(k);
while (rs.next()) {
for (int i = 1; i<=numberOfColumns;i++) {
String ss = rs.getString(i);
rr.append(ss +" \t ");
}
c = "\n";
rr.append(c);
}
rr.append(k);
} catch (SQLException sqlException) {
sqlException.printStackTrace();
}
finally {
if (con != null) {
try {
con.close();
stmt.close();
rs.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
}
}
void select3() {
dd = new JFrame();
JTextArea rr = new JTextArea();
String st, k, a, c, h;
dd.add(rr);
dd.setSize(700, 500);
dd.setVisible(true);
dd.setLocation(300, 200);
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book","root","123");
stmt = con.createStatement();
rs = stmt.executeQuery("select *from Book");
ResultSetMetaData metaData = rs.getMetaData();
int numberOfColumns = metaData.getColumnCount();
st = " DATA OF BOOK \n\n";
rr.setText(st);
for (int i = 1; i <= numberOfColumns; i++) {
st = metaData.getColumnName(i);
rr.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
rr.append(st + " \t");
a = " ";
rr.append(a);
}
h = "\n";
rr.append(h);
k =
"__________________________________________________________________________________
_________________________\n";
rr.append(k);
while (rs.next()) {
for (int i = 1; i<=numberOfColumns;i++) {
String ss = rs.getString(i);
rr.append(ss +" \t ");
}
c = "\n";
rr.append(c);
}
rr.append(k);
} catch (SQLException sqlException) {
sqlException.printStackTrace();
}
finally {
if (con != null) {
try {
con.close();
stmt.close();
rs.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
}
}
void select4() {
dd = new JFrame();
JTextArea rr = new JTextArea();
String st, k, a, c, h;
dd.add(rr);
dd.setSize(700, 500);
dd.setVisible(true);
dd.setLocation(300, 200);
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book","root","123");
stmt = con.createStatement();
rs = stmt.executeQuery("select *from Emplo");
ResultSetMetaData metaData = rs.getMetaData();
int numberOfColumns = metaData.getColumnCount();
st = " DATA OF EMPLOYEE \n\n";
rr.setText(st);
for (int i = 1; i <= numberOfColumns; i++) {
st = metaData.getColumnName(i);
rr.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
rr.append(st + " \t");
a = " ";
rr.append(a);
}
h = "\n";
rr.append(h);
k =
"__________________________________________________________________________________
_________________________\n";
rr.append(k);
while (rs.next()) {
for (int i = 1; i<=numberOfColumns;i++) {
String ss = rs.getString(i);
rr.append(ss +" \t ");
}
c = "\n";
rr.append(c);
}
rr.append(k);
} catch (SQLException sqlException) {
sqlException.printStackTrace();
}
finally {
if (con != null) {
try {
con.close();
stmt.close();
rs.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
}
}
void select5() {
dd = new JFrame();
JTextArea rr = new JTextArea();
String st, k, a, c, h;
dd.add(rr);
dd.setSize(700, 500);
dd.setVisible(true);
dd.setLocation(300, 200);
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book","root","123");
stmt = con.createStatement();
rs = stmt.executeQuery("select *from mana");
ResultSetMetaData metaData = rs.getMetaData();
int numberOfColumns = metaData.getColumnCount();
st = " DATA OF MANAGER \n\n";
rr.setText(st);
for (int i = 1; i <= numberOfColumns; i++) {
st = metaData.getColumnName(i);
rr.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
rr.append(st + " \t");
a = " ";
rr.append(a);
}
h = "\n";
rr.append(h);
k =
"__________________________________________________________________________________
_________________________\n";
rr.append(k);
while (rs.next()) {
for (int i = 1; i<=numberOfColumns;i++) {
String ss = rs.getString(i);
rr.append(ss +" \t ");
}
c = "\n";
rr.append(c);
}
rr.append(k);
} catch (SQLException sqlException) {
sqlException.printStackTrace();
}
finally {
if (con != null) {
try {
con.close();
stmt.close();
rs.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
}
}
void select6() {
dd = new JFrame();
JTextArea rr = new JTextArea();
String st, k, a, c, h;
dd.add(rr);
dd.setSize(700, 500);
dd.setVisible(true);
dd.setLocation(300, 200);
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book","root","123");
stmt = con.createStatement();
rs = stmt.executeQuery("select *from cd");
ResultSetMetaData metaData = rs.getMetaData();
int numberOfColumns = metaData.getColumnCount();
st = " DATA OF CD \n\n";
rr.setText(st);
for (int i = 1; i <= numberOfColumns; i++) {
st = metaData.getColumnName(i);
rr.applyComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
rr.append(st + " \t");
a = " ";
rr.append(a);
}
h = "\n";
rr.append(h);
k =
"__________________________________________________________________________________
_________________________\n";
rr.append(k);
while (rs.next()) {
for (int i = 1; i<=numberOfColumns;i++) {
String ss = rs.getString(i);
rr.append(ss +" \t ");
}
c = "\n";
rr.append(c);
}
rr.append(k);
} catch (SQLException sqlException) {
sqlException.printStackTrace();
}
finally {
if (con != null) {
try {
con.close();
stmt.close();
rs.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
}
}
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.prepareStatement(query);
rs = stmt.executeQuery(query);
while (rs.next()) {
t3.setText(rs.getString("name"));
t37.setText(rs.getString("mi"));
t38.setText(rs.getString("lname"));
t4.setText(rs.getString("sex"));
t5.setText(rs.getString("age"));
t6.setText(rs.getString("dept"));
System.out.println("record");
}
} catch (SQLException ex) {
}
}
}
if (e.getSource().equals(b11)) {
if ((t9.getText().equals("m")) || (t9.getText().equals("f"))) {
if ((t7.getText().equals("")) || (t8.getText().equals("")) ||
(t9.getText().equals("")) || (t10.getText().equals("")) ||
(t11.getText().equals(""))) {
JOptionPane.showMessageDialog(null, "pleace enter all fields",
"warning", JOptionPane.WARNING_MESSAGE);
} else {
String idj = t7.getText();
String namej = t8.getText();
String mij=t35.getText();
String lnaj=t36.getText();
String sexj = t9.getText();
int agej = Integer.parseInt(t10.getText());
float salaj = Float.parseFloat(t11.getText());
String query = "insert into Emplo
(id,name,mi,lname,sex,age,salary)values('" + idj + "','" + namej + "','" + mij +
"','" + lnaj + "','" + sexj + "','" + agej + "','" + salaj + "')";
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
t7.setText(" ");
t8.setText(" ");
t9.setText(" ");
t35.setText(" ");
t36.setText(" ");
t10.setText(" ");
t11.setText(" ");
} catch (SQLException ex) {
System.out.println("error" + ex);
}
}
} else {
JOptionPane.showMessageDialog(null, "pleace enter corect age and
sex", "warning", JOptionPane.WARNING_MESSAGE);
}
}
if (e.getSource().equals(b12)) {
if (t7.getText().equals("")) {
JOptionPane.showMessageDialog(null, "pleace enter your id",
"warning", JOptionPane.WARNING_MESSAGE);
} else {
String query = "Update Emplo set name='" + t8.getText() + "' where
id='" + t7.getText() + "'";
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
} catch (SQLException ex) {
System.out.println("error" + ex);
}
}
}
if (e.getSource().equals(b13)) {
if (t7.getText().equals("")) {
JOptionPane.showMessageDialog(null, "pleace enter your id",
"warning", JOptionPane.WARNING_MESSAGE);
} else {
String query = "delete from Emplo where id='" + t7.getText() + "'";
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
t7.setText("");
} catch (SQLException ex) {
System.out.println("error" + ex);
}
if (e.getSource().equals(b15)) {
if (t7.getText().equals("")) {
JOptionPane.showMessageDialog(null, "pleace enter your id",
"warning", JOptionPane.WARNING_MESSAGE);
} else {
String query = "select *from Emplo where id='" + t7.getText() +
"'";
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.prepareStatement(query);
rs = stmt.executeQuery(query);
while (rs.next()) {
t7.setText(rs.getString("id"));
t8.setText(rs.getString("name"));
t35.setText(rs.getString("mi"));
t36.setText(rs.getString("lname"));
t9.setText(rs.getString("sex"));
t10.setText(rs.getString("age"));
t11.setText(rs.getString("salary"));
System.out.println("record");
}
} catch (SQLException ex) {
}
}
}
if (e.getSource().equals(b6)) {
if (((t4.getText().equals("m")) || (t4.getText().equals("f"))) &&
((Integer.parseInt(t5.getText()) > 18) && (Integer.parseInt(t5.getText()) < 100)))
{
if ((t2.getText().equals("")) || (t3.getText().equals("")) ||
(t4.getText().equals("")) || (t5.getText().equals("")) ||
(t6.getText().equals(""))||(t37.getText().equals(""))||(t38.getText().equals("")))
{
JOptionPane.showMessageDialog(null, "pleace enter all fields",
"warning", JOptionPane.WARNING_MESSAGE);
} else {
String idj = t2.getText();
String namej = t3.getText();
String mij=t37.getText();
String lnaj=t38.getText();
String sexj = t4.getText();
int agej = Integer.parseInt(t5.getText());
String deptj = t6.getText();
String query = "insert into
stud(id,name,mi,lname,sex,age,dept)values('" + idj + "','" + namej + "','" + mij +
"','" + lnaj + "','" + sexj + "','" + agej + "','" + deptj + "')";
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
t2.setText(" ");
t3.setText(" ");
t37.setText(" ");
t38.setText(" ");
t4.setText(" ");
t5.setText(" ");
t6.setText(" ");
} catch (SQLException ex) {
System.out.println("error" + ex);
}
}
} else {
JOptionPane.showMessageDialog(null, "pleace enter corect age and
sex", "warning", JOptionPane.WARNING_MESSAGE);
}
}
if (e.getSource().equals(b7)) {
if (t2.getText().equals("")) {
JOptionPane.showMessageDialog(null, "pleace enter your id",
"warning", JOptionPane.WARNING_MESSAGE);
} else {
String query = "Update stud set name='" + t3.getText() + "',mi='"
+ t37.getText() + "',lname='" + t38.getText() + "' ,dept='" + t6.getText() + "'
where id='" + t2.getText() + "'";
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
t2.setText("");
t3.setText("");
t4.setText("");
t5.setText("");
t6.setText("");
t37.setText("");
t38.setText("");
} catch (SQLException ex) {
System.out.println("error" + ex);
}
}
if (e.getSource().equals(b8)) {
if (t2.getText().equals("")) {
JOptionPane.showMessageDialog(null, "pleace enter your id",
"warning", JOptionPane.WARNING_MESSAGE);
} else {
String query = "delete from stud where id='" + t2.getText() + "'";
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
t2.setText("");
} catch (SQLException ex) {
System.out.println("error" + ex);
}
}
if (e.getSource().equals(b16)) {
// if(((t4.getText().equals("m"))||
(t4.getText().equals("f")))&&((Integer.parseInt(t5.getText())>18)&&(Integer.parseIn
t(t5.getText())<100)))
if ((t111.getText().equals("")) || (t12.getText().equals("")) ||
(t13.getText().equals("")))//||(t5.getText().equals(""))||
(t6.getText().equals("")))
{
JOptionPane.showMessageDialog(null, "pleace enter all fields",
"warning", JOptionPane.WARNING_MESSAGE);
} else {
String deptj = t111.getText();
String namej = t12.getText();
String conj = t13.getText();
String autj=t23.getText();
String codj=t24.getText();
String query = "insert into
Book(price,name,content,authorname,code)values('" + deptj + "','" + namej + "','" +
conj + "','" +autj +"','" + codj +"')";
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
} catch (SQLException ex) {
System.out.println("error" + ex);
}
}
}
if (e.getSource().equals(b17)) {
if (t24.getText().equals("")) {
JOptionPane.showMessageDialog(null, "pleace enter book code",
"warning", JOptionPane.WARNING_MESSAGE);
} else {
String query = "Update Book set (name='" + t12.getText() + "' ||
price='" + t11.getText() + "'||content='" + t13.getText() + "'||authorname='" +
t23.getText() + "') where code='" + t24.getText() + "'";
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
if (e.getSource().equals(b18)) {
if (t24.getText().equals("")) {
JOptionPane.showMessageDialog(null, "pleace enter your dept",
"warning", JOptionPane.WARNING_MESSAGE);
} else {
String query = "delete from Book where code='" + t24.getText() +
"'";
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
t24.setText("");
} catch (SQLException ex) {
System.out.println("error" + ex);
}
}
}
//-------------------------------------------------------------------------
--------------------------------
//*********************************************************************************
*******************************
if (e.getSource().equals(b20)) {
if (t24.getText().equals("")) {
JOptionPane.showMessageDialog(null, "pleace enter your code",
"warning", JOptionPane.WARNING_MESSAGE);
} else {
String query = "select * from Book where code='" + t24.getText() +
"'";
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.prepareStatement(query);
rs = stmt.executeQuery(query);
while (rs.next()) {
t111.setText(rs.getString("price"));
t12.setText(rs.getString("name"));
t13.setText(rs.getString("content"));
t23.setText(rs.getString("authorname"));
System.out.println("record");
}
} catch (SQLException ex) {
}
}
}
if (e.getSource().equals(b28)) {
if (t2.getText().equals("")) {
JOptionPane.showMessageDialog(null, "pleace enter your ssn",
"warning", JOptionPane.WARNING_MESSAGE);
} else {
String query = "select * from Emplo where ssn='" + t18.getText() +
"'";
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.prepareStatement(query);
rs = stmt.executeQuery(query);
while (rs.next()) {
t3.setText(rs.getString("name"));
t35.setText(rs.getString("mi"));
t36.setText(rs.getString("lname"));
t4.setText(rs.getString("sex"));
t5.setText(rs.getString("age"));
t6.setText(rs.getString("salary"));
System.out.println("record");
}
} catch (SQLException ex) {
}
}
}
if (e.getSource().equals(b25)) {
if (t2.getText().equals("")) {
JOptionPane.showMessageDialog(null, "pleace enter your ssn",
"warning", JOptionPane.WARNING_MESSAGE);
} else {
String query = "Update emplo set name='" + t20.getText() + "' where
ssn='" + t18.getText() + "'";
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
} catch (SQLException ex) {
System.out.println("error" + ex);
}
}
if (e.getSource().equals(b26)) {
if (t18.getText().equals("")) {
JOptionPane.showMessageDialog(null, "pleace enter your ssn",
"warning", JOptionPane.WARNING_MESSAGE);
} else {
String query = "delete from emplo where ssn='" + t18.getText() +
"'";
try {
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
} catch (SQLException ex) {
System.out.println("error" + ex);
}
}
if(e.getSource().equals(b34)){
if(t25.getText().equals("")){
JOptionPane.showMessageDialog(null, "pleace enter your id",
"warning", JOptionPane.WARNING_MESSAGE);
}else{
String query = "select * from mana where id='" + t25.getText() + "'";
try{
con = DriverManager.getConnection("jdbc:mysql://localhost/book",
"root", "123");
stmt = con.prepareStatement(query);
rs = stmt.executeQuery(query);
while(rs.next()){
t26.setText(rs.getString("name"));
t39.setText(rs.getString("mi"));
t40.setText(rs.getString("lname"));
t27.setText(rs.getString("sex"));
t28.setText(rs.getString("age"));
t29.setText(rs.getString("salary"));
System.out.println("record");
}
}catch (SQLException ex){
}
}
}
if(e.getSource().equals(b30)){
if (((t27.getText().equals("m")) || (t27.getText().equals("f"))) &&
((Integer.parseInt(t28.getText()) > 18) && (Integer.parseInt(t28.getText()) <
100))) {
if ((t25.getText().equals("")) || (t26.getText().equals("")) ||
(t27.getText().equals("")) || (t28.getText().equals("")) ||
(t29.getText().equals(""))) {
JOptionPane.showMessageDialog(null, "pleace enter all fields",
"warning", JOptionPane.WARNING_MESSAGE);
}else{
String idj=t25.getText();
String namej=t26.getText();
String mij=t39.getText();
String lnamej=t40.getText();
String sexj=t27.getText();
int agej=Integer.parseInt(t28.getText());
float salarj=Float.parseFloat(t29.getText());
String query="insert into
mana(id,name,mi,lname,sex,age,salary)values('" + idj + "','" + namej + "','" + mij
+ "','" + lnamej + "','" + sexj + "','" + agej + "','" + salarj + "')";
try{
con = DriverManager.getConnection("jdbc:mysql://localhost/book",
"root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
//*********************************************************************************
*************************************************************
t25.setText(" ");
t26.setText(" ");
t27.setText(" ");
t28.setText(" ");
t29.setText(" ");
t39.setText(" ");
t40.setText(" ");
}catch (SQLException ex) {
System.out.println("error" + ex);
}
}
}else {
JOptionPane.showMessageDialog(null, "pleace enter corect age and
sex", "warning", JOptionPane.WARNING_MESSAGE);
}
}
if(e.getSource().equals(b32)){
if(t25.getText().equals("")){
JOptionPane.showMessageDialog(null, "pleace enter your id",
"warning", JOptionPane.WARNING_MESSAGE);
}else{
String query = "delete from mana where id='" + t25.getText() + "'";
try{
con = DriverManager.getConnection("jdbc:mysql://localhost/book",
"root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
t25.setText("");
}catch(SQLException ex){
System.out.println("error" + ex);
}
}
}
if(e.getSource().equals(b31)){
if(t25.getText().equals("")){
JOptionPane.showMessageDialog(null, "pleace enter your id",
"warning", JOptionPane.WARNING_MESSAGE);
}else{
String query = "Update mana set name='" + t26.getText() + "' where
ssn='" + t25.getText() + "'";
try{
con = DriverManager.getConnection("jdbc:mysql://localhost/book",
"root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
}catch(SQLException ex){
System.out.println("error" + ex);
}
}
}
if(e.getSource().equals(b39)){
if((t30.getText().equals(""))&&(t32.getText().equals(""))){
JOptionPane.showMessageDialog(null, "pleace enter cd code and
ISBN", "warning", JOptionPane.WARNING_MESSAGE);
}else{
String query = "select * from mana where dept='" + t30.getText()
+ "','" + t32.getText() + "'";
try{
con =
DriverManager.getConnection("jdbc:mysql://localhost/book", "root", "123");
stmt = con.prepareStatement(query);
rs = stmt.executeQuery(query);
while(rs.next()){
t30.setText(rs.getString("cd cod"));
t31.setText(rs.getString("title"));
t32.setText(rs.getString("ISBN"));
t33.setText(rs.getString("edition"));
t30.setText(rs.getString("publition"));
System.out.println("record");
}
}catch(SQLException ex){
}
}
}
if(e.getSource().equals(b35)){
if ((t30.getText().equals("")) || (t31.getText().equals("")) ||
(t32.getText().equals("")) || (t33.getText().equals("")) ||
(t34.getText().equals(""))){
JOptionPane.showMessageDialog(null, "pleace enter all fields",
"warning", JOptionPane.WARNING_MESSAGE);
}else{
String cdcoj=t30.getText();
String titj=t31.getText();
String sibj=t32.getText();
String edj=t33.getText();
String pij=t34.getText();
String query="insert into cd(CDcode,Title,ISBN
,Edition,Publition)values('" + cdcoj +"','" + titj +"','" + sibj +"','" + edj
+"','"+ pij +"')";
try{
con = DriverManager.getConnection("jdbc:mysql://localhost/book",
"root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
//aditional info
***********************************************************************************
*///////
t30.setText(" ");
t31.setText(" ");
t32.setText(" ");
t33.setText(" ");
t34.setText(" ");
}catch(SQLException ex){
System.out.println("error" + ex);
}
}
}
if(e.getSource().equals(b37)){
if((t30.getText().equals(""))&&(t32.getText().equals(""))){
JOptionPane.showMessageDialog(null, "pleace enter cd cod and ISBN NO",
"warning", JOptionPane.WARNING_MESSAGE);
}else{
String query="delete cd where CDcode='" + t30.getText() +"' ||
where ISBN ='" + t32.getText() +"'";
try{
con = DriverManager.getConnection("jdbc:mysql://localhost/book",
"root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
}catch(SQLException ex){
System.out.println("error" + ex);
}
}
}
if(e.getSource().equals(b36)){
if((t30.getText().equals(""))&&(t32.getText().equals(""))){
JOptionPane.showMessageDialog(null, "pleace enter cd cod and ISBN NO",
"warning", JOptionPane.WARNING_MESSAGE);
}else{
String query="update cd set Title='" + t31.getText() +"' where cd
code='"+ t30.getText() +"' || where ISBN NO='"+ t32.getText() +"'";
try{
con = DriverManager.getConnection("jdbc:mysql://localhost/book",
"root", "123");
stmt = con.createStatement();
stmt.executeUpdate(query);
JOptionPane.showMessageDialog(null, "succesful", "succes",
JOptionPane.INFORMATION_MESSAGE);
stmt.close();
con.close();
}catch(SQLException ex){
System.out.println("error" + ex);
}
}
}
//////////////////////////////////////////////employee table clear
if(e.getSource().equals(b43)){
t7.setText(" ");
t8.setText(" ");
t9.setText(" ");
t10.setText(" ");
t11.setText(" ");
t35.setText(" ");
t36.setText(" ");
}
//////////////////////////////////////////////////////////student table
crear
if(e.getSource().equals(b42)){
t2.setText(" ");
t3.setText(" ");
t37.setText(" ");
t38.setText(" ");
t4.setText(" ");
t5.setText(" ");
t6.setText(" ");
}
//--++++++++++++++++++++++++++++++++book table clear
if(e.getSource().equals(b44)){
t111.setText(" ");
t12.setText(" ");
t13.setText(" ");
t23.setText(" ");
t24.setText(" ");
}
/////////////////////////////////////////////////////////////manager table
clear
if(e.getSource().equals(b45)){
t25.setText(" ");
t26.setText(" ");
t39.setText(" ");
t27.setText(" ");
t40.setText(" ");
t28.setText(" ");
t29.setText(" ");
}
////////////////////////////////////////////////////////////cd table clear
if(e.getSource().equals(b46)){
t30.setText(" ");
t31.setText(" ");
t32.setText(" ");
t33.setText(" ");
t34.setText(" ");
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++
if (e.getSource().equals(b1)) {
String y = "library system";
String pa = "themtuname";
st.setVisible(false);
} else {
JOptionPane.showMessageDialog(null,"please enter corect
username/pasword");
st.setVisible(true);
t1.setText("");
pass.setText("");
}
}
if(e.getSource().equals(b47))
{
try{
t1.setText("");
pass.setText("");
// dd.setVisible(false);
st.setVisible(true);
fr.setVisible(false);
sd.setVisible(false);
em.setVisible(false);
bo.setVisible(false);
mn.setVisible(false);
c.setVisible(false);
}catch(Exception ex){
}
}
if (e.getSource() == b2) {
System.exit(0);
}
if(e.getSource().equals(b41)){
t1.setText("");
pass.setText("");
}
if (e.getSource().equals(b48)) {
//cr.setVisible(false);
creat();
}
if(e.getSource().equals(b50)){
cr.setVisible(false);
}
if(e.getSource().equals(b54)){
bl.setVisible(false);
}
if(e.getSource().equals(b55)){
nsbl.setVisible(false);
}
if (e.getSource().equals(b5)) {
stud();
}
if (e.getSource().equals(b4)) {
Emplo();
}
if(e.getSource().equals(b40))
{
cd();
}
if (e.getSource().equals(b3)) {
Book();
}
if(e.getSource().equals(b29))
{
mana();
}
if(e.getSource().equals(b51))
{
booklist();
}
if(e.getSource().equals(b53))
{
nasbl();
}
if(e.getSource().equals(b531))
{
socibl();
}
if(e.getSource().equals(b5311))
{
compbl();
}
if(e.getSource().equals(b38))
{
select6();
}
if(e.getSource().equals(b33))
{
select5();
}
if (e.getSource().equals(b14)) {
select4();
}
if (e.getSource().equals(b19)) {
select3();
}
if (e.getSource().equals(b9)) {
select2();
}
}
}