Você está na página 1de 58

In academic

Affiliation with

FRONT COVER
FRONT COVER
ASSIGNMENT

Assignment by
Full Name of the)
:(Student

Raya Abdullah Al-Shreef

Student ID.NO

6307

Module Title

HCI and Usability

Programmer Area

IS

Level

Academic Year

2014 2013

Semester

Assessment

Assignment

Weighting

50%

Date Of Submission

11/6/2014

Time

11:30

Table of Contents

.No

Heading

Page No

Introduction

Design
Documentation
2
Use Case Diagram(1
Class Diagram(2
Sequence Diagram(3
Collaboration (4
Diagram
State Diagram(5

4-8

Data Base
Java Code

55-56
9-54

Conclusion &

96

3
4

Reference

Introduction
The bookshop system is very important to give a good quality and a good
services for clients. So all the required what the client need, they will find in
the system.
In this assignment I will put plan for how I can create the screens and what I
should put in it. Because I want to start step by step to be a successful. so I
will create 8 screens. There are, Login , Book, Bookshop System, Customer,
Employee, Main Menu, Supplier, Manager.
In assignment we use more programs to help our understand quickly, it
include:
1) Net Beans to implementation
2) Smart Draw to drawing some diagram ,so I draw five diagrams such
as:
-use case diagram.
- class diagram.
- sequence diagram.
-collaboration diagram.
-state diagram.
3) Microsoft Access to insert the database.
(Microsoft Word to writ the report. 4
.

Use case Diagrams

M anager
A dd new em plo yee

C heck Account

R e tu n th e B o o k

S ar c h th e d atab a se
C hick B o o k

Add B ook
B o o k S h o p S yste m

D e le te B o o k

U p d ate B o o k

Supplier

Class diagrams
M ange r

B o o k S h o p S y ste m

C - Id
M anager nam e
C -N am e
C - A dd re ss
C -E m ail

B a n k ID
C u s to m e r d e tails

u p d ate d e ta ils ()

S ave ()
A d d()

add
*
C u sto m e r

S u p p lie r

E m p lo y e e

C
C
C
C

S -Id
S -N am e

E
E
E
E

S e arc h()

A d d()
S ave ()
D e le te ( )

- ID
-N am e
- A ddre s
-e m ail

bo rro w B o o k()
re tu rn B o o k ()

m
m
m
m

p lo
p lo
p lo
p lo

yee
yee
yee
yee

u p date

ID :in te g e r
N am e :S trin g
A d d re s :S trin g
E m a il:S trin g

Sequence diagrams
Supplier

S yste m

C u sto m e r

M anager

B o o k sh o p S yste m
1 .L o g i n t o t h e B o o k s h o p s y s t e m

1 .1 D i s b u r s e m e n t o f f u n d s

c
1 .1 .1 D e p o s i t a t t h e B o o k S h o p

1 .1 .1 .1 D e p o s i t

S u c c e s s fu l

Collaboration diagrams

1 .L o g i n t o t h e B o o k s h o p s y s t e m

B o o k s h o p S y s te m

B an k T e lle r
1 .1 D i s b u r s e m e n t o f f u n d s

C u sto m er

1 .1 .1 D e p o s it a t th e B o o k s h o p

1 .1 .1 .1 D e p o s i t

Supplier

M anager

State diagrams

W e lc o m e

B o o k s h o p S ys te m

S u p p lie r
C u s t o m e r D e ta ils

M anage r
L o g in

L o g in

M a in M e n u e

S u p lie r

M anage r

C u s to m e r A c c o n t

A dd N ew B ook

E m p lo y e e D e ta il

Java Code
Main Menu Screen
This is Menu Screen, it has eight button, when you click each button in Bookshop
.is going to screen., and exit close the screen

import java.awt.*;
9

import
import
import
import
import
import

java.awt.event.ActionEvent;
java.awt.event.ActionListener;
java.util.Locale;
javax.activation.CommandMap;
javax.swing.ImageIcon;
javax.swing.JLabel;

class MainMenu extends Frame implements ActionListener


{
Label L_Welcome;
Button customer,Exit,Employee,Manager,Suppiler,B_Book,B_rep,BookshopeSystem;
JLabel img;
void display(){
L_Welcome = new Label("Welcome to my book shop system");
L_Welcome.setFont(new Font("green", Font.TYPE1_FONT, 20));
add(L_Welcome).setBounds(10,10,350,50);
customer = new Button("Customer");
Manager = new Button("Manager");
Employee = new Button("Employee");
Suppiler = new Button("Supplier");
B_Book = new Button("book");
Exit = new Button("Exit");
B_rep = new Button("Report");
BookshopeSystem = new Button("BookshopeSystem");
add(customer).setBounds(90,90,200,40);
add(Manager).setBounds(340,90,200,40);
add(Employee).setBounds(90,170,200,40);
add(Suppiler).setBounds(340,170,200,40);
add(B_Book).setBounds(90,260,200,40);
add(B_rep).setBounds(340,260,200,40);
add(BookshopeSystem).setBounds(90,340,200,40);
add(Exit).setBounds(340,340,200,40);
add(customer).setForeground(Color.RED);
add(Manager).setForeground(Color.RED);
add(Manager).setForeground(Color.RED);
add(Suppiler).setForeground(Color.RED);
add(B_Book).setForeground(Color.RED);
add(Exit).setForeground(Color.RED);
add(B_rep).setForeground(Color.RED);
add(BookshopeSystem).setForeground(Color.RED);
customer.addActionListener(this);
Manager.addActionListener(this);
Employee.addActionListener(this);
Suppiler.addActionListener(this);
B_Book.addActionListener(this);
10

Exit.addActionListener(this);
B_rep.addActionListener(this);
BookshopeSystem.addActionListener(this);
img = new JLabel();
img.setIcon(new ImageIcon("ggg.jpg"));
add(img).setBounds(0,0,700,700);
setSize(700,700);
setVisible(true);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource() == Exit)
{
System.exit('0');
}
if(ae.getSource() == customer)
{
Customer frame1 = new Customer();
frame1.setResizable(false);
frame1.setSize(800,600);
frame1.setLayout(null);
frame1.setTitle("Customer");
frame1.setVisible(true);
}
if(ae.getSource() ==Manager);
{
Manager frame11 = new Manager();
frame11.setResizable(false);
frame11.setSize(800,600);
frame11.setLayout(null);
frame11.setTitle("Manager");
frame11.setVisible(true);
}
if(ae.getSource() == Employee)
{
Employee frame2 = new Employee();
frame2.setResizable(false);
frame2.setSize(800,600);
frame2.setLayout(null);
frame2.setTitle("Employee");
frame2.setVisible(true);
}
if(ae.getSource() == Suppiler)
11

{
Suppiler frame3 = new Suppiler();
frame3.setResizable(false);
frame3.setSize(800,600);
frame3.setLayout(null);
frame3.setTitle("suplier");
frame3.setVisible(true);
}
if(ae.getSource() == B_Book)
{
Book frame7 = new Book();
frame7.setResizable(false);
frame7.setSize(800,600);
frame7.setLayout(null);
frame7.setTitle("Book");
frame7.setVisible(true);
}
if(ae.getSource() == BookshopeSystem)
{
BookShopSystem frame2 = new BookShopSystem();
frame2.setResizable(false);
frame2.setSize(800,600);
frame2.setLayout(null);
frame2.setTitle("BookshopeSystem");
frame2.setVisible(true);
}
}
}

/*public static void main (String args[])


{
Mine frm = new Mine();
frm.setSize(850,850);
frm.setResizable(false);
frm.setLayout(null);
frm.setTitle("Mine");
frm.setVisible(true);
frm.display();
/*{{

12

Login Screen

13

This is login Screen . You can use the username as 222 and
Password as 222 . It has one buttons Such as login button is
.going to book Shop System screen

;*.import
javax.swing
;*.import
java.awt
;*.import
java.awt.event
} public
class Login
extends
;JButton
b11,b12
;JTextField t11,t12
;JLabel
lab1,ab2
;JLabel img1

JFrame implements ActionListener

} ()public Login
;setTitle("LogIn")
;()Container
con=getContentPane
;con.setLayout(null)
;b11=new
;b12=new

JButton("Login")
JButton("Exit")

;t11=new
;t12=new

JTextField("",20)
JTextField("",15)

;lab1=new
;ab2=new

JLabel("user Name")
JLabel("Password")

;b11.setForeground(Color.red)
;b12.setForeground(Color.green)
;lab1.setForeground(Color.blue)
14

;ab2.setForeground(Color.blue)
;t11.setBackground(Color.white)
;t12.setBackground(Color.white)
;b11.setBounds(200,200,130,40)
;b12.setBounds(350,200,130,40)
;lab1.setBounds(30,50,200,30)
;ab2.setBounds(30,90,220,30)
;t11.setBounds(120,50,110,30)
;t12.setBounds(120,90,110,30)
;con.add(b11)
;con.add(b12)
;con.add(lab1)
;con.add(ab2)
;con.add(t11)
;con.add(t12)
;b11.addActionListener(this)
;b12.addActionListener(this)
;() img1 = new JLabel
;img1.setIcon(new ImageIcon("imr.jpg"))
;add(img1).setBounds(0,0,700,700)
;setSize(500,500)
;setVisible(true)
;setDefaultCloseOperation(EXIT_ON_CLOSE)
{
public void actionPerformed(ActionEvent e)
}
if(e.getSource() == b12)
}
;System.exit('0')
{
}
;()String value1=t11.getText
};()String value2=t12.getText
} if (value1.equals("222") && value2.equals("222"))
;()Mine page=new Mine//
;page.setVisible(true)//

15

}if(e.getSource()==b11)
;()MainMenu b=new MainMenu
;b.setVisible(true)
;b.setSize(860,650)
;b.setResizable(false)
;b.setLayout(null)
;b.setTitle("Mine")
;()b.display
{
{
} else if (value1.equals("000") && value2.equals("000"))
;()Mine page=new Mine//
;page.setVisible(true)//
{
{{{
public static void main(String arg[])
}
}
;()Login frame=new Login
;frame.setSize(350,350)
;frame.setVisible(true)
;frame.setLayout(null)
;frame.setTitle("LogIn")
;frame.setVisible(true)
{
{
{

Customer

16

This is customer details screen.

I put nine buttons, each button have

function to doing. Also, I put details of customer such as Id, Name , Age ,
.Address, Telephone Number, Gender

;*.import java.awt
;*.import java.awt.event
;*.import java.sql
;*.import javax.swing
class Customer extends JFrame implements ActionListener
}
;JLabel lblacc5946,lblname5946,lblage5946,lbladd5946,lbltel5946,lblgan5946
;JTextField txtacc5946,txtname5946,txtadd5946,txttel5946,txtage5946
;JRadioButton rbmale,rbfemale
;JButton btnadd5946,btnsave5946,btnupdate5946,btndelete5946,btnback5946
JButton btnnext,btnprev,btnlast,btnfirst;//these buttons that allows you go to
the required function
;String gen,d
;ResultSet rs=null
;Connection con=null
;Statement stmt=null
()Customer
}
}()addWindowListener(new WindowAdapter
public void windowClosing(WindowEvent we)
}
;System.exit(0)
17

{
;({
;setLayout(null)

;lblacc5946=new JLabel("ID:")
;lblname5946=new JLabel("Name:")
;lblage5946=new JLabel("Age:")
;lbladd5946=new JLabel("Address:")
;lbltel5946=new JLabel("Telephone Number")
;lblgan5946=new JLabel("Gender")
lblacc5946.setBounds(10,20,140,20);//setBounds(column,row,width,height)
;lblname5946.setBounds(10,60,140,20)
;lblage5946.setBounds(10,100,140,20)
;lbladd5946.setBounds(10,140,140,20)
;lbltel5946.setBounds(10,180,140,20)
;lblgan5946.setBounds(10,220,140,20)
add(lblacc5946);//to add
;add(lblname5946)
;add(lblage5946)
;add(lbladd5946)
;add(lbltel5946)
;add(lblgan5946)

lblacc5946.setFont(new Font("Cooper Black", Font.ITALIC, 13));//to change the


graphic
;lbladd5946.setFont(new Font("Cooper Black", Font.ITALIC, 13))
;lblage5946.setFont(new Font("Cooper Black", Font.ITALIC, 13))
;lblgan5946.setFont(new Font("Cooper Black", Font.ITALIC, 13))
;lblname5946.setFont(new Font("Cooper Black", Font.ITALIC, 13))
;lbltel5946.setFont(new Font("Cooper Black", Font.ITALIC, 13))
lblacc5946.setForeground(Color.RED);//setting forground color in windows
;lbladd5946.setForeground(Color.RED)
;lblage5946.setForeground(Color.RED)
;lblname5946.setForeground(Color.RED)
;lbltel5946.setForeground(Color.RED)
;lblgan5946.setForeground(Color.RED)
;txtacc5946=new JTextField(15)
;txtname5946=new JTextField(15)
18

;txtadd5946=new JTextField(15)
;txttel5946=new JTextField(15)
;txtage5946=new JTextField(15)
rbmale=new JRadioButton("Male");// to create
;rbfemale=new JRadioButton("Female")
txtacc5946.setBounds(150,20,140,20);//set Bounds(column, row,width,height)
;txtname5946.setBounds(150,60,140,20)
;txtage5946.setBounds(150,100,140,20)
;txtadd5946.setBounds(150,140,140,20)
;txttel5946.setBounds(150,180,140,20)
;rbmale.setBounds(150,220,60,20)
;rbfemale.setBounds(220,220,80,20)
add(txtacc5946);//to add
;add(txtname5946)
;add(txtadd5946)
;add(txttel5946)
;add(txtage5946)
;add(rbmale)
;add(rbfemale)
txtacc5946.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change the
graphic
;txtadd5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;txtname5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;txtage5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;txttel5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))

;()ButtonGroup bg=new ButtonGroup


;bg.add(rbmale)
;bg.add(rbfemale)
rbmale.addActionListener(this);//action can be fire on this button
;rbfemale.addActionListener(this)
rbfemale.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change the
graphic
;rbmale.setFont(new Font("Cooper Black", Font.ITALIC, 12))

btnadd5946=new JButton("Add");//to create


;btnsave5946=new JButton("Save")
;btnupdate5946=new JButton("Update")
;btndelete5946=new JButton("Delete")
19

btnadd5946.setBounds(300,10,100,30);//set Bounds(column,row,width,height)
;btnsave5946.setBounds(400,10,100,30)
;btnupdate5946.setBounds(300,60,100,30)
;btndelete5946.setBounds(400,60,100,30)
add(btnadd5946);//to add
;add(btnsave5946)
;add(btndelete5946)
;add(btnupdate5946)
btnadd5946.addActionListener(this);//action can be fire on this button
;btnsave5946.addActionListener(this)
;btnupdate5946.addActionListener(this)
;btndelete5946.addActionListener(this)
btnadd5946.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change the
graphic
;btnsave5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;btnupdate5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;btndelete5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))

btnfirst=new JButton("First");//to add


;btnnext=new JButton("Next")
;btnprev=new JButton("Previous")
;btnlast=new JButton("Last")
btnfirst.setBounds(300,120,100,30);//set Bounds(column, row,width, hieght)
;btnnext.setBounds(400,120,100,30)
;btnprev.setBounds(300,160,100,30)
;btnlast.setBounds(400,160,100,30)
add(btnfirst);//to add
;add(btnnext)
;add(btnprev)
;add(btnlast)
btnfirst.addActionListener(this);//action can be fire on this button
;btnnext.addActionListener(this)
;btnprev.addActionListener(this)
;btnlast.addActionListener(this)
btnfirst.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change the
graphic
;btnnext.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;btnlast.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;btnprev.setFont(new Font("Cooper Black", Font.ITALIC, 12))
20

btnback5946=new JButton("Back");//to create


btnback5946.setBounds(350,200,100,30);//set
Bounds(column,row,width,hieght)
add(btnback5946);//to add
btnback5946.addActionListener(this);//action can be fire on this button
btnback5946.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change
the graphic
;()dbOpen
{
public void actionPerformed(ActionEvent ae)
}
try
}
if(ae.getActionCommand()=="Add")//write customer details for
adding
}
;("")txtacc5946.setText
;("")txtname5946.setText
;("")txtage5946.setText
;("")txtadd5946.setText
;("")txttel5946.setText
{
if(ae.getActionCommand()=="Update")// to update details for
customer
}
stmt.executeUpdate("UPDATE Customer SET Name='" +
txtname5946.getText() + "',Age= '" + txtage5946.getText() + "',Address=" +
txtadd5946.getText() + "',TelephoneNumber=" + txttel5946.getText() +
;",Gender='"+gen+"' WHERE AccountNumber=" + txtacc5946.getText() + "")
;()dbClose
;()dbOpen
{
if(ae.getActionCommand()=="Delete")//to delete details for
customer
}
stmt.executeUpdate("DELETE FROM Customer WHERE
;AccountNumber=" + txtacc5946.getText() + "")
;()dbClose
;()dbOpen
21

{
if(ae.getActionCommand()=="Save")//to save the details
}
stmt.executeUpdate("INSERT INTO Customer VALUES('" +
txtacc5946.getText() + "','" + txtname5946.getText() + "','" + txtage5946.getText()
;+ "','" + txtadd5946.getText() +"','" + txttel5946.getText() + "','"+gen+"')")
;()dbClose
;()dbOpen
{
if(ae.getActionCommand()=="Next")// enables to showing next
name of customer
}
if(rs.next())
}
;()setText
setText();
{
else
}
JOptionPane.showMessageDialog(null, "You are At
;Already Last Record", "Message", JOptionPane.ERROR_MESSAGE)
{
{
if(ae.getActionCommand()=="Previous")
}
if(rs.previous())
}
;()setText
{
else
}
JOptionPane.showMessageDialog(null, "You Are At
;Already First Record", "Message", JOptionPane.ERROR_MESSAGE)
{
{
if (ae.getActionCommand()=="First")// enables to showing first
name of customer
}
if(rs.first())
}
;()setText
{
{
if (ae.getActionCommand()=="Last")//enables to showing last
name of customer
}
if(rs.last())
22

}
;()setText
{
{
if(ae.getActionCommand()=="Back")// to back
}
;setVisible(false)
{
if(ae.getActionCommand()=="Female")
}
;"gen="Female
{
else
}
;"gen="Male
{
{
catch(Exception e)
}
;()e.printStackTrace
{
{
()public void dbOpen
}
try
}
to add details in Microsoft access//
;Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
;con=DriverManager.getConnection("jdbc:odbc:Rayya")
stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_
;UPDATABLE)
;rs = stmt.executeQuery("Select * from Customer")
if(rs.next())
;()setText
{}catch(Exception e){
{
()public void dbClose
}
;()try{stmt.close
;()rs.close
;()con.close
{}catch(Exception e){
{

23

}()public void setText


}try
;txtacc5946.setText(rs.getString(1))
;txtname5946.setText(rs.getString(2))
;txtage5946.setText(rs.getString(3))
;txtadd5946.setText(rs.getString(4))
;txttel5946.setText(rs.getString(5))
if(rs.getString(6).equals("Male"))
}
;rbmale.setSelected(true)
{
else
}
;rbfemale.setSelected(true)
{
{}catch(Exception ex){
{
{

24

Bookshop System Screen


This is Bookshop System screen. I put one button, The button have function to
.doing. Also, I put details of Bookshop System such as User name & Password

;*.import
javax.swing
;*.import
java.awt
;*.import java.awt.event
;import static javax.swing.JFrame.EXIT_ON_CLOSE
} public
class BookShopSystem extends
JFrame implements ActionListener
;JButton
b51
;JTextField t31,t32
;JLabel
lab31,lab32
;JLabel
e95, imagesCAH6KSO2
;ImageIcon m4
;JRadioButton

r11 , r12

} () public BookShopSystem
;setTitle("BOOK SHOP SYSTEM")
;()Container
con=getContentPane
;con.setLayout(null)
;b51=new JButton("LOG IN")
;t31=new JTextField("",20)
;t32=new JTextField("",20)
25

;()imagesCAH6KSO2=new JLabel
;m4=new ImageIcon ("C:/imagesCAH6KSO2.jpg")
;lab31=new
;lab32=new

;r11=new
;r12=new

JLabel("User name")
JLabel("Passward")

JRadioButton("Employee")
JRadioButton("End user")

;b51.setForeground(Color.RED)
;t31.setBackground(Color.PINK)
;t32.setBackground(Color.PINK)

;b51.setBounds(60,300,90,30)
;t31.setBounds(140,30,120,30)
;t32.setBounds(140,70,120,30)
;imagesCAH6KSO2.setBounds(280,20,300,260)
;imagesCAH6KSO2.setIcon(m4)
;lab31.setBounds(40,30,90,30)
;lab32.setBounds(40,70,90,30)

;r11.setBounds(20,170,80,30)
;r12.setBounds(140,170,80,30)
;b51.addActionListener(this)
;con.add(imagesCAH6KSO2)
;con.add(lab31)
;con.add(t31)
;con.add(lab32)
;con.add(t32)
;con.add(r11)
;con.add(r12)
;con.add(b51)

26

;setSize(600,400)
;setVisible(false)
;setDefaultCloseOperation(EXIT_ON_CLOSE)
{
}public void actionPerformed(ActionEvent e)
}if(e.getSource()==b51)
;()Employee a6=new Employee
;a6.setVisible(true)
;b51.setForeground(Color.blue)
{
{
{

Manager Screen

27

This is Manager screen , it has nine buttons Such as, Add, Save, Update ,Delete,
.First, Next, Previous, last and Back . Each buttons have function to doing
Also, I put details of manager such as Id, Name, City, Phone Number, Salary and
gender

;*.import
;*.import
;*.import
;*.import

java.awt
java.awt.event
java.sql
javax.swing

class Manager extends JFrame implements ActionListener


}
;JLabel lbl=new JLabel("Manager Information")
;Font f=new Font("Times",Font.BOLD,26)
;Font f1=new Font("Times",Font.BOLD,14)
;JLabel lblid,lblname,lbladdress,lblgender,lblsalary,lblphoneNumber, lblsubmit
;JTextField txtid,txtname,txtaddress,txtsalary,txtphoneNumber,txtgender
;JRadioButton rbmale,rbfemale
;JButton btnadd,btnsave,btnupdate,btndelete,btnback
;JButton btnnext,btnprev,btnlast,btnfirst
;String gen
;ResultSet rs=null
;Connection con=null
;Statement stmt=null
()Manager
}
}()addWindowListener(new WindowAdapter
public void windowClosing(WindowEvent we)
28

}
;System.exit(0)
{
;({
;setLayout(null)
;lblsubmit=new JLabel("Thanks for using this program.")
;add(lblsubmit)
;lblsubmit.setBounds(420,540,350,20)
;add(lbl)
;lbl.setBounds(300,50,300,30)
;lbl.setFont(f)
;lblid=new JLabel("ID")
;lblname=new JLabel("NAME")
;lbladdress=new JLabel("City")
;lblphoneNumber=new JLabel("phone number")
;lblsalary=new JLabel("Salary")
;lblgender=new JLabel("gender")
;lblid.setBounds(300,140,100,20)
;lblname.setBounds(300,180,100,20)
;lbladdress.setBounds(300,220,100,20)
;lblphoneNumber.setBounds(300,260,100,20)
;lblsalary.setBounds(300,300,100,20)
;lblgender.setBounds(300,340,100,20)
;add(lblid)
;add(lblname)
;add(lbladdress)
;add(lblphoneNumber)
;add(lblsalary)
;add(lblgender)
;lblid.setFont(f1)
;lblname.setFont(f1)
;lbladdress.setFont(f1)
;lblphoneNumber.setFont(f1)
;lblsalary.setFont(f1)
;lblgender.setFont(f1)
;txtid=new JTextField(15)
;txtname=new JTextField(15)
;txtaddress=new JTextField(15)
;txtphoneNumber=new JTextField(15)
;txtsalary=new JTextField(15)
;rbmale=new JRadioButton("Male")
;rbfemale=new JRadioButton("Female")
;txtid.setBounds(400,140,100,20)
29

;txtname.setBounds(400,180,100,20)
;txtaddress.setBounds(400,220,100,20)
;txtphoneNumber.setBounds(400,260,100,20)
;txtsalary.setBounds(400,300,100,20)
;rbmale.setBounds(400,340,70,20)
;rbfemale.setBounds(470,340,70,20)
;add(txtid)
;add(txtname)
;add(txtaddress)
;add(txtphoneNumber)
;add(txtsalary)
;add(rbmale)
;add(rbfemale)
;()ButtonGroup bg=new ButtonGroup
;bg.add(rbmale)
;bg.add(rbfemale)
;rbmale.addActionListener(this)
;rbfemale.addActionListener(this)
;btnadd=new JButton("Add")
;btnsave=new JButton("Save")
;btnupdate=new JButton("Update")
;btndelete=new JButton("Delete")
;btnadd.setBounds(200,400,100,30)
;btnsave.setBounds(310,400,100,30)
;btnupdate.setBounds(420,400,100,30)
;btndelete.setBounds(530,400,100,30)
;add(btnadd)
;add(btnsave)
;add(btndelete)
;add(btnupdate)
;btnadd.addActionListener(this)
;btnsave.addActionListener(this)
;btnupdate.addActionListener(this)
;btndelete.addActionListener(this)
;btnfirst=new JButton("First")
;btnnext=new JButton("Next")
;btnprev=new JButton("Previous")
;btnlast=new JButton("Last")
;btnfirst.setBounds(200,440,100,30)
30

;btnnext.setBounds(310,440,100,30)
;btnprev.setBounds(420,440,100,30)
;btnlast.setBounds(530,440,100,30)
;add(btnfirst)
;add(btnnext)
;add(btnprev)
;add(btnlast)
;btnfirst.addActionListener(this)
;btnnext.addActionListener(this)
;btnprev.addActionListener(this)
;btnlast.addActionListener(this)
;btnback=new JButton("Back")
;btnback.setBounds(360,480,100,30)
;add(btnback)
;btnback.addActionListener(this)
;()dbOpen
{
public void actionPerformed(ActionEvent ae)
}
try
}
if(ae.getActionCommand()=="Add")
}
;("")txtid.setText
;("")txtname.setText
;("")txtaddress.setText
;("")txtphoneNumber.setText
;("")txtsalary.setText
{
if(ae.getActionCommand()=="Update")
}
stmt.executeUpdate("UPDATE manager SET name='" +
txtname.getText() + "','" + txtphoneNumber.getText()+"','" + txtaddress.getText() +
"','" + txtsalary.getText() + "','" + ",gender='"+gen+"' WHERE id=" +
;txtid.getText() + "")
;()dbClose
;()dbOpen
{
if(ae.getActionCommand()=="Delete")
}
stmt.executeUpdate("DELETE FROM manager WHERE
;id=" + txtid.getText() + "")
;()dbClose
31

;()dbOpen
{
if(ae.getActionCommand()=="Save")
}
stmt.executeUpdate("INSERT INTO manager VALUES('" +
txtid.getText() + "','" + txtname.getText() + "','" + txtaddress.getText() + "',"
+txtphoneNumber.getText() + "'," +txtsalary.getText() + ",'"+txtgender.getText()
;+"")
;()dbClose
;()dbOpen
{
if(ae.getActionCommand()=="Next")
}
if(rs.next())
}
;()setText
setText();
{
else
}
JOptionPane.showMessageDialog(null, "You are At
;Already Last Record", "Message", JOptionPane.ERROR_MESSAGE)
{
{
if(ae.getActionCommand()=="Previous")
}
if(rs.previous())
}
;()setText
{
else
}
JOptionPane.showMessageDialog(null, "You Are At
;Already First Record", "Message", JOptionPane.ERROR_MESSAGE)
{
{
if (ae.getActionCommand()=="First")
}
if(rs.first())
}
;()setText
{
{
if (ae.getActionCommand()=="Last")
}
if(rs.last())
}
;()setText
{
{
32

if(ae.getActionCommand()=="Back")
}
;setVisible(false)
{
if(ae.getActionCommand()=="Female")
}
;"gen="Female
{
else
}
;"gen="Male
{
{
catch(Exception e)
}
;()e.printStackTrace
{
{
()public void dbOpen
}
try
}
;Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
;con=DriverManager.getConnection("jdbc:odbc:Rayya")
stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_
;UPDATABLE)
;rs = stmt.executeQuery("Select * from manager")
if(rs.next())
;()setText
{}catch(Exception e){
{
()public void dbClose
}
;()try{stmt.close
;()rs.close
;()con.close
{}catch(Exception e){
{
}()public void setText
}try
;txtid.setText(rs.getString(1))
;txtname.setText(rs.getString(2))
;txtaddress.setText(rs.getString(3))
33

;txtphoneNumber.setText(rs.getString(4))
;txtsalary.setText(rs.getString(5))
if(rs.getString(5).equals("Male"))
}
;rbmale.setSelected(true)
{
else
}
;rbfemale.setSelected(true)
{
{}catch(Exception ex){
{
{

Supplier Screen
This Supplier screen , it has nine buttons Such as, Add, Save, Update ,Delete ,First,
Next, Previous, last and Back . Each buttons have function to doing .
Also, I put details of Supplier such as Id number , Name, Age, Telephone Number,
.Adders, Specialization and gender

34

;*.import
;*.import
;*.import
;*.import

java.awt
java.awt.event
java.sql
javax.swing

class Suppiler extends JFrame implements ActionListener


}
JLabel
;lblident5946,lblname5946,lblage5946,lblsp5946,lbladd5946,lbltel5946,lblgen5946
JTextField
;txtident5946,txtname5946,txtsp5946,txtadd5946,txttel5946,txtAge5946
;JRadioButton rbmale,rbfemale
;JButton btnadd5946,btnsave5946,btnupdate5946,btndelete5946,btnback5946
JButton btnnext5946,btnprev5946,btnlast5946,btnfirst5946;//these buttons that
allows you go to the required function
;String gen
;ResultSet rs=null
;Connection con=null
;Statement stmt=null
()Suppiler
}
}()addWindowListener(new WindowAdapter
public void windowClosing(WindowEvent we)
}
35

;System.exit(0)
{
;({
;setLayout(null)

lblident5946=new JLabel("Id number:");//to create


;lblname5946=new JLabel("Name:")
;lblage5946=new JLabel("Age:")
;lblsp5946=new JLabel("Specialisation:")
;lbladd5946=new JLabel("Address:")
;lbltel5946=new JLabel("Telephone Number:")
;lblgen5946=new JLabel("Gender:")
lblident5946.setBounds(10,20,160,20);//setBounds(column,row,width,height)
;lblname5946.setBounds(10,60,100,20)
;lblage5946.setBounds(10,100,100,20)
;lblsp5946.setBounds(10,140,160,20)
;lbladd5946.setBounds(10,180,100,20)
;lbltel5946.setBounds(10,210,140,20)
;lblgen5946.setBounds(10,250,100,20)
add(lblident5946);//to add
;add(lblname5946)
;add(lblage5946)
;add(lblsp5946)
;add(lbladd5946)
;add(lbltel5946)
;add(lblgen5946)
lbladd5946.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change the
graphic
;lblage5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;lblgen5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;lblident5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;lblname5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;lblsp5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;lbltel5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
lbladd5946.setForeground(Color.RED);//setting forground color in windows
;lblage5946.setForeground(Color.RED)
;lblgen5946.setForeground(Color.RED)
;lblident5946.setForeground(Color.RED)
;lblname5946.setForeground(Color.RED)
;lblsp5946.setForeground(Color.RED)
36

;lbltel5946.setForeground(Color.RED)

;txtident5946=new JTextField(15)
;txtname5946=new JTextField(15)
;txtAge5946=new JTextField(15)
;txtsp5946=new JTextField(15)
;txtadd5946=new JTextField(15)
;txttel5946=new JTextField(15)
rbmale=new JRadioButton("Male");//to create
;rbfemale=new JRadioButton("Female")
txtident5946.setBounds(170,20,100,20);//set Bounds(column, row,
width,height)
;txtname5946.setBounds(170,60,100,20)
;txtAge5946.setBounds(170,100,100,20)
;txtsp5946.setBounds(170,140,100,20)
;txtadd5946.setBounds(170,180,100,20)
;txttel5946.setBounds(170,210,100,20)
;rbmale.setBounds(170,250,70,20)
;rbfemale.setBounds(240,250,70,20)
add(txtident5946);//to add
;add(txtname5946)
;add(txtsp5946)
;add(txtadd5946)
;add(txttel5946)
;add(txtAge5946)
;add(rbmale)
;add(rbfemale)
txttel5946.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change of
graphic
;txtAge5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;txtsp5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;txtname5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;txtadd5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;txtident5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;()ButtonGroup bg=new ButtonGroup
;bg.add(rbmale)
;bg.add(rbfemale)
rbmale.addActionListener(this);//action can be fire on this button
37

;rbfemale.addActionListener(this)
rbfemale.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change the
graphic
;rbmale.setFont(new Font("Cooper Black", Font.ITALIC, 12))
btnadd5946=new JButton("Add");//to add
;btnsave5946=new JButton("Save")
;btnupdate5946=new JButton("Update")
;btndelete5946=new JButton("Delete")
btnadd5946.setBounds(300,10,100,30);//set Bounds(column, row, width,height)
;btnsave5946.setBounds(300,60,100,30)
;btnupdate5946.setBounds(300,110,100,30)
;btndelete5946.setBounds(300,170,100,30)
btnadd5946.setForeground(Color.BLACK);//setting forgroud colour in windows
;btnsave5946.setForeground(Color.BLACK)
;btnupdate5946.setForeground(Color.BLACK)
;btndelete5946.setForeground(Color.BLACK)
add(btnadd5946);//to add
;add(btnsave5946)
;add(btndelete5946)
;add(btnupdate5946)
btnadd5946.addActionListener(this);// action can be fire on this button
;btnsave5946.addActionListener(this)
;btnupdate5946.addActionListener(this)
;btndelete5946.addActionListener(this)
btnadd5946.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change the
graphic
;btnsave5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;btnupdate5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;btndelete5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
btnfirst5946=new JButton("First");//to create
;btnnext5946=new JButton("Next")
;btnprev5946=new JButton("Previous")
;btnlast5946=new JButton("Last")
btnfirst5946.setBounds(10,300,70,30);//set Bounds(column,row, width,height)
;btnnext5946.setBounds(100,300,70,30)
;btnprev5946.setBounds(190,300,100,30)
;btnlast5946.setBounds(310,300,70,30)
btnfirst5946.setForeground(Color.BLACK);//setting forground color in windows
;btnnext5946.setForeground(Color.BLACK)
;btnprev5946.setForeground(Color.BLACK)
;btnlast5946.setForeground(Color.BLACK)
add(btnfirst5946);//to add
;add(btnnext5946)
38

;add(btnprev5946)
;add(btnlast5946)
btnfirst5946.addActionListener(this);//action can be fire oon this button
;btnnext5946.addActionListener(this)
;btnprev5946.addActionListener(this)
;btnlast5946.addActionListener(this)
btnfirst5946.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change the
graphic
;btnlast5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;btnnext5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;btnprev5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
btnback5946=new JButton("Back");//to create
btnback5946.setBounds(300,220,100,30);//setBounds(column,row,width,hieght)
add(btnback5946);//to add
btnback5946.setForeground(Color.BLACK);//setting forground color in windwos
btnback5946.addActionListener(this);//action can be fire on this button
btnback5946.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change
the graphic
;()dbOpen
{
public void actionPerformed(ActionEvent ae)
}
try
}
if(ae.getActionCommand()=="Add")//write Employee details for
adding
}
;("")txtident5946.setText
;("")txtname5946.setText
;("")txtAge5946.setText
;("")txtsp5946.setText
;("")txtadd5946.setText
;("")txttel5946.setText
{
if(ae.getActionCommand()=="Update")// to change the details
}
stmt.executeUpdate("UPDATE supplier SET Name='" +
txtname5946.getText() + "',Age='" + txtAge5946.getText() + "',Specialisation='"
+ txtsp5946.getText() + "',Address='" + txtadd5946.getText()
+"',TelephoneNumber=" + txttel5946.getText() + ",Gender='"+gen+"' WHERE
;IdentificationNumber=" + txtident5946.getText() + "")
;()dbClose
;()dbOpen
39

{
if(ae.getActionCommand()=="Delete")//to remove the details
}
stmt.executeUpdate("DELETE FROM supplier WHERE
;IdentificationNumber=" + txtident5946.getText() + "")
;()dbClose
;()dbOpen
{
if(ae.getActionCommand()=="Save")//to save the details
}
stmt.executeUpdate("INSERT INTO supplier VALUES('" +
txtident5946.getText() + "','" + txtname5946.getText() +"','" +
txtAge5946.getText() + "','" + txtsp5946.getText() + "','" + txtadd5946.getText() +
;"','"+txttel5946.getText() + "','"+gen+"')")
;()dbClose
;()dbOpen
{
if(ae.getActionCommand()=="Next")//enables to showing the
next name of employee
}
if(rs.next())
}
;()setText
setText();
{
else
}
JOptionPane.showMessageDialog(null, "You are At
;Already Last Record", "Message", JOptionPane.ERROR_MESSAGE)
{
{
if(ae.getActionCommand()=="Previous")
}
if(rs.previous())
}
;()setText
{
else
}
JOptionPane.showMessageDialog(null, "You Are At
;Already First Record", "Message", JOptionPane.ERROR_MESSAGE)
{
{
if (ae.getActionCommand()=="First")//enables to showing first
name of employee
}
if(rs.first())
}
;()setText
{
40

{
if (ae.getActionCommand()=="Last")//enables to showing last
name of employee
}
if(rs.last())
}
;()setText
{
{
if(ae.getActionCommand()=="Back")// to going back
}
;setVisible(false)
{
if(ae.getActionCommand()=="Female")
}
;"gen="Female
{
else
}
;"gen="Male
{
{
catch(Exception e)
}
;()e.printStackTrace
{
{
()public void dbOpen
}
try
}
to add databse in Microsoft Access//
;Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
;con=DriverManager.getConnection("jdbc:odbc:Rayya")
stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_
;UPDATABLE)
;rs = stmt.executeQuery("Select * from supplier")
if(rs.next())
;()setText
{}catch(Exception e){
{
()public void dbClose
}
;()try{stmt.close
41

;()rs.close
;()con.close
{}catch(Exception e){
{
}()public void setText
}try
;txtident5946.setText(rs.getString(1))
;txtname5946.setText(rs.getString(2))
;txtAge5946.setText(rs.getString(3))
;txtsp5946.setText(rs.getString(4))
;txtadd5946.setText(rs.getString(5))
;txttel5946.setText(rs.getString(6))
if(rs.getString(7).equals("Male"))
}
;rbmale.setSelected(true)
{
else
}
;rbfemale.setSelected(true)
{
{}catch(Exception ex){
{
{

42

Employee Screen
This Employee screen , it has nine buttons Such as, Add, Save, Update ,Delete ,First,
Next, Previous, last and Back . Each buttons have function to doing .
Also, I put details of Employee such as Id number , Name, Age, Telephone Number,
.Adders, Specialization and gender

;*.import
;*.import
;*.import
;*.import

java.awt
java.awt.event
java.sql
javax.swing

class Employee extends JFrame implements ActionListener


}
JLabel
;lblident5946,lblname5946,lblage5946,lblsp5946,lbladd5946,lbltel5946,lblgen5946
JTextField
;txtident5946,txtname5946,txtsp5946,txtadd5946,txttel5946,txtAge5946
43

;JRadioButton rbmale,rbfemale
;JButton btnadd5946,btnsave5946,btnupdate5946,btndelete5946,btnback5946
JButton btnnext5946,btnprev5946,btnlast5946,btnfirst5946;//these buttons that
allows you go to the required function
;String gen
;ResultSet rs=null
;Connection con=null
;Statement stmt=null
()Employee
}
}()addWindowListener(new WindowAdapter
public void windowClosing(WindowEvent we)
}
;System.exit(0)
{
;({
;setLayout(null)

lblident5946=new JLabel("Id number:");//to create


;lblname5946=new JLabel("Name:")
;lblage5946=new JLabel("Age:")
;lblsp5946=new JLabel("Specialisation:")
;lbladd5946=new JLabel("Address:")
;lbltel5946=new JLabel("Telephone Number:")
;lblgen5946=new JLabel("Gender:")
lblident5946.setBounds(10,20,160,20);//setBounds(column,row,width,height)
;lblname5946.setBounds(10,60,100,20)
;lblage5946.setBounds(10,100,100,20)
;lblsp5946.setBounds(10,140,160,20)
;lbladd5946.setBounds(10,180,100,20)
;lbltel5946.setBounds(10,210,140,20)
;lblgen5946.setBounds(10,250,100,20)
add(lblident5946);//to add
;add(lblname5946)
;add(lblage5946)
;add(lblsp5946)
;add(lbladd5946)
;add(lbltel5946)
;add(lblgen5946)

44

lbladd5946.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change the


graphic
;lblage5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;lblgen5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;lblident5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;lblname5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;lblsp5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;lbltel5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
lbladd5946.setForeground(Color.RED);//setting forground color in windows
;lblage5946.setForeground(Color.RED)
;lblgen5946.setForeground(Color.RED)
;lblident5946.setForeground(Color.RED)
;lblname5946.setForeground(Color.RED)
;lblsp5946.setForeground(Color.RED)
;lbltel5946.setForeground(Color.RED)

;txtident5946=new JTextField(15)
;txtname5946=new JTextField(15)
;txtAge5946=new JTextField(15)
;txtsp5946=new JTextField(15)
;txtadd5946=new JTextField(15)
;txttel5946=new JTextField(15)
rbmale=new JRadioButton("Male");//to create
;rbfemale=new JRadioButton("Female")
txtident5946.setBounds(170,20,100,20);//set Bounds(column, row,
width,height)
;txtname5946.setBounds(170,60,100,20)
;txtAge5946.setBounds(170,100,100,20)
;txtsp5946.setBounds(170,140,100,20)
;txtadd5946.setBounds(170,180,100,20)
;txttel5946.setBounds(170,210,100,20)
;rbmale.setBounds(170,250,70,20)
;rbfemale.setBounds(240,250,70,20)
add(txtident5946);//to add
;add(txtname5946)
;add(txtsp5946)
;add(txtadd5946)
;add(txttel5946)
;add(txtAge5946)
;add(rbmale)
;add(rbfemale)
45

txttel5946.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change of


graphic
;txtAge5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;txtsp5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;txtname5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;txtadd5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;txtident5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;()ButtonGroup bg=new ButtonGroup
;bg.add(rbmale)
;bg.add(rbfemale)
rbmale.addActionListener(this);//action can be fire on this button
;rbfemale.addActionListener(this)
rbfemale.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change the
graphic
;rbmale.setFont(new Font("Cooper Black", Font.ITALIC, 12))
btnadd5946=new JButton("Add");//to add
;btnsave5946=new JButton("Save")
;btnupdate5946=new JButton("Update")
;btndelete5946=new JButton("Delete")
btnadd5946.setBounds(300,10,100,30);//set Bounds(column, row, width,height)
;btnsave5946.setBounds(300,60,100,30)
;btnupdate5946.setBounds(300,110,100,30)
;btndelete5946.setBounds(300,170,100,30)
btnadd5946.setForeground(Color.BLACK);//setting forgroud colour in windows
;btnsave5946.setForeground(Color.BLACK)
;btnupdate5946.setForeground(Color.BLACK)
;btndelete5946.setForeground(Color.BLACK)
add(btnadd5946);//to add
;add(btnsave5946)
;add(btndelete5946)
;add(btnupdate5946)
btnadd5946.addActionListener(this);// action can be fire on this button
;btnsave5946.addActionListener(this)
;btnupdate5946.addActionListener(this)
;btndelete5946.addActionListener(this)
btnadd5946.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change the
graphic
;btnsave5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;btnupdate5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;btndelete5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
btnfirst5946=new JButton("First");//to create
46

;btnnext5946=new JButton("Next")
;btnprev5946=new JButton("Previous")
;btnlast5946=new JButton("Last")
btnfirst5946.setBounds(10,300,70,30);//set Bounds(column,row, width,height)
;btnnext5946.setBounds(100,300,70,30)
;btnprev5946.setBounds(190,300,100,30)
;btnlast5946.setBounds(310,300,70,30)
btnfirst5946.setForeground(Color.BLACK);//setting forground color in windows
;btnnext5946.setForeground(Color.BLACK)
;btnprev5946.setForeground(Color.BLACK)
;btnlast5946.setForeground(Color.BLACK)
add(btnfirst5946);//to add
;add(btnnext5946)
;add(btnprev5946)
;add(btnlast5946)
btnfirst5946.addActionListener(this);//action can be fire oon this button
;btnnext5946.addActionListener(this)
;btnprev5946.addActionListener(this)
;btnlast5946.addActionListener(this)
btnfirst5946.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change the
graphic
;btnlast5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;btnnext5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
;btnprev5946.setFont(new Font("Cooper Black", Font.ITALIC, 12))
btnback5946=new JButton("Back");//to create
btnback5946.setBounds(300,220,100,30);//setBounds(column,row,width,hieght)
add(btnback5946);//to add
btnback5946.setForeground(Color.BLACK);//setting forground color in windwos
btnback5946.addActionListener(this);//action can be fire on this button
btnback5946.setFont(new Font("Cooper Black", Font.ITALIC, 12));//to change
the graphic
;()dbOpen
{
public void actionPerformed(ActionEvent ae)
}
try
}
if(ae.getActionCommand()=="Add")//write Employee details for
adding
}
;("")txtident5946.setText
47

;("")txtname5946.setText
;("")txtAge5946.setText
;("")txtsp5946.setText
;("")txtadd5946.setText
;("")txttel5946.setText
{
if(ae.getActionCommand()=="Update")// to change the details
}
stmt.executeUpdate("UPDATE Employee SET Name='" +
txtname5946.getText() + "',Age='" + txtAge5946.getText() + "',Specialisation='"
+ txtsp5946.getText() + "',Address='" + txtadd5946.getText()
+"',TelephoneNumber=" + txttel5946.getText() + ",Gender='"+gen+"' WHERE
;IdentificationNumber=" + txtident5946.getText() + "")
;()dbClose
;()dbOpen
{
if(ae.getActionCommand()=="Delete")//to remove the details
}
stmt.executeUpdate("DELETE FROM Employee WHERE
;IdentificationNumber=" + txtident5946.getText() + "")
;()dbClose
;()dbOpen
{
if(ae.getActionCommand()=="Save")//to save the details
}
stmt.executeUpdate("INSERT INTO Employee VALUES('" +
txtident5946.getText() + "','" + txtname5946.getText() +"','" +
txtAge5946.getText() + "','" + txtsp5946.getText() + "','" + txtadd5946.getText() +
;"','"+txttel5946.getText() + "','"+gen+"')")
;()dbClose
;()dbOpen
{
if(ae.getActionCommand()=="Next")//enables to showing the
next name of employee
}
if(rs.next())
}
;()setText
setText();
{
else
}
JOptionPane.showMessageDialog(null, "You are At
;Already Last Record", "Message", JOptionPane.ERROR_MESSAGE)
{
{
if(ae.getActionCommand()=="Previous")
}
if(rs.previous())
}
48

;()setText
{
else
}
JOptionPane.showMessageDialog(null, "You Are At
;Already First Record", "Message", JOptionPane.ERROR_MESSAGE)
{
{
if (ae.getActionCommand()=="First")//enables to showing first
name of employee
}
if(rs.first())
}
;()setText
{
{
if (ae.getActionCommand()=="Last")//enables to showing last
name of employee
}
if(rs.last())
}
;()setText
{
{
if(ae.getActionCommand()=="Back")// to going back
}
;setVisible(false)
{
if(ae.getActionCommand()=="Female")
}
;"gen="Female
{
else
}
;"gen="Male
{
{
catch(Exception e)
}
;()e.printStackTrace
{
{
()public void dbOpen
}
try
}
to add databse in Microsoft Access//
49

;Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")
;con=DriverManager.getConnection("jdbc:odbc:Rayya")
stmt=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_
;UPDATABLE)
;rs = stmt.executeQuery("Select * from Employee")
if(rs.next())
;()setText
{}catch(Exception e){
{
()public void dbClose
}
;()try{stmt.close
;()rs.close
;()con.close
{}catch(Exception e){
{
}()public void setText
}try
;txtident5946.setText(rs.getString(1))
;txtname5946.setText(rs.getString(2))
;txtAge5946.setText(rs.getString(3))
;txtsp5946.setText(rs.getString(4))
;txtadd5946.setText(rs.getString(5))
;txttel5946.setText(rs.getString(6))
if(rs.getString(7).equals("Male"))
}
;rbmale.setSelected(true)
{
else
}
;rbfemale.setSelected(true)
{
{}catch(Exception ex){
{
{

50

Book Screen
This Book screen , it has two buttons Such as, Next and Back . Each buttons have
function to doing .
Also, I put details of Book such as Type of book , Author , Series , Title, Language,
Published place, Publisher, Publisher date, Allow search procedure , Allow
.borrowing

51

;*.import
javax.swing
;*.import
java.awt
;*.import java.awt.event
;import static javax.swing.JFrame.EXIT_ON_CLOSE
}public
class Book
extends
JFrame implements ActionListener
;JButton
b41,b42
;JTextField t21,t22,t23,t24,t25,t26,t27
;JLabel
lab21,lab22,lab23,lab24,lab25,lab26,lab27,lab28,lab29,lab210
; JComboBox
c1
String elect[]={"Medical Book","History Book","Pyschology Book","Translator
;Book","Art Book"}
;JCheckBox ch21,ch22
;JLabel
e94, imagesCA9XQY54
;ImageIcon m3
} () public Book
;setTitle("BOOK MANAGEMENT")
;()Container
con=getContentPane
;con.setLayout(null)
;b41=new JButton("BACK")
;b42=new JButton("NEXT")
;t21=new JTextField("",20)
;t22=new JTextField("",20)
;t23=new JTextField("",20)
;t24=new JTextField("",20)
;t25=new JTextField("",20)
;t26=new JTextField("",20)
;t27=new JTextField("",20)
52

;()imagesCA9XQY54=new JLabel
;m3=new ImageIcon ("ggg.jpg")
;lab21=new
JLabel("Type of book")
;lab22=new
JLabel("Author")
;lab23=new
JLabel("Series")
;lab24=new
JLabel("Title")
;lab25=new
JLabel("Language")
;lab26=new
JLabel("Published place")
;lab27=new
JLabel("Publisher")
;lab28=new
JLabel("Published date")
;lab29=new
JLabel("Allow search procedure")
;lab210=new
JLabel("Allow borrowing")
;c1=new JComboBox(elect)
;("")ch21=new JCheckBox
;("")ch22=new JCheckBox
;b41.setForeground(Color.MAGENTA)
;b42.setForeground(Color.MAGENTA)
;t21.setBackground(Color.ORANGE)
;t22.setBackground(Color.ORANGE)
;t23.setBackground(Color.ORANGE)
;t24.setBackground(Color.ORANGE)
;t25.setBackground(Color.ORANGE)
;t26.setBackground(Color.ORANGE)
;t27.setBackground(Color.ORANGE)
;b41.setBounds(20,400,80,30)
;b42.setBounds(470,400,100,30)
;imagesCA9XQY54.setBounds(300,20,300,260)
;imagesCA9XQY54.setIcon(m3)
;t21.setBounds(120,50,150,30)
;t22.setBounds(120,90,150,30)
;t23.setBounds(120,130,150,30)
;t24.setBounds(120,170,150,30)
;t25.setBounds(120,210,150,30)
;t26.setBounds(120,250,150,30)
;t27.setBounds(120,290,150,30)
;lab21.setBounds(10,10,90,30)
;lab22.setBounds(10,50,90,30)
;lab23.setBounds(10,90,90,30)
;lab24.setBounds(10,130,90,30)
;lab25.setBounds(10,170,90,30)
;lab26.setBounds(10,210,90,30)
;lab27.setBounds(10,250,120,30)
;lab28.setBounds(10,290,100,30)
53

;lab29.setBounds(10,330,150,30)
;lab210.setBounds(270,330,150,30)
;c1.setBounds(110,10,130,30)
;ch21.setBounds(170,330,50,30)
;ch22.setBounds(390,330,50,30)
;b41.addActionListener(this)
;b42.addActionListener(this)
;con.add(imagesCA9XQY54)
;con.add(lab21)
;con.add(c1)
;con.add(lab22)
;con.add(t21)
;con.add(lab23)
;con.add(t22)
;con.add(lab24)
;con.add(t23)
;con.add(lab25)
;con.add(t24)
;con.add(lab26)
;con.add(t25)
;con.add(lab27)
;con.add(t26)
;con.add(lab28)
;con.add(t27)
;con.add(lab29)
;con.add(ch21)
;con.add(lab210)
;con.add(ch22)
;con.add(b41)
;con.add(b42)
;setSize(700,600)
;setVisible(false)
;setDefaultCloseOperation(EXIT_ON_CLOSE)
{
}public void actionPerformed(ActionEvent e)
}if(e.getSource()==b41)
;()Book a3=new Book
;a3.setVisible(true)
;b41.setForeground(Color.blue)
{
}if(e.getSource()==b42)
;() MainMenu a5=new MainMenu
;a5.setVisible(true)
;b42.setForeground(Color.blue)
54

{
{
{

Data Base
:Book

55

Customer

Employee

Manager

Supplier

56

Conclusion

57

In this assignment titled (bookshop) I benefited a lot from him in identifying the
functions of each customer and order book details the list and how to find a
particular book, and a lot of information pertaining to the bookshop. I hope that you
.like it receives

Reference:
-www.j2medev.com
-www.alinterview.com

58

Você também pode gostar