Project Soft Copy
Project Soft Copy
IN
ADVANCE JAVA
ON
Submitted to:
Lovely Professional University
Jalandhar
Submitted By:-
Name :DHEERAJ SHARMA
Rollno:
Page 1
Software For Jewellery Shop Management
Tools Used
Front End:- Advance Java
Developed At:-
PTU Learning Center,
PATHANKOT.
Page 2
CERTIFICATE
Page 3
PREFACE
Page 4
PREFACE
The computers have gained a lot of importance in the past five decades. Most of our
day-to-day jobs are being influenced by the use of computers. Now a day, computers are
used for performing almost every function, which were performed by humans in the past. In
some areas such as science and technology, targets can’t be achieved without the use of
computers. The characteristics that make the computer so important include its extra
ordinary speed, large storage capacity, accuracy and consistency.
Today computers play a great role in various industries and a large number of industries
are using computers for various application such as maintaining cashbook, sales book,
purchase book and other books of accounts. Computers can also be used for the designing
of various products. Computers provide many options for the designing of products.
In this project report, steps have been taken for computerizing the Jewellery Shop
Management System. The analysis of the project has been undertaken with utmost sincerity
and honesty and we will be extremely satisfied if the effort is appreciated.
Page 5
ACKNOWLEDGEMENT
Page 6
ACKNOWLEDGEMENT
I take this opportunity to express my profound sense of gratitude and respect to all those
who helped me throughout this venture.
I owe my regards to Mr. Sunil Arora, director of PTU Learning Center, Pathankot for his
cooperation and valuable support and for giving me the opportunity to undertake this project
work and providing the necessary infrastructure.
I would like to express my heartfelt thanks to my Project Guide & Class Incharge
Mr. Rakesh Gupta for his valuable guidance, encouragement and support throughout my
studentship under him at the institute.This project is his visualization and owes a lot of its
functionality to him.
Last but not the least, I owe my overwhelming gratitude to my family and friends who gave
me constant support and motivation to continue with this endeavour.
DHEERAJ SHARMA
MCA (VI sem)
ROLLNO.
Page 7
INDEX
Page 8
INDEX
1. Introduction 10-11
2. Tool Used 12-20
a. Front End - Advance Java
b. Back End - Ms-Access 2003
3. Requirement Analysis 21-22
4. Feasibility Study 23-25
5. System Specification 26-27
6. Designs 28-59
a. Screen Design
b. Database Design
7. Coding 60-207
8. Testing 208-209
9. Conclusion & Enhancement 211-211
10. Bibliography 212-213
Page 9
1. INTRODUCTION
Page 10
INTRODUCTION
Page 11
2. TOOLS USED
Page 12
a) Front End :-
Advance Java
Page 13
Overview Of Java
History of Java :-
Simple Language.
Compiled & Interpreted Language.
Pure Object-Oriented.
Robust.
Secure
Architecture Neutral.
Portable
High Performance.
Dynamic.
Multithreaded.
The Java Development Kit comes with the collection of tools that are
used for developing and running java programs. Some of them are
following:
Packages Imported:
Packages and its Classes & Interfaces which are used in this Project are
following:-
Page 15
1. java.lang :-
Classes :- Interfaces :-
String Runnable
Integer
Thread
Exception
NumberFormatException
Class
System
2. java.awt :-
Classes :-
Frame
Button
CheckBox
TextField
Label
Choice
Color
Font
Graphics
Image
Menu
MenuItem
Page 16
MenuBar
Toolkit
CheckboxGroup
3. java.awt.event :-
Classes :- Interfaces :-
ActionEvent ActionListener
ItemEvent ItemListener
TextEvent TextListener
4. javax.swing :-
Classes :-
JButton
JLabel
JOptionPane
ImageIcon
5. java.sql :-
DriverManager Connection
Statement
ResultSet
User-Defined Classes :-
User –Defined Classes are those classes which are created by the
programmer as per his requirements. Here all User defined classes that
are used to construct this project are sub classes of Frame Class .It
means They all extends Frame class and all are built on null layout.
The following user defined classes are used to construct this project.
login
w1
loading
newuser
intro
home
design
order
order1
order2
admin
newdesign
modifydesign
staffentry
stafflist
records
records1
receipt
Page 18
b) Back End :-
MS-Access(2003)
Page 19
Ms-Access 2003 :-
Tables Name :-
Tables that are used in this project as backend , under this file are following:-
1. Customer
2. login
3. staff1
4. home
5. Design
Page 20
3 .Requirement
Analysis
Page 21
Proposed system
All the activities of systems have been automated and efforts have been made to
minimize the manual working.
The paper work is reduced to minimal level. Computer prepares all the reports and
lists.
2. No Manual Work.
There is no manual work. All the processes are done through computer.
Records can now easily be maintained by producing a report with a format of Sold
Items, On Order items and Cancel Order list.
Data is now stored at one place. Any information regarding anything can be easily
Available to the user.
6. User-friendly Software
7. Flexibility
The system is more flexible than the manual system being used presently.
8. Beneficial
Page 22
The system is easy to use and reduces the user’s workload a lot. It provides timely
and accurate information and there is automatic generation of reports.
4. FEASIBILITY STUDY
Page 23
During the course of completion of this project work, the complete analysis of proposed
system was done. In the analysis task, a complete care about the feasibility of the proposed
system was taken. The following feasibility analyses were carried out during the course of this
project work on call management system for customer care:
1. Economical feasibility
2. Technical feasibility
3. Operational feasibility
Economical Feasibility:-
Economic analysis is the most frequently used method for evaluating the effectiveness
of a candidate system. The proposed system is economically feasible because the benefits
and the savings that are expected from a candidate system outweighs the cost incurred. In this
case we are getting the intangible benefits in terms of low cost of maintenance of data, less
redundancy and getting the quick results.
Technical Feasibility:-
Hardware configuration:
a) Processor : Pentium IV
b) Memory : 512 MB RAM
c) HD capacity : 50GB
Software configuration:-
a) Operating system : Windows 98/XP/Vista
Page 24
b) Back end : MS-Access 2003
c) Front end : Advance Java
There is not such anything which is not technically feasible
Operational feasibility:-
As in the case of present system the entire work is being done manually. So the data
being scattered, information retrieval becomes difficult and maintaining database is also very
tedious. In case of proposed system, entire work will be done automatically. So the above
details regarding the feasibility study show that the design of the proposed system is very
effective.
Page 25
5. SYSTEM SPECIFICATION
Page 26
SYSTEM SPECIFICATION
The following is the Hardware & Software specification of the system on which the software
has been developed:-
HARDWARE SPECIFICATIONS:-
SOFTWARE SPECIFICATIONS:-
JDK 1.6
Page 27
7. DESIGNS
Page 28
a) SCREEN DESIGN
Page 29
Page 30
Page 31
Page 32
Page 33
Page 34
Page 35
Page 36
Page 37
Page 38
Page 39
Page 40
Page 41
Page 42
Page 43
Page 44
Page 45
Page 46
Page 47
Page 48
Page 49
Page 50
Page 51
Page 52
Page 53
Page 54
Page 55
Page 56
Page 57
Page 58
7. Coding
Page 59
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class w1 extends Frame implements ActionListener
{
ImageIcon img;
Label l1,l2,l3,l4,l5;
TextField t1,t2;
Font f;
JLabel jl,jl1;
JButton jb,jb1;
Color cl;
public w1()
{
setLayout(null);
cl=new Color(245,210,140);
setBackground(cl);
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC ,28 );
l1=new Label("JEWELLERY SHOP MANAGEMENT");
l1.setBounds(120,60,600,50);
add(l1);
l1.setFont(f);
img=new ImageIcon("shop1.jpg");
jl=new JLabel(img);
jl.setBounds(160,50,350,350 );
add(jl);
img=new ImageIcon("click.gif");
jb=new JButton(img);
jb.setBounds(500,420,150,50);
add(jb );
jb.setBackground(Color.BLACK);
l2=new Label("To login, plz ..........");
l2.setBounds(470,390,250,30);
add(l2);
f=new Font("Arial",Font.BOLD,20 );
l2.setFont(f);
l3=new Label("to exit from this project,plz click...");
l3.setBounds(20,500,200,30);
add(l3);
l4=new Label("User-Name");
l4.setBounds(500,280,110,20);
t1=new TextField();
t1.setBounds(610,280,150,20);
t1.setBackground(Color.red );
img=new ImageIcon("exit.gif");
jb1=new JButton(img);
jb1.setBounds(220,500,120,20);
add(jb1);
jb.addActionListener(this);
jb1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
Page 60
if(ae.getSource()==jb)
{
login ob=new login();
ob.setSize(350,250);
ob.setVisible(true);
ob.setLocationRelativeTo(null);
ob.setResizable(false);
ob.setTitle("Login....");
dispose();
}
if(ae.getSource()==jb1)
{ System.exit(0); }
}
}
}
Page 61
import java.awt.event.*;
import java.awt.*;
import javax.swing.*;
import java.sql.*;
class login extends Frame implements ActionListener
{
Label l1,l2;
TextField t1,t2;
Button b1,b2,b3;
Font f;
int cnt=0;
Connection cn=null;
Statement st=null;
ResultSet rs=null;
String name,name1,pword;
login()
{
setBackground(Color.black );
setLayout(null);
f=new Font("arial",Font.BOLD,20);
setFont(f);
l1=new Label("User-Name: ");
l1.setBounds(20,40,120 ,30);
add(l1);
l1.setForeground(Color.pink );
t1=new TextField();
t1.setBounds(140,40,150,30);
add(t1);
l2=new Label("Password :");
l2.setBounds(20,80,120,30);
add(l2);
l2.setForeground(Color.pink);
t2=new TextField();
t2.setBounds(140,80,150,30);
add(t2);
t2 .setEchoChar('*');
b1=new Button("Login");
b1.setBounds( 60,135 ,80,30);
add(b1);
b2=new Button("Cancel");
b2.setBounds(170,135,80,30);
add(b2);
b3=new Button("Create New user");
b3.setBounds(160,190,180,20);
add(b3);
b1.setBackground(Color.blue );
b2.setBackground(Color.blue);
b3.setBackground(Color.pink);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
Page 62
{
if(ae.getSource()==b1)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver
(*.mdb)};DBQ=e:/wel/tanishq.mdb");
st=cn.createStatement();
rs=st.executeQuery("select * from login");
while(rs.next())
{
name1=rs.getString("username");
pword=rs.getString("password");
if(t1.getText().equalsIgnoreCase(name1)&&(t2.getText().equals(pword)))
{
name=name1;
cnt++;
}
}
if(cnt==1)
{
loading ob=new loading(name);
ob.setSize(300,200);
ob.setVisible(true);
ob.setTitle("loading....");
ob.setLocationRelativeTo(null);
ob.setResizable(false);
dispose();
}
else if(t1.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"Plz Enter username " , "Login
Error",JOptionPane.WARNING_MESSAGE);
t1 .requestFocus();
}
else if (t2.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"Plz Enter password ", "Login
Error",JOptionPane.WARNING_MESSAGE);
t2 .requestFocus();
}
else
{
JOptionPane.showMessageDialog((null),"Invalid password or Id,Plz
Try again","Login Error", JOptionPane.WARNING_MESSAGE );
t1.setText("");
t2.setText("");
t1.requestFocus();
}
}
catch(Exception ex)
{System.out.println(ex);}
Page 63
}
if(ae.getSource()==b2)
{
w1 ob=new w1 ();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Jewellery shop");
dispose();
}
if(ae.getSource()==b3)
{
newuser ob=new newuser();
ob.setSize(350,250);
ob.setVisible(true);
ob.setTitle("New User Account");
ob.setLocationRelativeTo(null);
ob.setResizable(false);
dispose();
}
}
}
Page 64
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
class newuser extends Frame implements ActionListener
{
Label l1,l2,l3,l4;
TextField t1,t2,t3;
Button b1,b2;
String uname,pword;
int length,length1,cnt=0,ch=0,ch1=0;
Font f;
char c=' ',c1=' ';
Connection cn=null;
Statement st=null;
ResultSet rs=null;
newuser()
{
setLayout(null);
setBackground(Color.pink);
l1=new Label("Enter Username :");
l1.setBounds(20,50,110,20);
add(l1);
t1=new TextField();
t1.setBounds(140,50,110,20);
add(t1);
l2=new Label("Enter Password :");
l2.setBounds(20,80,110,20);
add(l2);
t2=new TextField();
t2.setBounds(140,80,110,20);
add(t2);
l3=new Label("Confirm Password :");
l3.setBounds(20,110,110,20);
add(l3);
t3=new TextField();
t3.setBounds(140,110,110,20);
add(t3);
t2.setEchoChar('*');
t3.setEchoChar('*');
f=new Font("New Times ROman",Font.BOLD,9);
l4=new Label("Rules: White Space is not allowed & password atleast 6 character
long");
Page 65
l4.setBounds(5,140,330,20);
add(l4);
l4.setFont(f);
f=new Font("New Times ROman",Font.BOLD,15);
b1=new Button("Create");
b1.setBounds(40,180,80,30);
add(b1);
b2=new Button("Cancel");
b2.setBounds(150,180,80,30);
add(b2);
b1.setBackground(Color.pink);
b2.setBackground(Color.pink);
b1.setFont(f);
b2.setFont(f);
b1.addActionListener(this);
b2.addActionListener(this);
{
try
{
cnt=0;ch=0;ch1=0;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ
=e:/wel/tanishq. mdb ");
st=cn.createStatement();
rs=st.executeQuery("select * from login");
while(rs.next())
{
if(t1.getText().equalsIgnoreCase(rs.getString("username")))
{
cnt++;
}
}
length1=t1.getText().length();
length=t2.getText().length();
for(int i=0;i<length;i++)
{
if(t2.getText().charAt(i)==c)
{
ch++;
}
}
for(int i=0;i<length1;i++)
{
if(t1.getText().charAt(i)==c1)
{
Page 66
ch1++;
}
}
if(t1.getText().equals("")&&t2.getText().equals("")&&t3.getText().equals(""))
{
JOptionPane.showMessageDialog((null)," All field are empty,Fill them
properly","Invalid Action", JOptionPane.WARNING_MESSAGE);
t1.requestFocus();
}
else if(t1.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"Enter username ", "Invalid Action",
JOptionPane.WARNING_MESSAGE);
t1.requestFocus();
}
else if(t2.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"Enter Password", "Invalid
Action",JOptionPane.WARNING_MESSAGE);
t2.requestFocus();
}
else if(t3.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"Enter Confirm Password","Invalid
Action",JOptionPane.WARNING_MESSAGE);
t3.requestFocus();
}
else if(cnt>=1)
{
JOptionPane.showMessageDialog((null),"This Username Already Exist","Invalid UserName",
JOptionPane. WARNING_ MESSAGE );
t1.setText("");t1.requestFocus();
}
else if(length<6)
{
JOptionPane.showMessageDialog((null),"Too Short Password length","Invalid Action",
JOptionPane.WARNING_MESSAGE);
t2.requestFocus();
}
else if(ch>=1)
{
JOptionPane.showMessageDialog((null),"White spaces are not allowed in Password","Invalid
Action",JOptionPane. WARNING_MESSAGE ) ;
t2.setText("");t3.setText("");t2.requestFocus();
}
else if(ch1>=1)
{
JOptionPane.showMessageDialog((null),"White spaces are not allowed in UserName","Invalid
Action",JOptionPane.WARNING_MESSAGE);
t1.setText("");t1.requestFocus();
}
else if(t2.getText().equals(t3.getText()))
Page 67
{
st.executeUpdate("insert into login values('"+t1.getText() +"','"+
t2.getText()+"')");
rs=st.executeQuery("select * from login");
JOptionPane.showMessageDialog((null),"New Account Created
Successfully","Information",JOptionPane.INFORMATION_MESSAGE);
t1.setText("");t2.setText("");t3.setText("");t1.requestFocus();
}
else
{
JOptionPane.showMessageDialog((null),"Confirmation Password didn't
match with Password","Invalid Action", JOptionPane. WARNING_MESSAGE);
t3.setText("");t3.requestFocus();
}
}
catch(Exception ex)
{System.out.println(ex);}
}
if(ae.getSource()==b2)
{
login ob=new login();
ob.setSize(350,250);
ob.setVisible(true);
ob.setLocationRelativeTo(null);
ob.setResizable(false);
ob.setTitle("Login....");
dispose();
}}
}
Page 68
import java.awt.*;
class loading extends Frame implements Runnable
{
Label l1[]=new Label[10];
Label l2,l3;
Image img;
int i,y=0,x=33 ;
Thread th;
Font f;
String str;
loading(String name)
{
str=name;
setBackground(Color.lightGray);
setLayout(null );
th=new Thread(this);
f=new Font("Arial",Font.BOLD,20 );
l2=new Label("Loading settings.....");
l2.setBounds(10,50,190,20);
add(l2);
l2.setFont(f );
for(i=0;i<=9;i++)
{
l1[i ]=new Label();
l1[i].setBounds(x,127,23,18 );
add(l1[i]);
x=x+25 ;
}
img=Toolkit.getDefaultToolkit().getImage("time.gif");
l3=new Label("");
l3.setBounds(150,160,120,20);
add(l3);
th.start();
}
Page 69
l1[i].setBackground(Color.blue);
l3.setText("processing...."+y+"%");
Thread.sleep(500);
if(i>=9)
{
intro ob=new intro(str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("welcome");
dispose();
}
}
}
catch(Exception e)
{System.out.println(e);}
}
public void paint(Graphics g)
{
g.drawImage(img,210,35,this);
g.drawRect(30,120 ,250,30);
}
Page 70
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class intro extends Frame implements ActionListener
{
Color cl;
ImageIcon ic;
JLabel jl ,jl1,jl3,jl4;
JButton jb,jb1;
Label l1,l2,l3,l4,l5;
TextField t1;
Font f;
Button b1,b2;
String str;
intro(String name)
{
str=name;
cl=new Color(20,150,140 );
setBackground(cl );
setLayout(null);
setForeground(Color.blue);
ic=new ImageIcon("wel2.gif");
jl=new JLabel(ic);
jl.setBounds(5,25 ,350,250);
add(jl);
f=new Font("Edwardian Script ITC",Font.BOLD| Font.ITALIC,25 );
jl3=new JLabel("in");
jl3.setBounds(350,220,25,25);
add(jl3);
jl3.setFont(f);
jl3.setForeground(Color.blue);
f=new Font("Edwardian Script ITC",Font.BOLD| Font.ITALIC,55);
jl4=new JLabel("Tanishq Jeweller");
jl4.setBounds(340,250,380,55);
add(jl4);
jl4.setFont(f);
jl4.setForeground(Color.blue);
ic=new ImageIcon("tan.jpg");
jl1=new JLabel(ic);
jl1.setBounds(430,27,400,200);
add(jl1);
l3=new Label("for Customers,click open....");
l3.setBounds(430,350,250,30);
add(l3);
l4=new Label("only for Admin,to enter click..");
Page 71
l4.setBounds(20,350,160,30);
l5=new Label("Enter code");
l5.setBounds(25,380,80,30);
add(l5);
t1=new TextField();
t1.setBounds(107,380,100,20);
t1.setEchoChar('*');
add(t1);
ic=new ImageIcon("open1.gif");
jb=new JButton(ic);
jb.setBounds(580,380,80,80);
add(jb);
jb.setBackground(cl);
ic=new ImageIcon("go.gif");
jb1=new JButton(ic);
jb1.setBounds(180,380,25,20);
if(str.equalsIgnoreCase("admin"))
{
add(jb1);add(l4);
}
b1=new Button("Submit");
b1.setBounds(45,410,50,20);
add(b1);
b2=new Button("Cancel");
b2.setBounds(120,410,50,20);
add(b2);
b1.setBackground(cl);
b2.setBackground(cl);
l5.setVisible(false);
t1.setVisible(false);
b1.setVisible(false);
b2.setVisible(false);
jb.addActionListener(this);
jb1.addActionListener(this);
b1.addActionListener(this);
b2.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==jb)
{
home ob=new home(str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Home");
dispose();
}
if(ae.getSource()==jb1)
{
l5.setVisible(true);
t1.setVisible(true);
Page 72
t1.requestFocus();
b1.setVisible(true);
b2.setVisible(true);
}
if(ae.getSource()==b1)
{
if(t1.getText().equals("admin_786"))
{
admin ob=new admin();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Admin");
dispose();
}
else
{
JOptionPane.showMessageDialog((null),"Invalid code,Plz Try
again","Login Error",JOptionPane.WARNING_MESSAGE);
t1.requestFocus();
t1.setText("");
}
}
if(ae.getSource()==b2)
{
l5.setVisible(false);
t1.setVisible(false);
b1.setVisible(false);
b2.setVisible(false);
t1.setText("");
t1.requestFocus();
}
}
}
Page 73
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
class home extends Frame implements Runnable,ActionListener
{
Image ic,ic1,ic2,ic3;
Thread th;
int i,cnt=0,j=0,k=0;
Connection cn=null;
Statement st=null;
ResultSet rs=null,rs1=null;
String im1,im2;
MenuBar mb;
Menu m1,m2,m3,m4,m5,m6;
MenuItem g1,g2,g3,g4,g5,d1,d2,d3,d4,d5,s1,s2,s3,s4,s5,mt1,mt2,mt3,mt4,mt5,mt6 ,p1,p2,p3,p4;
Color cl;
String str;
home(String name)
{
try
{
str=name;
cl=new Color(0,0,0);
setBackground(cl);
setLayout(null);
mb=new MenuBar();
m1=new Menu("Gold");
m2=new Menu("Diamond");
m4=new Menu("Pearl");
m3=new Menu("Silver");
m5=new Menu("Modify Orders");
m6=new Menu("Others");
g1=new MenuItem("Earring");
g2=new MenuItem("Necklace");
g3=new MenuItem("Bangles");
g4=new MenuItem("Rings");
g5=new MenuItem("MangalSutar");
d1=new MenuItem("Earring");
d2=new MenuItem("Necklace");
d3=new MenuItem("Bangles");
d4=new MenuItem("Rings");
d5=new MenuItem("MangalSutar");
s1=new MenuItem("Necklace");
Page 74
s2=new MenuItem("Bangles");
s3=new MenuItem("Anklets");
s4=new MenuItem("Earring");
s5=new MenuItem("Rings");
mt1=new MenuItem("Installment Pay");
mt2=new MenuItem("Order Cancel");
mt3=new MenuItem("Back");
mt4=new MenuItem("Logout");
mt5=new MenuItem("Exit");
mt6=new MenuItem("About us");
p1=new MenuItem("Necklace");
p2=new MenuItem("Bangles");
p3=new MenuItem("Earring");
p4=new MenuItem("Rings");
m1.add(g1);m1.add(g2);m1.add(g3);
m1.add(g4);m1.add(g5);
m2.add(d1);m2.add(d2);m2.add(d3);
m2.add(d4);m2.add(d5);
m3.add(s1);m3.add(s2);m3.add(s3);
m3.add(s4);m3.add(s5);
m4.add(p1);m4.add(p2);
m4.add(p3);m4.add(p4);
m5.add(mt1);m5.add(mt2);
m6.add(mt5);
if(str.equalsIgnoreCase("admin"))
{m6.add(mt3);}
m6.add(mt4);m6.add(mt6);
mb.add(m1);mb.add(m2);mb.add(m3);
mb.add(m4);mb.add(m5);mb.add(m6);
setMenuBar(mb);
ic=Toolkit.getDefaultToolkit().getImage("t4445.jpg");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:Driver= {Microsoft Access Driver
(*.mdb)};DBQ=e:/wel/tanishq.mdb");
st=cn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
rs=st.executeQuery("select * from home");
while(rs.next())
{cnt++;}
rs.close();
th=new Thread(this);
th.start();
}
catch(Exception ex)
{System.out.println(ex);}
g1.addActionListener(this);
g2.addActionListener(this);
g3.addActionListener(this);
g4.addActionListener(this);
g5.addActionListener(this);
Page 75
d1.addActionListener(this);
d2.addActionListener(this);
d3.addActionListener(this);
d4.addActionListener(this);
d5.addActionListener(this);
s1.addActionListener(this);
s2.addActionListener(this);
s3.addActionListener(this);
s4.addActionListener(this);
s5.addActionListener(this);
mt1.addActionListener(this);
mt2.addActionListener(this);
mt3.addActionListener(this);
mt4.addActionListener(this);
mt5.addActionListener(this);
mt6.addActionListener(this);
p1.addActionListener(this);
p2.addActionListener(this);
p3.addActionListener(this);
p4.addActionListener(this);
}
public void run()
{
try
{
rs=st.executeQuery("select * from home");
for(int i=1;i<=cnt;i++)
{
rs.absolute(i+j);
im1=rs.getString("img");
ic1=Toolkit.getDefaultToolkit().getImage(im1);
j++;
k++;
rs.absolute(i+k);
im2=rs.getString("img");
ic2=Toolkit.getDefaultToolkit().getImage(im2);
Thread.sleep(5000);
repaint();
if((i+k)>=cnt)
{
j=0;k=0;i=0;
rs.close();
rs=st.executeQuery("select * from home");
}
}}
catch(Exception ex)
{ System.out.println(ex);}
}
public void actionPerformed(ActionEvent ae)
Page 76
{
String st;
if(ae.getSource()==g1)
{
st="GoldEarring";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==g2)
{
st="GoldNecklace";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==g3)
{
st="GoldBangles";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==g4)
{
st="GoldRings";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==g5)
{
st="GoldMangalSutar";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==d1)
{
st="DiamondEarring";
Page 77
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==d2)
{
st="DiamondNecklace";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==d3)
{
st="DiamondBangles";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==d4)
{
st="DiamondRings";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==d5)
{
st="DiamondMangalSutar";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==s1)
{
st="SilverNecklace";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
Page 78
}
if(ae.getSource()==s2)
{
st="SilverBangles";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==s3)
{
st="SilverAnklets";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==s4)
{
st="SilverEarring";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==s5)
{
st="SilverRings";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==p1)
{
st="PearlNecklace";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==p2)
{
st="PearlBangles";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
Page 79
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==p3)
{
st="PearlEarring";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==p4)
{
st="PearlRings";
design ob=new design(st,str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Designs");
dispose();
}
if(ae.getSource()==mt3)
{
intro ob=new intro(str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);ob.setTitle("welcome");
dispose();
}
if(ae.getSource()==mt5)
{
int ans=JOptionPane.showConfirmDialog((null),"Are You Really want to exit","Exit
confirmation", JOptionPane.YES_NO_OPTION);
if(ans==JOptionPane.YES_OPTION)
{System.exit(0);}
}
if(ae.getSource()==mt1)
{
order1 ob=new order1(str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Final Payment");
dispose();
}
if(ae.getSource()==mt2)
{
order2 ob=new order2(str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Order Cancel");
Page 80
dispose();
}
if(ae.getSource()==mt4)
{
w1 ob=new w1();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Jewellery shop");
dispose();
}
if(ae.getSource()==mt6)
{
aboutus ob=new aboutus("home",str);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("About us...");
dispose();
}
g.drawImage(ic,5,50,this);
g.drawImage(ic,660,50,this);
g.drawImage(ic1,150,140,this);
g.drawImage(ic2,150,310,this);
Page 81
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
class design extends Frame implements ActionListener,ItemListener
{
Connection cn=null;
Statement st=null;
ResultSet rs=null;
Label lb,lb1,lb2,lb3,lb4,lb5;
JLabel jl,jl1,jl2,jl3;
Choice ch;
ImageIcon ic=null;
Color cl=null;
int cnt=0,i=0;
String str,str1;
Font f;
Button b1,b2;;
JButton jb,jb1;
String name;
design(String k,String nm)
{
str1=nm;
name=k;
setLayout(null);
setForeground(Color.white);
cl=new Color(0,0,0);
setBackground(cl);
ic=new ImageIcon("t4445.jpg");
jl=new JLabel(ic);
jl.setBounds(15,20,100,100);
add(jl);
jl1=new JLabel(ic);
jl1.setBounds(650,20,100,100);
add(jl1);
f=new Font("Edwardian Script ITC",Font.BOLD,40);
jl3=new JLabel(name);
jl3.setBounds(270,40,350,80);
add(jl3);
jl3.setFont(f);
cl=new Color(220,200,130);
jl3.setForeground(cl);
Page 82
jl2=new JLabel("");
jl2.setBounds(270,220,200,150);
add(jl2);
f=new Font("Arial",Font.BOLD|Font.ITALIC,18);
lb=new Label("Total Design :"+cnt);
lb.setBounds(15,150,250,30);
add(lb);
lb.setFont(f);
lb4=new Label("This is Design :"+i);
lb4.setBounds(285,150,250,30);
add(lb4);
lb4.setFont(f);
lb1=new Label("Design No : ");
lb1.setBounds(70,260,150,30);
add(lb1);
lb2=new Label("Design Price : ");
lb2.setBounds(70,320,150,30);
add(lb2);
b1=new Button("Next");
b1.setBounds(425,390,50,28);add(b1);
b2=new Button("Prev");
b2.setBounds(480,390,50,28);add(b2);
b1.setBackground(cl);
b2.setBackground(cl);
b1.setForeground(Color.black);
b2 .setForeground(Color.black);
ic=new ImageIcon("back1.gif");
jb=new JButton(ic);
jb.setBounds(70,430,80,30);
add(jb);
jb.setBackground(Color.black);
ic=new ImageIcon("ord.gif");
jb1=new JButton(ic);
jb1.setBounds(500,270,95,30);
add(jb1);
jb1.setBackground(Color.black);
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver
(*.mdb)};DBQ=e:/wel/tanishq.mdb");
st=cn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATAB
LE);
rs=st.executeQuery("select * from Design where Dname='"+name+"'");
while(rs.next())
{cnt++;}
if(cnt==0)
{
JOptionPane.showMessageDialog((null),"Sorry No Record Available at this
category","Searching Error", JOptionPane.WARNING_MESSAGE);
b1.setEnabled(false);b2.setEnabled(false);jb1.setEnabled(false);
}
Page 83
else
{
rs.absolute(1);
i++;
jl3.setText(rs.getString("Dname"));
ic=new ImageIcon(rs.getString("Dpic"));
jl2.setIcon(ic);
lb.setText("Total Design :"+cnt);
lb4.setText("This is Design :"+i);
lb1.setText("Design No : "+rs.getString("Dno"));
str=rs.getString("Dno");
lb2.setText("Design Price : "+rs.getString("Dprice")+" Rs");
}
}
catch(Exception ex)
{System.out.println(ex);}
if(i==cnt)
{b1.setEnabled(false);}
b2.setEnabled(false);
}
public void actionPerformed(ActionEvent ae)
{
try
Page 84
{
if(ae.getSource()==b1)
{
i++;
if(i<=cnt)
{
rs.absolute(i);
lb1.setText("Design No : "+rs.getString("Dno"));
str=rs.getString("Dno");
lb2.setText("Design Price : "+rs.getString("Dprice")+" Rs");
ic=new ImageIcon(rs.getString("Dpic"));
jl2.setIcon(ic);
b2.setEnabled(true);
lb4.setText("This is Design :"+i);
if(i==cnt)
{b1.setEnabled(false);b2.setEnabled(true);}
}
}
if(ae.getSource()==b2)
{
i--;
if(i>0)
{
rs.absolute(i);
lb1.setText("Design No : "+rs.getString("Dno"));
str=rs.getString("Dno");
lb2.setText("Design Price : "+rs.getString("Dprice")+" Rs");
ic=new ImageIcon(rs.getString("Dpic"));
jl2.setIcon(ic);
b1.setEnabled(true);
lb4.setText("This is Design :"+i);
if(i==1)
{b1.setEnabled(true);b2.setEnabled(false);}
}
}
if(ae.getSource()==jb)
{
home ob=new home(str1);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Home");
dispose();
}
if(ae.getSource()==jb1)
{
order ob=new order(str,str1);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
Page 85
ob.setTitle("New Order");
dispose();
}
}
catch(Exception ex)
{System.out.println(ex);}
}
while(rs.next())
{cnt++;}
if(cnt==0)
{
JOptionPane.showMessageDialog((null),"Sorry No Record Available at this category","Searching
Error", JOptionPane.WARNING_MESSAGE);
}
else
{
rs.absolute(1);
i++;
lb.setText("Total Design :"+cnt);
lb4.setText("This is Design :"+i);
lb1.setText("Design No : "+rs.getString("Dno"));
str=rs.getString("Dno");
lb2.setText("Design Price : "+rs.getString("Dprice")+" Rs");
ic=new ImageIcon(rs.getString("Dpic"));
jl2.setIcon(ic);
b2.setEnabled(false);
b1.setEnabled(true);
if(cnt==1)
{
b2.setEnabled(false);
b1.setEnabled(false);
}
}
}
if(ch.getSelectedItem().equals("30000 to 50000"))
{
rs=st.executeQuery("select * from Design where Dname='"+name+"' and Dprice between
"+30000+" and "+50000+"");
while(rs.next())
{cnt++;}
Page 86
if(cnt==0)
{
JOptionPane.showMessageDialog((null),"Sorry No Record Available at this category","Searching
Error",JOptionPane.WARNING_MESSAGE);
}
else
{
rs.absolute(1);
i++;
lb.setText("Total Design :"+cnt);
lb4.setText("This is Design :"+i);
lb1.setText("Design No : "+rs.getString("Dno"));
str=rs.getString("Dno");
lb2.setText("Design Price : "+rs.getString("Dprice")+" Rs");
ic=new ImageIcon(rs.getString("Dpic"));
jl2.setIcon(ic);
b2.setEnabled(false);
b1.setEnabled(true);
if(cnt==1)
{
b2.setEnabled(false);
b1.setEnabled(false);
}
}
}
if(ch.getSelectedItem().equals("above 50000"))
{
rs=st.executeQuery("select * from Design where Dname='"+name+"' and Dprice
>"+50000+"");
while(rs.next())
{cnt++;}
if(cnt==0)
{
JOptionPane.showMessageDialog((null),"Sorry No Record Available at this category","Searching
Error",JOptionPane.WARNING_MESSAGE);
}
else
{
rs.absolute(1);
i++;
lb.setText("Total Design :"+cnt);
lb4.setText("This is Design :"+i);
lb1.setText("Design No : "+rs.getString("Dno"));
str=rs.getString("Dno");
lb2.setText("Design Price : "+rs.getString("Dprice")+" Rs");
ic=new ImageIcon(rs.getString("Dpic"));
jl2.setIcon(ic);
b2.setEnabled(false);
b1.setEnabled(true);
if(cnt==1)
{
Page 87
b2.setEnabled(false);
b1.setEnabled(false);
}
}
}
if(ch.getSelectedItem().equals("All"))
{
rs=st.executeQuery("select * from Design where Dname='"+name+"'");
while(rs.next())
{cnt++;}
if(cnt==0)
{
JOptionPane.showMessageDialog((null),"Sorry No Record Available at this category","Searching
Error",JOptionPane.WARNING_MESSAGE);
}
else
{
rs.absolute(1);
i++;
lb.setText("Total Design :"+cnt);
lb4.setText("This is Design :"+i);
lb1.setText("Design No : "+rs.getString("Dno"));
str=rs.getString("Dno");
lb2.setText("Design Price : "+rs.getString("Dprice")+" Rs");
ic=new ImageIcon(rs.getString("Dpic"));
jl2.setIcon(ic);
b2.setEnabled(false);
b1.setEnabled(true);
if(cnt==1)
{
b2.setEnabled(false);
b1.setEnabled(false);
}
}
}
if(ch.getSelectedItem().equals("upto 5000"))
{
rs=st.executeQuery("select * from Design where Dname='"+name+"' and Dprice<"+5000+"");
while(rs.next())
{cnt++;}
if(cnt==0)
{
JOptionPane.showMessageDialog((null),"Sorry No Record Available at this category","Searching
Error",JOptionPane.WARNING_MESSAGE);
}
else
{
rs.absolute(1);
i++;
lb.setText("Total Design :"+cnt);
lb4.setText("This is Design :"+i);
Page 88
lb1.setText("Design No : "+rs.getString("Dno"));
str=rs.getString("Dno");
lb2.setText("Design Price : "+rs.getString("Dprice")+" Rs");
ic=new ImageIcon(rs.getString("Dpic"));
jl2.setIcon(ic);
b2.setEnabled(false);
b1.setEnabled(true);
if(cnt==1)
{
b2.setEnabled(false);
b1.setEnabled(false);
}
}
}
if(ch.getSelectedItem().equals("5000 to 10000"))
{
if(ch.getSelectedItem().equals("above 10000"))
{
rs=st.executeQuery("select * from Design where Dname='"+name+"' and Dprice >"+10000+"");
while(rs.next())
{cnt++;}
Page 89
if(cnt==0)
{
JOptionPane.showMessageDialog((null),"Sorry No Record Available at this category","Searching
Error",JOptionPane.WARNING_MESSAGE);
}
else
{
rs.absolute(1);
i++;
lb.setText("Total Design :"+cnt);
lb4.setText("This is Design :"+i);
lb1.setText("Design No : "+rs.getString("Dno"));
str=rs.getString("Dno");
lb2.setText("Design Price : "+rs.getString("Dprice")+" Rs");
ic=new ImageIcon(rs.getString("Dpic"));
jl2.setIcon(ic);
b2.setEnabled(false);
b1.setEnabled(true);
if(cnt==1)
{
b2.setEnabled(false);
b1.setEnabled(false);
}
}
}
}
catch(Exception ex)
{System.out.println(ex);}
}
}
Page 90
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
class order extends Frame implements ActionListener,ItemListener
{
Label lb,lb1,lb2,lb3,lb4,lb5,lb6,lc,lc1,lc2,lc3,lc4,lc5;
TextField t1,t2,t3,t4;
Checkbox c1,c2;
CheckboxGroup cbg;
Connection cn;
Statement st;
ResultSet rs,rs1;
Image img,img1,img3;
Font f;
Button b1,b2;
String Dno,Dname,Dimg,status,radio="Full",pay;
int Dprice;
int paid,bal,ret,cnt;
Color cl;
String s;
order(String k,String nm)
{
try
{ s=nm;
setLayout(null);
cl=new Color(0,0,0);
setBackground(cl);
setForeground(Color.white);
img=Toolkit.getDefaultToolkit().getImage("t4445.jpg");
img1=Toolkit.getDefaultToolkit().getImage("jew3.gif");
lb=new Label("NEW ORDER");
lb.setBounds(300,50,200,40);
add(lb);
f=new Font("Edwardian Script ITC",Font.BOLD,30);
lb.setFont(f);
lb.setForeground(Color.cyan);
f=new Font("Edwardian Script ITC",Font.BOLD,20);
lb1=new Label("Design Info:");
lb1.setBounds(50,150,120,30);
add(lb1);
lb1.setFont(f);
lb2=new Label("Customer Info:");
lb2.setBounds(440,150,150,30);
add(lb2);
lb2.setFont(f);
Page 91
f=new Font("Edwardian Script ITC",Font.BOLD,12);
setFont(f);
lb3=new Label("Design No: ");
lb3.setBounds(40,180,230,25);
add(lb3);
lb4=new Label("Design Name: ");
lb4.setBounds(40,205,230,25);
add(lb4);
lb5=new Label("Design Price: ");
lb5.setBounds(40,235,230,25);
add(lb5);
lb6=new Label("Design Image : ");
lb6.setBounds(40,265,100,25);
add(lb6);
lc=new Label("Customer ID :");
lc.setBounds(430,185,130,25);
add(lc);
t1=new TextField();
t1.setBounds(570,185,130,20);
add(t1);
t1.setForeground(Color.black);
lc1=new Label("Customer Name :");
lc1.setBounds(430,230,130,25);
add(lc1);
t2=new TextField();
t2.setBounds(570,235,130,20);
add(t2);
t2.setForeground(Color.black);
lc2=new Label("Contact No :");
lc2.setBounds(430,270,130,25);
add(lc2);
t3=new TextField();
t3.setBounds(570,280,130,20);
add(t3);
t3.setForeground(Color.black);
lc3=new Label("Payment Mode :");
lc3.setBounds(430,310,130,25);
add(lc3);
cbg=new CheckboxGroup();
c1=new Checkbox("Full",true,cbg);
c1.setBounds(570,310,50,25);
add(c1);
c2=new Checkbox("Installment",false,cbg);
c2.setBounds(625,310,80,25);
add(c2);
lc4=new Label("Payment (Rs.) :");
lc4.setBounds(430,350,130,25);
add(lc4);
t4=new TextField();
t4.setBounds(570,355,130,20);
add(t4);
t4.setForeground(Color.black);
Page 92
lc5=new Label("");
lc5.setBounds(430,380,250,25);
add(lc5);
f=new Font("Edwardian Script ITC",Font.BOLD,20);
b1=new Button("Deal");
b1.setBounds(320,250,70,30);
add(b1);
b1.setBackground(Color.orange);
b2=new Button("Cancel");
b2.setBounds(320,320,70,30);
add(b2);
b2.setBackground(Color.orange);
b1.setFont(f);
b2.setFont(f);
b1.setForeground(Color.black);
b2.setForeground(Color.black);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver
(*.mdb)};DBQ=e:/wel/tanishq.mdb");
st=cn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
rs=st.executeQuery("select * from Design where Dno='"+k+"'");
while(rs.next())
{
Dno=rs.getString("Dno");
Dname=rs.getString("Dname");
Dprice=rs.getInt("Dprice");
Dimg=rs.getString("Dpic");
lb3.setText("Design No : "+Dno);
lb4.setText("Design Name : "+Dname);
lb5.setText("Design Price : "+Dprice+" Rs.");
img3=Toolkit.getDefaultToolkit().getImage(Dimg);
}
}
catch(Exception ex)
{System.out.println(ex);}
b1.addActionListener(this);
b2.addActionListener(this);
c1.addItemListener(this);
c2.addItemListener(this);
}
public void actionPerformed(ActionEvent ae)
{
try
{
if(ae.getSource()==b1)
{
cnt=0;
rs1=st.executeQuery("Select * from Customer");
while(rs1.next())
Page 93
{
String str=t1.getText();
if(rs1.getString("Cid").equals(str))
{cnt++;}
}
if(t4.getText().equals(""))
{pay="0";}
else
{pay=t4.getText();}
paid=Integer.parseInt(pay);
if((paid>=Dprice)&&((radio.equals("Full")||(radio.equals
("Installment")))))
{bal=0;ret=paid-Dprice;status="Sold";}
else if(radio.equals("Installment")&&(paid<Dprice))
{ret=0;bal=Dprice-paid;status="On Order";}
if(cnt==1)
{
JOptionPane.showMessageDialog((null),"This Customer Id is already exist","Duplicate Id
Error",JOptionPane.INFORMATION_MESSAGE);
t1.requestFocus();
}
else if(t1.getText().equals("")|| t2.getText().equals("")||
t3.getText().equals("")|| t4.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"All fields are Compulsory to fill","Incorrect Entry
Error", JOptionPane.INFORMATION_MESSAGE);
}
else if(radio.equals("Full")&& (paid<Dprice))
{ JOptionPane.showMessageDialog((null),"As Full
Payment mode,u cann't pay less than Design's cost","Invalid payment
Entry",JOptionPane.INFORMATION_MESSAGE);
t4.requestFocus();
}
else if(radio.equals("Installment")&&
(paid<((Dprice*50)/100)))
{
JOptionPane.showMessageDialog((null)," As Installment Payment mode,u have to pay
atleast 50% of design's cost","Invalid payment
Entry",JOptionPane.INFORMATION_MESSAGE);
t4.requestFocus();
}
else
{
if(radio.equals("Installment")&&(paid>=Dprice))
{
JOptionPane.showMessageDialog((null),"As Installment mode,u paid total cost of design,so
we consider it as Full payment","Information
window",JOptionPane.INFORMATION_MESSAGE);
radio="Full";bal=0;ret=paid-Dprice;
}
st.executeUpdate("insert into customer
values('"+t1.getText()+"','"+t2.getText()+"','"+t3.getText()
Page 94
+"','"+radio+"','"+Dno+"','"+Dname+"','"+Dimg+"',"+Dprice+","+paid+","+bal+","+ret+",'"
+status+"',0,0,"+bal+")");
rs1=st.executeQuery("select * from Customer");
receipt ob=new receipt(t1.getText(),"New Order",s);
ob.setSize(400,550);
ob.setVisible(true);
ob.setTitle("Receipt");
ob.setLocationRelativeTo(null);
ob.setResizable(false);
dispose();
}
} }
catch(NumberFormatException ne)
{
JOptionPane.showMessageDialog((null),"Invalid amount,Plz Enter Payment in
Numbers","Adding Error",JOptionPane.WARNING_MESSAGE);
t4.setText("");t4.requestFocus();}
catch(Exception ex)
{System.out.println(ex);}
if(ae.getSource()==b2)
{
home ob=new home(s);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Home");
dispose();
}
}
public void itemStateChanged(ItemEvent ae)
{
radio=cbg.getSelectedCheckbox().getLabel();
if(radio.equals("Installment"))
{
lc4.setText("1st Installment :");
lc5.setText("( plz pay atleast 50% of total cost of item )");
}
if(radio.equals("Full"))
{
lc5.setText("");
lc4.setText("Payment (Rs.) :");
}
}
public void paint(Graphics g)
{
g.drawImage(img,5,30,this);
g.drawImage(img,660,30,this);
g.drawImage(img1,200,50,this);
g.drawImage(img1,540,50,this);
g.drawImage(img3,100,300,this);
g.setColor(Color.gray);
g.drawLine(20,165,50,165);
Page 95
g.drawLine(100,165,300,165);
g.drawLine(20,165,20,480);
g.drawLine(300,165,300,480);
g.drawLine(20,480,300,480);
g.drawLine(410,165,440,165);
g.drawLine(550,165,720,165);
g.drawLine(410,165,410,480);
g.drawLine(720,165,720,480);
g.drawLine(410,480,720,480);
Page 96
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
class order1 extends Frame implements ActionListener,ItemListener
{
Label lb,lb1,lb2,lb3,lb4,lb5,lb6,lb7,lb8,lb9,lb10,lb11,lb12,lb13,lb14,lb15;
Choice ch;
TextField t1,t2,t3,t4;
Connection cn;
Statement st;
ResultSet rs,rs1;
Image img,img1,img3,img4;
Font f;
Button b1,b2,b3;
Color cl;
String str,pay,str1="On Order",cno,s;
int bal=0,ret=0,cnt=0,cur=0,paid=0;
order1(String nm)
{
try
{
s=nm;
setLayout(null);
cl=new Color(0,0,0);
setBackground(cl);
setForeground(Color.white);
img=Toolkit.getDefaultToolkit().getImage("t4445.jpg");
img1=Toolkit.getDefaultToolkit().getImage("jew3.gif");
lb=new Label("Final Payment");
lb.setBounds(280,50,250,40);
add(lb);
f=new Font("Edwardian Script ITC",Font.BOLD,30);
lb.setFont(f);
lb.setForeground(Color.cyan);
f=new Font("Edwardian Script ITC",Font.BOLD,20);
lb1=new Label("Order Info:-");
lb1.setBounds(50,220,150,30);
add(lb1);
lb1.setFont(f);
lb2=new Label("Payment Info:-");
lb2.setBounds(420,220,150,30);
add(lb2);
lb2.setFont(f);
lb3=new Label("Search Box");
Page 97
lb3.setBounds(180,110,85,18);
add(lb3);
img3=Toolkit.getDefaultToolkit().getImage("search.jpg");
lb4=new Label("Select from List:");
lb4.setBounds(150,160,100,20);
add(lb4);
f=new Font("Edwardian Script ITC",Font.BOLD,12);
lb4.setFont(f);
lb5=new Label("Or Enter Id Here:");
lb5.setBounds(370,160,110,20);
add(lb5);
lb5.setFont(f);
ch=new Choice();
ch.setBounds(250,160,100,20);
add(ch);
ch.addItem("select");
ch.setFont(f);
t1=new TextField();
t1.setBounds(485,160,120,20);
add(t1);
t1.setFont(f);
f=new Font("Edwardian Script ITC",Font.BOLD,15);
setFont(f);
lb6=new Label("Customer ID : ");
lb6.setBounds(50,265,230,25);
add(lb6);
b2=new Button("Payment");
b2.setBounds(460,440,70,30);
add(b2);
b2.setBackground(Color.orange);
b2.setForeground(Color.black);
b3=new Button("Cancel");
b3.setBounds(560,440,70,30);
add(b3);
b3.setBackground(Color.orange);
b3.setForeground(Color.black);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver
(*.mdb)};DBQ=e:/wel/tanishq.mdb");
st=cn.createStatement();
rs=st.executeQuery("select cid from Customer where status='"+str1+"'");
while(rs.next())
{
ch.addItem(rs.getString("cid"));}
ch.setForeground(Color.black);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
ch.addItemListener(this);
}
catch(Exception ex)
{System.out.println(ex);}
}
public void actionPerformed(ActionEvent ae)
{
try
{ if(ae.getSource()==b1)
{ if(t1.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"Plz Enter Customer Id","Invalid
Action",JOptionPane.INFORMATION_MESSAGE);
t1.requestFocus();
}
Page 99
else
{
rs=st.executeQuery("select * from customer where Status='"+str1+"'");
while(rs.next())
{str=t1.getText();
if(rs.getString("cid").equals(str))
{ cnt++;}
}
if(cnt==1)
{
ch.select(t1.getText());
rs.close();
rs=st.executeQuery("select * from customer where cid='"+t1.getText()+"'");
while(rs.next())
{
cno=rs.getString("cid");
lb6.setText("Customer ID : "+""+cno);
lb7.setText("Customer Name : "+""+rs.getString("cname"));
lb8.setText("Design No : "+""+rs.getString("Dno"));
lb9.setText("Design Name : "+""+rs.getString("Dname"));
lb11.setText("Design Price : "+""+rs.getString("Dprice"));
lb12.setText("1st paid Installment : "+""+ rs.getString ("receivedAmount"));
bal=rs.getInt("Balance");
lb13.setText("Due Balance : "+bal);
img4=Toolkit.getDefaultToolkit().getImage(rs.getString("Dimg"));
repaint();cnt=0;t2.requestFocus();
}}
else
{
JOptionPane.showMessageDialog((null),"This customer id does not exist in \"on orders\"
Category","Invalid Id", JOptionPane.INFORMATION_MESSAGE);
t1.setText("");ch.select(0);
lb6.setText("Customer ID : ");
lb7.setText("Customer Name : ");
lb8.setText("Design No : ");
lb9.setText("Design Name : ");
lb11.setText("Design Price : ");
lb12.setText("1st paid Installment : ");
lb13.setText("Due Balance : ");
t2.setText("");t1.requestFocus();
img4=Toolkit.getDefaultToolkit().getImage("");repaint();
}}}
if(ae.getSource()==b2)
{
if(t2.getText().equals(""))
{pay="0";}
else
{pay=t2.getText();}
paid=Integer.parseInt(pay);
if(ch.getSelectedItem().equals("select")&&t1.getText().equals(""))
Page 100
{ JOptionPane.showMessageDialog((null),"Plz select id
from the List or Submit it","Invalid Action", JOptionPane.INFORMATION_MESSAGE);
t2.setText("");
}
else if(pay.equals("0"))
{
JOptionPane.showMessageDialog((null),"Plz Enter Payment","Invalid
Action",JOptionPane.INFORMATION_MESSAGE);
t2.requestFocus();
}
else if(paid<bal)
{
JOptionPane.showMessageDialog((null),"2nd Installment must be Full & final
payment","Invalid Payment Error",
JOptionPane.INFORMATION_MESSAGE);t2.requestFocus();
}
else
{
ret=paid-bal;
st.executeUpdate("update customer set 2ndInstallment="+ paid+",
CurrBal=0,Status='Sold',Return="+ret+"where cid='"+ch.getSelectedItem()+"'");
rs=st.executeQuery("select * from customer");
receipt ob=new receipt(cno,"Final Installment",s);
ob.setSize(400,550);
ob.setVisible(true);
ob.setTitle("Receipt");
ob.setLocationRelativeTo(null);
ob.setResizable(false);
dispose();
}}
if(ae.getSource()==b3)
{
home ob=new home(s);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Home");
dispose();
}
}
catch(NumberFormatException ne)
{JOptionPane.showMessageDialog((null),"Invalid amount,Plz Enter
Payment in Numbers","Adding Error",JOptionPane.WARNING_MESSAGE);
t2.setText("");t2.requestFocus();}
catch(Exception ex)
{System.out.println(ex);}
}
public void itemStateChanged(ItemEvent ie)
{
try
{
t1.setText("");
rs.close();
Page 101
rs=st.executeQuery("select * from customer where
cid='"+ch.getSelectedItem()+"'");
while(rs.next())
{ cno=rs.getString("cid");
lb6.setText("Customer ID : "+""+cno);
lb7.setText("Customer Name : "+""+rs.getString("cname"));
lb8.setText("Design No : "+""+rs.getString("Dno"));
lb9.setText("Design Name : "+""+rs.getString("Dname"));
img4=Toolkit.getDefaultToolkit().getImage(rs.getString("Dimg"));
lb11.setText("Design Price : "+""+rs.getString("Dprice"));
lb12.setText("1st paid Installment : "+""+
rs.getString("receivedAmount"));
bal=rs.getInt("Balance");
lb13.setText("Due Balance : "+bal);repaint();
t2.requestFocus();
}}
catch(Exception ex)
{System.out.println(ex);}
if(ch.getSelectedItem().equals("select"))
{
t1.setText("");
lb6.setText("Customer ID : ");
lb7.setText("Customer Name : ");
lb8.setText("Design No : ");
lb9.setText("Design Name : ");
lb11.setText("Design Price : ");
lb12.setText("1st paid Installment : ");
lb13.setText("Due Balance : ");
t2.setText("");
img4=Toolkit.getDefaultToolkit().getImage("");repaint();
}}
public void paint(Graphics g)
{ g.drawImage(img,5,30,this);
g.drawImage(img,660,30,this);
g.drawImage(img1,200,50,this);
g.drawImage(img1,540,50,this);
g.drawImage(img3,150,125,this);
g.drawImage(img4,180,385,this);
g.setColor(Color.gray);
g.drawLine(260,120,680,120);
g.drawLine(140,120,180,120);
g.drawLine(140,120,140,190);
g.drawLine(140,190,680,190);
g.drawLine(680,120,680,190);
}}
Page 102
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
class order2 extends Frame implements ActionListener,ItemListener
{
Label lb,lb1,lb2,lb3,lb4,lb5,lb6,lb7,lb8,lb9,lb10,lb11,lb12,lb13,lb14,lb15;
Choice ch;
TextField t1;
Connection cn;
Statement st;
ResultSet rs,rs1;
Image img,img1,img3,img4;
Font f;
Button b1,b2,b3;
Color cl;
String str,pay,str1="On Order",cno;
int bal=0,ret=0,cnt=0,cur=0,paid=0,penalty=0,dprice=0,ans;
String s;
order2(String nm )
{
JOptionPane.showMessageDialog((null),"By Cancel Order,30% of Total design Cost will deduct
from ur paid Installment", "Information",JOptionPane.INFORMATION_MESSAGE);
try
{ s=nm;
setLayout(null);
cl=new Color(0,0,0);
setBackground(cl);
setForeground(Color.white);
img=Toolkit.getDefaultToolkit().getImage("t4445.jpg");
img1=Toolkit.getDefaultToolkit().getImage("jew3.gif");
lb=new Label("Order Cancel");
lb.setBounds(280,50,250,40);
add(lb);
f=new Font("Edwardian Script ITC",Font.BOLD,30);
lb.setFont(f);
lb.setForeground(Color.cyan);
f=new Font("Edwardian Script ITC",Font.BOLD,20);
lb1=new Label("Order Info:-");
lb1.setBounds(50,220,150,30);
add(lb1);
lb1.setFont(f);
lb2=new Label("Payment Info:-");
lb2.setBounds(420,220,150,30);
add(lb2);
lb2.setFont(f);
Page 103
lb3=new Label("Search Box");
lb3.setBounds(180,110,85,18);
add(lb3);
img3=Toolkit.getDefaultToolkit().getImage("search.jpg");
lb4=new Label("Select from List:");
lb4.setBounds(150,160,100,20);
add(lb4);
f=new Font("Edwardian Script ITC",Font.BOLD,12);
lb4.setFont(f);
lb5=new Label("Or Enter Id Here:");
lb5.setBounds(370,160,110,20);
add(lb5);
lb5.setFont(f);
ch=new Choice();
ch.setBounds(250,160,100,20);
add(ch);
ch.addItem("select");
ch.setFont(f);
t1=new TextField();
t1.setBounds(485,160,120,20);
add(t1);
t1.setFont(f);
t1.setForeground(Color.black);
f=new Font("Edwardian Script ITC",Font.BOLD,15);
setFont(f);
lb6=new Label("Customer ID : ");
lb6.setBounds(50,265,230,25);
add(lb6);
lb7=new Label("Customer Name : ");
lb7.setBounds(50,295,270,25);
add(lb7);
lb8=new Label("Design No : ");
lb8.setBounds(50,325,230,25);
add(lb8);
lb9=new Label("Design Name : ");
lb9.setBounds(50,355,320,25);
add(lb9);
lb10=new Label("Design image :");
lb10.setBounds(50,385,120,25);
add(lb10);
b1=new Button("Submit");
b1.setBounds(615,160,60,20);
add(b1);
b1.setBackground(Color.black);
lb11=new Label("Payment Mode : ");
lb11.setBounds(420,265,230,25);
add(lb11);
lb12=new Label("Design Price : ");
lb12.setBounds(420,295,230,25);
add(lb12);
lb13=new Label("1st paid Installment : ");
lb13.setBounds(420,325,230,25);
Page 104
add(lb13);
lb14=new Label("Due Balance : ");
lb14.setBounds(420,355,230,25);
add(lb14);
f=new Font("Edwardian Script ITC",Font.BOLD,12);
b2=new Button("Order Cancel");
b2.setBounds(420,440,140,30);
add(b2);
b2.setBackground(Color.orange);
b2.setForeground(Color.black);
b3=new Button("Back to Homepage");
b3.setBounds(590,440,140,30);
add(b3);
b3.setBackground(Color.orange);
b3.setForeground(Color.black);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver
(*.mdb)};DBQ=e:/wel/tanishq.mdb");
st=cn.createStatement();
rs=st.executeQuery("select cid from Customer where status='"+ str1+ "'" );
while(rs.next())
{
ch.addItem(rs.getString("cid"));}
ch.setForeground(Color.black);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
ch.addItemListener(this);
}
catch(Exception ex)
{System.out.println(ex);}
}
public void actionPerformed(ActionEvent ae)
{
try
{
if(ae.getSource()==b1)
{if(t1.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"Plz Enter Customer Id","Invalid
Action",JOptionPane.INFORMATION_MESSAGE); t1.requestFocus();
}
else
{
rs=st.executeQuery("select * from customer where Status='"+str1+"'");
while(rs.next())
{
str=t1.getText();
if(rs.getString("cid").equals(str))
{ cnt++;}
}
if(cnt==1)
Page 105
{
ch.select(t1.getText());
rs.close();
rs=st.executeQuery("select * from customer where
cid='"+t1.getText()+"'");
while(rs.next())
{
cno=rs.getString("cid");
lb6.setText("Customer ID : "+""+cno);
lb7.setText("Customer Name : "+""+rs.getString("cname"));
lb8.setText("Design No : "+""+rs.getString("Dno"));
lb9.setText("Design Name : "+""+rs.getString("Dname"));
dprice=rs.getInt("Dprice");
lb11.setText("Payment Mode : "+rs.getString("Mode"));
lb12.setText("Design Price : "+""+dprice);
paid=rs.getInt("receivedAmount");
lb13.setText("1st paid Installment : "+""+paid);
bal=rs.getInt("Balance");
lb14.setText("Due Balance : "+bal);cnt=0;
img4=Toolkit.getDefaultToolkit().getImage(rs.getString("Dimg"));
repaint();
}}
else
{
JOptionPane.showMessageDialog((null),"This customer id does not exist in \"on orders\"
Category","Invalid Id",JOptionPane.INFORMATION_MESSAGE);
t1.setText("");ch.select(0);
lb6.setText("Customer ID : ");
lb7.setText("Customer Name : ");
lb8.setText("Design No : ");
lb9.setText("Design Name : ");
lb11.setText("Payment Mode : ");
lb12.setText("Design Price : ");
lb13.setText("1st paid Installment : ");
lb14.setText("Due Balance : ");
t1.requestFocus();
img4=Toolkit.getDefaultToolkit().getImage("");
repaint();
}}}
if(ae.getSource()==b2)
{
if(ch.getSelectedItem().equals("select")&&t1.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"Plz select id from the List or Submit it","Invalid
Action", JOptionPane. INFORMATION_ MESSAGE);
}
else
{ ans=JOptionPane.showConfirmDialog((null),"Are u really
want to cancel the Order","Confirmation",JOptionPane.YES_NO_OPTION);
if(ans==JOptionPane.YES_OPTION)
{penalty=(30*dprice)/100;
ret=paid-penalty;
Page 106
JOptionPane.showMessageDialog((null),""+penalty+" rs. has been deducting from ur paid
Installment as Cancellation Act","Penalty
Information",JOptionPane.INFORMATION_MESSAGE);
st.executeUpdate("update customer set Status='Order
Cancel',CurrBal=0,Return="+ret+",Penalty='"+penalty+"' where cid='"+ch.getSelectedItem()
+"'");
rs=st.executeQuery("select * from customer");
receipt ob=new receipt(cno,"Order Cancel",s);
ob.setSize(400,550);
ob.setVisible(true);
ob.setTitle("Receipt");
ob.setLocationRelativeTo(null);
ob.setResizable(false);
dispose();
}}}
if(ae.getSource()==b3)
{
home ob=new home(s);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Home");
dispose();
}}
catch(Exception ex)
{System.out.println(ex);}
}
public void itemStateChanged(ItemEvent ie)
{
try
{
t1.setText("");rs.close();
rs=st.executeQuery("select * from customer where
cid='"+ch.getSelectedItem()+"'");
while(rs.next())
{
cno=rs.getString("cid"); lb6.setText("Customer ID :
"+""+cno);
lb7.setText("Customer Name : "+""+rs.getString("cname"));
lb8.setText("Design No : "+""+rs.getString("Dno"));
lb9.setText("Design Name : "+""+rs.getString("Dname"));
img4=Toolkit.getDefaultToolkit().getImage(rs.getString("Dimg"));
lb11.setText("Payment Mode : "+rs.getString("Mode"));
dprice=rs.getInt("Dprice");
lb12.setText("Design Price : "+""+dprice);
paid=rs.getInt("receivedAmount");
lb13.setText("1st paid Installment : "+""+paid);
bal=rs.getInt("Balance");
lb14.setText("Due Balance : "+bal);repaint();
}}
catch(Exception ex)
{System.out.println(ex);}
if(ch.getSelectedItem().equals("select"))
Page 107
{ t1.setText("");
lb6.setText("Customer ID : ");
lb7.setText("Customer Name : ");
lb8.setText("Design No : ");
lb9.setText("Design Name : ");
lb11.setText("Payment Mode : ");
lb12.setText("Design Price : ");
lb13.setText("1st paid Installment : ");
lb14.setText("Due Balance : ");
img4=Toolkit.getDefaultToolkit().getImage("");repaint();
}}
public void paint(Graphics g)
{
g.drawImage(img,5,30,this);
g.drawImage(img,660,30,this);
g.drawImage(img1,200,50,this);
g.drawImage(img1,540,50,this);
g.drawImage(img3,150,125,this);
g.drawImage(img4,180,385,this);
g.setColor(Color.gray);
g.drawLine(260,120,680,120);
g.drawLine(140,120,180,120);
g.drawLine(140,120,140,190);
g.drawLine(140,190,680,190);
g.drawLine(680,120,680,190)
}}
Page 108
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
class receipt extends Frame implements ActionListener
{
Label l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15;
ImageIcon ic;
JLabel jl,jl1;
Button b1;
Color cl;
Font f;
Connection cn=null;
Statement st=null;
ResultSet rs=null;
String s;
Page 109
l2=new Label("Dear Customer, Thanks for Shopping...!");
l2.setBounds(10,100,250,20);
add(l2);
l2.setFont(f);
l3=new Label("Deal status :");
l3.setBounds(30,140,250,20);
add(l3);
f=new Font("New Times Roman",Font.BOLD,16);
l3.setFont(f);
f=new Font("New Times Roman",Font.BOLD,14);
l4=new Label("Customer Id :");
l4.setBounds(30,165,200,20);
add(l4);
l5=new Label("Customer Name :");
l5.setBounds(30,190,300,20);
add(l5);
l6=new Label("Design No :");
l6.setBounds(30,215,200,20);
add(l6);
l7=new Label("Design Name :");
l7.setBounds(30,240,300,20);
add(l7);
l8=new Label("Design Price (Rs.) :");
l8.setBounds(30,265,200,20);
add(l8);
l9=new Label("Payment Mode :");
l9.setBounds(30,295,200,20);
add(l9);
l10=new Label("Received Amt (Rs) :");
l10.setBounds(30,320,200,20);
add(l10);
l11=new Label("Balance (Rs.) :");
l11.setBounds(30,345,200,20);
add(l11);
l12=new Label("Return Amt (Rs.) :");
l12.setBounds(30,370,200,20);
add(l12);
l14=new Label("Current Balance(Rs) :");
l14.setBounds(30,415,200,20);
l15=new Label("Return Amt(Rs.) :");
l15.setBounds(30,395,200,20);
b1=new Button("OK");
b1.setBounds(300,390,50,30);
add(b1);
b1.setBackground(Color.orange);
f=new Font("New Times Roman",Font.BOLD,16);
b1.setFont(f);
b1.addActionListener(this);
if(name.equals("New Order"))
{
rs=st.executeQuery("select * from Customer where Cid='"+cno+"' " );
while(rs.next())
Page 110
{
l3.setText(l3.getText()+" "+rs.getString("Status"));
l4.setText(l4.getText()+" "+rs.getString("Cid"));
l5.setText(l5.getText()+" "+rs.getString("Cname"));
l6.setText(l6.getText()+" "+rs.getString("Dno"));
l7.setText(l7.getText()+" "+rs.getString("Dname"));
l8.setText(l8.getText()+" "+rs.getString("Dprice"));
l9.setText(l9.getText()+" "+rs.getString("Mode"));
l10.setText(l10.getText()+" "+rs.getString("ReceivedAmount"));
l11.setText(l11.getText()+" "+rs.getString("Balance"));
l12.setText(l12.getText() +" "+rs.getString("Return"));
} }
if(name.equals("Final Installment"))
{
l10.setText("1st Installment(Rs) :");
l11.setText("Last Balance(Rs) :");
l12.setText("Final Installment(Rs):");
add(l15);add(l14);
rs=st.executeQuery("select * from Customer where Cid='"+cno+"' ");
while(rs.next())
{
l3.setText(l3.getText()+" "+rs.getString("Status"));
l4.setText(l4.getText()+" "+rs.getString("Cid"));
l5.setText(l5.getText()+" "+rs.getString("Cname"));
l6.setText(l6.getText()+" "+rs.getString("Dno"));
l7.setText(l7.getText()+" "+rs.getString("Dname"));
l8.setText(l8.getText()+" "+rs.getString("Dprice"));
l9.setText(l9.getText()+" "+rs.getString("Mode"));
l10.setText(l10.getText()+" "+rs.getString("ReceivedAmount"));
l11.setText(l11.getText()+" "+rs.getString("Balance"));
l12.setText(l12.getText() +" "+rs.getString("2ndInstallment"));
l15.setText(l15.getText() +" "+rs.getString("Return"));
l14.setText(l14.getText()+" "+rs.getString("CurrBal"));
}}
if(name.equals("Order Cancel"))
{
l12.setText("Cost Deduct(30%) :");
l15.setText("Return Amt(Rs) :");
add(l15);
rs=st.executeQuery("select * from Customer where Cid='"+cno+"' ");
while(rs.next())
{
l3.setText(l3.getText()+" "+rs.getString("Status"));
l4.setText(l4.getText()+" "+rs.getString("Cid"));
l5.setText(l5.getText()+" "+rs.getString("Cname"));
l6.setText(l6.getText()+" "+rs.getString("Dno"));
l7.setText(l7.getText()+" "+rs.getString("Dname"));
l8.setText(l8.getText()+" "+rs.getString("Dprice"));
l9.setText(l9.getText()+" "+rs.getString("Mode"));
l10.setText(l10.getText()+" "+rs.getString("ReceivedAmount"));
l11.setText(l11.getText()+" "+rs.getString("Balance"));
l12.setText(l12.getText() +" "+rs.getString("Penalty"));
Page 111
l15.setText(l15.getText() +" "+rs.getString("Return"));
}}}
catch(Exception ex)
{System.out.println(ex);}
}
public void actionPerformed(ActionEvent ae)
{
home ob=new home(s);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Home");
dispose();
}
}
Page 112
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class admin extends Frame implements ActionListener
{
JLabel jl,jl1,jl2,jl3,jl4;
ImageIcon ic;
JButton jb;
Color cl;
Font f;
MenuBar mb;
Menu m1,m2,m3,m4;
MenuItem d1,d2,d3,s1,s2,r1,r2,r3,mt1,mt2,mt3,mt4;
admin()
{
setLayout(null);
cl=new Color(150,200,150);
setBackground(cl);
ic=new ImageIcon("om.jpg");
jl3=new JLabel(ic);
jl3.setBounds(330,20,80,100);
add(jl3);
ic=new ImageIcon("logo.jpg");
jl=new JLabel(ic);
jl.setBounds(240,190,280,200 );
add(jl);
jl.setBackground(cl);
f=new Font("Edwardian Script ITC",Font.BOLD,62);
jl4=new JLabel("Tanishq Jeweller");
jl4.setBounds(200,100,365,55);
add(jl4);
jl4.setFont(f);
jl4.setForeground(Color.blue);
ic=new ImageIcon("jew3.gif");
jl1=new JLabel(ic);
jl1.setBounds(65,104,150,40);
add(jl1);
jl2=new JLabel(ic);
jl2.setBounds(545,106,150,40);
add(jl2);
ic=new ImageIcon("back1.gif");
jb=new JButton(ic);
jb.setBounds(50,480,90,28);
add(jb);
mb=new MenuBar();
m1=new Menu("Designs");
Page 113
m2=new Menu("Staff");
m3=new Menu("Reports");
m4=new Menu("Others");
d1=new MenuItem("New Entry");
d2=new MenuItem("Update Design");
d3=new MenuItem("Delete Design");
s1=new MenuItem("New Staff Entry");
s2=new MenuItem("StaffList");
r1=new MenuItem("Soldlist");
r2=new MenuItem("Orderlist");
r3=new MenuItem("Cancelorderlist");
mt1=new MenuItem("Exit");
mt2=new MenuItem("Back");
mt3=new MenuItem("Logout");
mt4=new MenuItem("About us");
m1.add(d1);m1.add(d2);m1.add(d3);
m2.add(s1);m2.add(s2);
m3.add(r1);m3.add(r2);m3.add(r3);
m4.add(mt1);m4.add(mt2);m4.add(mt3);m4.add(mt4);;
mb.add(m1);
mb.add(m2);
mb.add(m3);
mb.add(m4);
setMenuBar(mb);
jb.setBackground(cl);
jb.addActionListener(this);
d1.addActionListener(this);
d2.addActionListener(this);
d3.addActionListener(this);
s1.addActionListener(this);
s2.addActionListener(this);
r1.addActionListener(this);
r2.addActionListener(this);
r3.addActionListener(this);
mt1.addActionListener(this);
mt2.addActionListener(this);
mt3.addActionListener(this);
mt4.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if((ae.getSource()==jb)||(ae.getSource()==mt2))
{
intro ob=new intro("Admin");
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);ob.setTitle("welcome");
dispose();
}
if(ae.getSource()==s2)
{
Page 114
stafflist ob=new stafflist();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("StaffList");
dispose();
}
if(ae.getSource()==s1)
{
staffentry ob=new staffentry();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("New Staff Entry");
dispose();
}
if(ae.getSource()==mt1)
{
int ans=JOptionPane.showConfirmDialog((null),"Are You Really want to exit","Exit
confirmation",JOptionPane.YES_NO_OPTION);
if(ans==JOptionPane.YES_OPTION)
{System.exit(0);}
}
if(ae.getSource()==d1)
{
newdesign ob=new newdesign();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("New Design Entry");
dispose();
}
if(ae.getSource()==mt3)
{
w1 ob=new w1();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Jewellery shop");
dispose();
}
if(ae.getSource()==mt4)
{
aboutus ob=new aboutus("Admin","Admin");
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("About us...");
dispose();
}
if(ae.getSource()==r1)
{
records ob=new records();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Sold Item Records....");
dispose();
Page 115
}
if(ae.getSource()==r2)
{
records1 ob=new records1("On Order");
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("On Order Item Records....");
dispose();
}
if(ae.getSource()==r3)
{
records1 ob=new records1("Cancel Order");
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Cancel Order Item Records....");
dispose();
}
if(ae.getSource()==d2)
{
modifydesign ob=new modifydesign("Updation Of Design");
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Updation of Designs");
dispose();
}
if(ae.getSource()==d3)
{
modifydesign ob=new modifydesign("Deletion Of Design");
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Deletion of Designs");
dispose();
}
}
}
Page 116
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
class newdesign extends Frame implements ActionListener,TextListener
{
Label l1,l2,l3,l4,l5;
TextField t1,t2,t3,t4;
Button b1,b2,b3,b4;
Choice ch;
Image img;
Color cl;
JLabel jl,jl1,jl2,jl3,jl4;
ImageIcon ic;
Font f;
Connection cn=null;
Statement st=null;
ResultSet rs=null;
int cost,cnt=0,i=0;
String price;
newdesign()
{
cl=new Color(245,210,140);
setBackground(cl);
setLayout(null);
ic=new ImageIcon("t121.jpg");
jl=new JLabel(ic);
jl.setBounds(10,10,120,120);
add(jl);
jl=new JLabel(ic);
jl.setBounds(640,10,120,120);
add(jl);
f=new Font("Edwardian Script ITC",Font.BOLD,50);
jl3=new JLabel("Tanshiq Jeweller ");
jl3.setBounds(230,30,300,50);
add(jl3);
jl3.setFont(f);
jl4=new JLabel(" Design Preview Box ",JLabel.CENTER);
jl4.setBounds(460,160,200,200);
add(jl4);
jl4.setOpaque(true);
l1=new Label("New Design Entry");
l1.setBounds(250,100,300,30);
add(l1);
Page 117
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,25 );
l1.setFont(f);
f=new Font("New Times Roman",Font.BOLD,15 );
setFont(f);
l2=new Label("Design No :");
l2.setBounds(120,190,100,30);
add(l2);
t1=new TextField();
t1.setBounds(250,192,150,20);
add(t1);
l3=new Label("Design Name:");
l3.setBounds(120,240,100,30);
add(l3);
ch=new Choice();
ch.setBounds(250,242,150,20);
add(ch);
l4=new Label("Design Price :");
l4.setBounds(120,290,100,30);
add(l4);
t3=new TextField();
t3.setBounds(250,292,150,20);
add(t3);
l5=new Label("Design Path :");
l5.setBounds(120,340,100,30);
add(l5);
t4=new TextField();
t4.setBounds(250,342,150,20);
add(t4);
b1=new Button("Preview");
b1.setBounds(570,370,80,30);
add(b1);
b1.setBackground(Color.black);
b1.setForeground(cl);
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,20 );
b2=new Button("ADD");
b2.setBounds(140,420,80,30);
add(b2);
cl=new Color(255,200,110);
b2.setBackground(cl);
b2.setFont(f);
b3=new Button("Reset");
b3.setBounds(250,420,80,30);
add(b3);
b3.setBackground(cl);
b3.setFont(f);
b4=new Button("Back");
b4.setBounds(365,420,80,30);
add(b4);
b4.setBackground(cl);
b4.setFont(f);
jl4.setBackground(cl);
ch.addItem("select");
Page 118
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver
(*.mdb)}; DBQ=e:/wel/tanishq.mdb");
st=cn.createStatement();
rs=st.executeQuery("select distinct Dname from Design");
while(rs.next())
{ch.addItem(rs.getString("Dname"));}
}
catch(Exception ex)
{System.out.println(ex);}
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
t4.addTextListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b1)
{ i=0;
if(t4.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"To see preview of design,plz Enter valid path","Invalid
Act",JOptionPane.WARNING_MESSAGE);
}
else
{ i=1;
ic=new ImageIcon(t4.getText());
jl4.setIcon(ic);
}
}
if(ae.getSource()==b2)
{
try
{
rs=st.executeQuery("select * from Design");
while(rs.next())
{
if(rs.getString("Dno").equals(t1.getText()))
{cnt++;}
}
if(t3.getText().equals(""))
{ price="0";}
else
{price=t3.getText(); }
cost=Integer.parseInt(price);
if(cnt>0)
{
JOptionPane.showMessageDialog((null),"This Eid no is already Exist,try again","Adding Error",
JOptionPane.WARNING_MESSAGE); t1.requestFocus();cnt=0;
Page 119
}
else if(t1.getText().equals("")||
ch.getSelectedItem().equals("select")||t3.getText().equals("")||t4.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"All fields are compulsory to fill ","Adding
Error",JOptionPane.WARNING_MESSAGE);}
else if(i==0)
{
JOptionPane.showMessageDialog((null),"Before Adding design,it is recommended to see
preview of design","Adding Error",JOptionPane.WARNING_MESSAGE);}
else
{
rs.close();String stm=t4.getText();
st.executeUpdate("insert into Design
values('"+t1.getText()+"','"+ch.getSelectedItem()+"',"+cost+",'"+t4.getText()+"')");
rs=st.executeQuery("select * from design");
JOptionPane.showMessageDialog((null),"New Record Added Successfully","Adding
successfully", JOptionPane.INFORMATION_MESSAGE);
t1.setText("");ch.select(0);t3.setText("");t4.setText("");
jl4.setIcon(new ImageIcon(""));
t1.requestFocus();
}}
catch(NumberFormatException ne)
{
JOptionPane.showMessageDialog((null),"Invalid Price,Design Price must be in
Numbers","Adding Error",JOptionPane.WARNING_MESSAGE);t3.setText("");
t3.requestFocus();
}
catch(Exception e)
{System.out.println(e);}
}
if(ae.getSource()==b3)
{
t1.setText("");ch.select(0);t3.setText("");
t4.setText("");
t1.requestFocus();
ic=new ImageIcon("");
jl4.setIcon(ic);
}
if(ae.getSource()==b4)
{
admin ob=new admin();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Admin");
dispose();
}}
public void textValueChanged(TextEvent te)
{i=0;}
}
Page 120
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
class modifydesign extends Frame implements ActionListener,ItemListener
{
Label l1,l2,l3,l4,l5,l6,l7,l8,l9;
TextField t1,t2,t3,t4;
Button b1,b2,b3,b4;
Choice ch,ch1;
Image img,img1,img2;
Color cl;
Font f;
Connection cn=null;
Statement st=null;
ResultSet rs=null;
int cnt=0,cnt1=0,price=0,cnt4=0;
String str,str1,str2;
modifydesign(String name)
{
cl=new Color(245,210,140);
str=name;
setBackground(cl);
setLayout(null);
img=Toolkit.getDefaultToolkit().getImage("t121.jpg");
img1=Toolkit.getDefaultToolkit().getImage("pic1.jpg");
f=new Font("Edwardian Script ITC",Font.BOLD,40);
l1=new Label("Tanshiq Jeweller ");
l1.setBounds(230,30,350,50);
add(l1);
l1.setFont(f);
l2=new Label(str,1);
l2.setBounds(250,100,300,30);
add(l2);
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,25 );
l2.setFont(f);
l3=new Label("Total Designs :",1);
l3.setBounds(270,140,200,30);
add(l3);
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,20);
l3.setFont(f);
l3.setForeground(Color.blue);
l4=new Label("Search Box",1);
l4.setBounds(155,170,90,18);
add(l4);
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,15);
Page 121
l4.setFont(f);l4.setForeground(Color.blue);
l5=new Label("Select from List");
l5.setBounds(125,210,100,20);
add(l5);
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,13);
l5.setFont(f);
ch=new Choice();
ch.setBounds(230,210,100,15);
add(ch);
ch.setFont(f);
ch.add("Select");
l6=new Label(" OR Submit It Here");
l6.setBounds(350,210,125,20);
add(l6);
l6.setFont(f);
t1=new TextField();
t1.setBounds(480,210,100,20);
add(t1);
t1.setFont(f);
b1=new Button("Submit");
b1.setBounds(590,210,60,20);
add(b1);
b1.setFont(f);
b1.setBackground(Color.black);
b1.setForeground(cl);
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,15);
setFont(f);
l7=new Label("Design No :");
l7.setBounds(70,270,110,30);
add(l7);
t2=new TextField();
t2.setBounds(190,275,150,20);
add(t2);
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,14);
t2.setFont(f);
l8=new Label("Design Name :");
l8.setBounds(70,320,110,30);
add(l8);
t3=new TextField();
t3.setBounds(190,325,150,20);
ch1=new Choice();
ch1.setBounds(190,325,150,20);
l9=new Label("Design Price :");
l9.setBounds(70,370,110,30);
add(l9);
t4=new TextField();
t4.setBounds(190,375,150,20);
add(t4);
b2=new Button("Update");
b2.setBounds(230,450,100,30);
b3=new Button("Delete");
b3.setBounds(230,450,100,30);
Page 122
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,20);
if(str.equalsIgnoreCase("Updation of Design"))
{ add(b2);b2.setFont(f);
b2.setForeground(cl);
b2.setBackground(Color.black); add(ch1);ch1.addItem("select");
}
else if(str.equalsIgnoreCase("Deletion Of Design"))
{ add(b3);b3.setFont(f);add(t3);
b3.setForeground(cl);
b3.setBackground(Color.black);t2.setEnabled(false);
t3.setEnabled(false);t4.setEnabled(false);
}
b4=new Button("Back ");
b4.setBounds(350,450,100,30);
add(b4);b4.setFont(f);
b4.setForeground(cl);
b4.setBackground(Color.black);
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};
DBQ=e:/wel/tanishq.mdb");
st=cn.createStatement();
rs=st.executeQuery("Select * from design");
while(rs.next())
{cnt++;ch.addItem(rs.getString("Dno"));}
l3.setText(l3.getText()+""+cnt);
rs.close();
rs=st.executeQuery("Select distinct Dname from design");
while(rs.next())
{ch1.addItem(rs.getString("Dname"));}
}
catch(Exception ex)
{System.out.println(ex);}
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
ch.addItemListener(this);
}
public void actionPerformed(ActionEvent ae)
{
try
{ int i=0;
if(ae.getSource()==b1)
{ cnt1=0;
if(t1.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"Plz Enter Design No","Invalid
Action",JOptionPane.INFORMATION_MESSAGE);
}
else
Page 123
{
while(i<=cnt)
{
if(ch.getItem(i).equalsIgnoreCase("select")&&t1.getText().equalsIgnoreCase("select"))
{cnt1=0;}
else if(ch.getItem(i).equals(t1.getText()))
{cnt1++;}
i++;
}}
if(cnt1==1)
{ ch.select(t1.getText());
rs.close();
rs=st.executeQuery("select * from Design where Dno='"+ch.getSelectedItem()+"'");
while(rs.next())
{
t2.setText(rs.getString("Dno"));
str1=rs.getString("Dname");
t3.setText(str1);
t4.setText(rs.getString("Dprice"));
ch1.select(str1);
img2=Toolkit.getDefaultToolkit().getImage(rs.getString("Dpic"));repaint();
}}
else
{
JOptionPane.showMessageDialog((null),"This Design No does not exist","Invalid
Id",JOptionPane.INFORMATION_MESSAGE);
ch.select(0);t2.setText("");t3.setText("");t4.setText("");ch1.select(0);img2=Toolkit.getDefa
ultToolkit().getImage("");repaint();
t1.setText("");t1.requestFocus();
}
}
if(ae.getSource()==b2)
{ cnt4=0;
if(t4.getText().equals(""))
{price=0;}
else
{price=Integer.parseInt(t4.getText());}
rs=st.executeQuery("select * from Design");
while(rs.next())
{
str2=rs.getString("Dno");
if(t2.getText().equals(str2)&&(!ch.getSelectedItem().equals(str2)))
{cnt4=1;}
else if(ch.getSelectedItem().equals(t2.getText()))
{cnt4=0;}
}
if(ch.getSelectedItem().equals("Select"))
{
JOptionPane.showMessageDialog((null),"Plz Select Design No from the List or Submit
it","Invalid Act", JOptionPane.INFORMATION_MESSAGE);
}
else if(cnt4>=1)
Page 124
{
JOptionPane.showMessageDialog((null),"This Design No is already exist","Invalid Act",
JOptionPane.INFORMATION_MESSAGE); t2.requestFocus();
}
else if(t2.getText().equals("")||
ch1.getSelectedItem().equals("select")||price==0)
{
JOptionPane.showMessageDialog((null),"Plz fill All the Fields Properly","Invalid
Act",JOptionPane.INFORMATION_MESSAGE);
}
else
{
int ans=JOptionPane.showConfirmDialog((null), "Do you want to save the changes","Updation
Confirmation", JOptionPane. YES_NO_OPTION);
if(ans==JOptionPane.YES_OPTION)
{
st.executeUpdate("update Design set Dno='"+t2.getText()
+"',Dname='"+ch1.getSelectedItem()+"',Dprice="+price+" where Dno='"+ch.getSelectedItem()
+"'");
rs=st.executeQuery("select * from design");
JOptionPane.showMessageDialog((null),"Design succesfully Updated","Updation Succeed",
JOptionPane. INFORMATION_ MESSAGE);
ch.removeAll();
ch.addItem("Select");
rs=st.executeQuery("select * from Design");
while(rs.next())
{ch.addItem(rs.getString("Dno"));}
t1.setText("");t2.setText("");t3.setText("");
t4.setText("");ch.select(0);ch1.select(0);
img2=Toolkit.getDefaultToolkit().getImage("");repaint();
}
else
{
t1.setText("");t2.setText("");t3.setText("");
t4.setText("");ch.select(0);ch1.select(0);
img2=Toolkit.getDefaultToolkit().getImage("");repaint();
}}}
if(ae.getSource()==b3)
{if(ch.getSelectedItem().equals("Select"))
{
JOptionPane.showMessageDialog((null),"Plz Select Design No from the List or Submit
it","Invalid Act", JOptionPane. INFORMATION_MESSAGE);
}
else
{
int ans=JOptionPane.showConfirmDialog((null),"Are you sure to delete this Desgin","Deletion
Confirmation",JOptionPane.YES_NO_OPTION);
if(ans==JOptionPane.YES_OPTION)
{
st.executeUpdate("delete from Design where Dno='"+ch.getSelectedItem()
+"'");
rs=st.executeQuery("select * from design");
Page 125
JOptionPane.showMessageDialog((null),"Design Deleted From the Records
Succesfully","Deletion Succeed", JOptionPane.INFORMATION_MESSAGE);
t1.setText("");t2.setText("");t3.setText("");t4.setText("");ch.select(0);ch1.select(0);
img2=Toolkit.getDefaultToolkit().getImage("");repaint();
ch.removeAll();
ch.addItem("Select");cnt=0;
rs=st.executeQuery("select * from design");
while(rs.next())
{
ch.addItem(rs.getString("Dno"));cnt++;
}
l3.setText("Total Designs :"+cnt);
}
else
{
t1.setText("");t2.setText("");t3.setText("");
t4.setText("");ch.select(0);ch1.select(0);
img2=Toolkit.getDefaultToolkit().getImage("");repaint();cnt1=0;
}}}
if(ae.getSource()==b4)
{
admin ob=new admin();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Admin");
dispose();
}}
catch(NumberFormatException ne)
{
JOptionPane.showMessageDialog((null),"Invalid Price,plz enter price in Numbers","Invalid
Act",JOptionPane.WARNING_MESSAGE);
}
catch(Exception ex)
{
System.out.println(ex);
}
}
public void itemStateChanged(ItemEvent ie)
{ try
{
t1.setText("");rs.close();
rs=st.executeQuery("select * from Design where
Dno='"+ch.getSelectedItem()+"'");
while(rs.next())
{
t2.setText(rs.getString("Dno"));
str1=rs.getString("Dname");
t3.setText(str1);
t4.setText(rs.getString("Dprice"));
ch1.select(str1);
img2=Toolkit.getDefaultToolkit().getImage(rs.getString("Dpic"));
repaint();
Page 126
}}
catch(Exception ex)
{System.out.println(ex);}
if(ch.getSelectedItem().equals("Select"))
{
t1.setText("");t2.setText("");t3.setText("");
t4.setText("");ch1.select(0);
img2=Toolkit.getDefaultToolkit().getImage("");repaint();
}}
public void paint(Graphics g)
{
g.drawImage(img,20,30,this);
g.drawImage(img,690,30,this);
g.drawImage(img1,110,188,this);
g.drawImage(img2,400,290,this);
cl=new Color(245,240,180);
g.setColor(Color.gray);
g.drawLine(105,180,155,180);
g.drawLine(245,180,665,180);
g.drawLine(105,180,105,240);
g.drawLine(665,180,665,240);
g.drawLine(105,240,665,240);
}
}
Page 127
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
class staffentry extends Frame implements ActionListener
{
ImageIcon ic;
JLabel jl,jl1,jl2,jl3;
Label l1,lb1,lb2,lb3,lb4,lb5,lb6,lb7,lb8;
TextField t1,t2,t3,t4,t5,t6;
Button b1,b2,b3;
Color cl;
Font f,f1;
Connection cn=null;
Statement st=null;
ResultSet rs=null;
int cnt=0;
staffentry()
{
setLayout(null);
cl=new Color(210,150,195);
setBackground(cl);
ic=new ImageIcon("jew3.gif");
jl=new JLabel(ic);
jl.setBounds(140,20,80,60);
add(jl);
f=new Font("Edwardian Script ITC",Font.BOLD,45);
jl1=new JLabel("Tanshiq Jeweller ");
jl1.setBounds(230,30,300,50);
add(jl1);
jl1.setFont(f);
jl2=new JLabel(ic);
jl2.setBounds(490,20,80,60);
add(jl2);
l1=new Label("New Staff Entry");
l1.setBounds(250,80,300,30);
add(l1);
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,25 );
l1.setFont(f);
f1=new Font("New Times Roman",Font.BOLD,15);
lb1=new Label("Staff ID:");
lb1.setBounds(40,200,100,20);
add(lb1 );
setFont(f1);
t1=new TextField(20);
t1.setBounds(140,200, 140,20);
Page 128
add(t1);
lb2=new Label("EmpName:");
lb2.setBounds(330,200,100,20);
add(lb2);
t2=new TextField();
t2.setBounds(430,200,140,20);
add(t2);
lb3=new Label("Deptt:");
lb3.setBounds(40,250,100,20);
add(lb3);
t3=new TextField();
t3.setBounds(140 ,250,140,20);
add(t3);
lb4=new Label("Duty On:");
lb4.setBounds(330,250,100,20);
add(lb4);
t4=new TextField();
t4.setBounds(430,250,140,20);
add(t4);
lb5=new Label("Salary:");
lb5.setBounds(40,300,100,20);
add(lb5);
t5=new TextField();
t5.setBounds(140,300,140,20);
add(t5);
lb6=new Label("Joining:");
lb6.setBounds(330,300,100,20);
add(lb6);
t6=new TextField();
t6.setBounds(430,300,140,20);
add(t6);
b1=new Button("Add");
b1.setBounds(170,390,90,35);
add(b1);
b1.setFont(f);
b2=new Button("Cancel");
b2.setBounds(300,390,90,35);
add(b2);
b2.setFont(f);
b3=new Button("Back");
b3.setBounds(430,390,90,35);
b3.setFont(f);
add(b3);
b1.setBackground(Color.black);
b2.setBackground(Color.black);
b3.setBackground(Color.black);
b1.setForeground(cl);
b2.setForeground(cl);
b3.setForeground(cl);
ic=new ImageIcon("jew11.jpg");
jl3=new JLabel(ic);
jl3.setBounds(570,20,200,200);
Page 129
add(jl3);
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};
DBQ=e:/wel/tanishq.mdb");
st=cn.createStatement();
}
catch(Exception e)
{System.out.println(e);}
b3.addActionListener(this);
b1.addActionListener(this);
b2.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b3)
{
admin ob=new admin();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Admin");
dispose();
}
if(ae.getSource()==b1)
{
try
{
rs=st.executeQuery("select * from staff1");
while(rs.next())
{
if(rs.getString("eid").equals(t1.getText()))
{cnt++;}
}
if(cnt>0)
{
JOptionPane.showMessageDialog((null),"This Eid no is already Exist,try again","Adding
Error",JOptionPane.WARNING_MESSAGE);
cnt=0;
}
else if(t1.getText().equals("")||t2.getText().equals("")||t3.getText().equals("")||
t4.getText().equals("")||t5.getText().equals("")||t6.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"All fields are compulsory to
fill ,you cann't leave them","Adding Error",JOptionPane.WARNING_MESSAGE);
}
else
{
st.executeUpdate("insert into staff1 values('"+t1.getText()+"',' "+t2.getText()+" ','
"+t3.getText()+" ',' "+t4.getText()+" ',' "+t5.getText()+" ',' "+t6.getText()+" ')");
rs=st.executeQuery("select * from staff1");
Page 130
JOptionPane.showMessageDialog((null),"New Record Added
Successfully","Adding successfully",JOptionPane.INFORMATION_MESSAGE);
t1.setText("");t2.setText("");t3.setText("");
t4.setText("");t5.setText("");t6.setText("");
t1.requestFocus();
}}
catch(Exception e)
{System.out.println(e);}
}
if(ae.getSource()==b2)
{
t1.setText("");t2.setText("");t3.setText("");
t4.setText("");t5.setText("");t6.setText("");
t1.requestFocus();
}
}
Page 131
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
class stafflist extends Frame implements ActionListener,ItemListener
{
ImageIcon ic;
JLabel jl,jl1,jl2,jl3;
Label l1,lb1,lb2,lb3,lb4,lb5,lb6,lb7,lb8;
TextField t1,t2,t3,t4,t5,t6;
Button b1,b2,b3,b4;
Choice ch;
Color cl;
Font f;
Connection cn;
Statement st;
ResultSet rs;
int cnt=0;
stafflist()
{
setLayout(null);
cl=new Color(150,200,150);
setBackground(cl);
ic=new ImageIcon("gan6.jpg");
jl3=new JLabel(ic);
jl3.setBounds(570,20,200,200);
add(jl3);
jl3.setBackground(cl);
ic=new ImageIcon("jew3.gif");
jl=new JLabel(ic);
jl.setBounds(140,20,80,60);
add(jl);
f=new Font("Edwardian Script ITC",Font.BOLD,45);
jl1=new JLabel("Tanshiq Jeweller ");
jl1.setBounds(230,30,300,50);
add(jl1);
jl1.setFont(f);
jl1.setForeground(Color.blue);
jl2=new JLabel(ic);
jl2.setBounds(490,20,80,60);
add(jl2);
l1=new Label("Staff Data");
l1.setBounds(280,80,200,30);
add(l1);
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,30 );
l1.setFont(f);
Page 132
l1.setForeground(Color.blue);
f=new Font("New Times Roman",Font.BOLD,15);
lb7=new Label("Total Staff Members:");
lb7.setBounds(40,140,180,30);
add(lb7);
lb7.setFont(f);
ch=new Choice();
ch.setBounds(520,135,80,30);
add(ch);
lb2=new Label("Select id from the list");
lb2.setBounds(350,130,250,30);
add(lb2);
lb2.setFont(f);
lb1=new Label("Staff ID:");
lb1.setBounds(40,200,100,20);
add(lb1 );
setFont(f);
t1=new TextField(20);
t1.setBounds(140,200, 140,20);
add(t1);
t1.setEditable(false);
lb2=new Label("EmpName:");
lb2.setBounds(330,200,100,20);
add(lb2);
t2=new TextField();
t2.setBounds(430,200,140,20);
add(t2);
lb3=new Label("Deptt:");
lb3.setBounds(40,250,100,20);
add(lb3);
t3=new TextField();
t3.setBounds(140 ,250,140,20);
add(t3);
lb4=new Label("Duty On:");
lb4.setBounds(330,250,100,20);
add(lb4);
t4=new TextField();
t4.setBounds(430,250,140,20);
add(t4);
lb5=new Label("Salary:");
lb5.setBounds(40,300,100,20);
add(lb5);
t5=new TextField();
t5.setBounds(140,300,140,20);
add(t5);
lb6=new Label("Joining:");
lb6.setBounds(330,300,100,20);
add(lb6);
t6=new TextField();
t6.setBounds(430,300,140,20);
add(t6);
b1=new Button("OK");
Page 133
b1.setBounds(140,390,70,30);
add(b1);
b2=new Button("Update");
b2.setBounds(240,390,70,30);
add(b2);
b3=new Button("Delete");
b3.setBounds(340,390,70,30);
add(b3);
b4=new Button("Back");
b4.setBounds(440,390,70,30);
add(b4);
b1.setBackground(cl);
b2.setBackground(cl);
b3.setBackground(cl);
b4.setBackground(cl);
ch.addItem("select");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};
DBQ=e:/wel/tanishq.mdb");
st=cn.createStatement();
rs=st.executeQuery("select * from Staff1");
while(rs.next())
{
ch.addItem(rs.getString("eid"));
cnt++;
}
lb7.setText(lb7.getText()+cnt);
}
catch(Exception e)
{System.out.println(e); }
b4.addActionListener(this);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
ch.addItemListener(this);
}
public void actionPerformed(ActionEvent ae)
{
try
{
if(ae.getSource()==b4)
{
admin ob=new admin();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Admin");
dispose();
}
if(ae.getSource()==b1)
{
Page 134
t1.setText("");t2.setText("");t3.setText("");
t4.setText("");
t5.setText("");t6.setText("");
ch.select(0);
}
if(ae.getSource()==b2)
{
if(t1.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"Please select id from the List","Updation
Unsuccessfull",JOptionPane.INFORMATION_MESSAGE);
t1.setText("");t2.setText("");t3.setText("");t4.setText("");t5.setText("");t6.setText("");
}
else if(t2.getText().equals("")||t3.getText().equals("")||
t4.getText().equals("")||t5.getText().equals("")||t6.getText().equals(""))
{
JOptionPane.showMessageDialog((null),"You Cann't leave
Any Field Empty","Updation Unsuccessfull",JOptionPane.INFORMATION_MESSAGE);
}
else
{
int ans=JOptionPane.showConfirmDialog((null),"Do you want to save Changes","Updation
confirmation",JOptionPane.YES_NO_OPTION);
if(ans==JOptionPane.YES_OPTION)
{
st.executeUpdate("update staff1 set ename='"+t2.getText()
+"',deptt='"+t3.getText()+"',duty='"+t4.getText()+"',salary='"+t5.getText()
+"',joining='"+t6.getText()+"' where eid='"+ch.getSelectedItem()+"' ");
rs=st.executeQuery("select * from staff1");
t1.setText("");t2.setText("");t3.setText("");t4.setText("");
t5.setText("");t6.setText("");
JOptionPane.showMessageDialog((null),"Record Updated Successfully","Updation succeed",
JOptionPane.INFORMATION_MESSAGE);
ch.select(0);
}}}
if(ae.getSource()==b3)
{
if(t1.getText().equals("")||(ch.getSelectedItem().equals("select")))
{
JOptionPane.showMessageDialog((null),"Please select id from the List","Deletion
Unsuccessfull", JOptionPane.INFORMATION_MESSAGE);
t1.setText("");t2.setText("");t3.setText(""); t4.setText("");t5.setText("");t6.setText("");
}
else
{ cnt=0;
int ans=JOptionPane.showConfirmDialog((null),"Are You sure to delete this record","Deletion
confirmation",JOptionPane.YES_NO_OPTION);
if(ans==JOptionPane.YES_OPTION)
{
st.executeUpdate("delete from staff1 where eid='"+ ch.getSelectedItem()+"'");
rs=st.executeQuery("select * from staff1");
Page 135
JOptionPane.showMessageDialog((null),"Record DeleteSuccessfully","Deletion
succeed",JOptionPane.INFORMATION_MESSAGE);
ch.select(0);
t1.setText("");t2.setText("");t3.setText("");t4.setText("");t5.setText("");t6.setText("");
ch.removeAll();
ch.addItem("select");
while(rs.next())
{ch.addItem(rs.getString("eid"));
cnt++;
}
lb7.setText("Total Staff Members:"+cnt);
}
else
{
t1.setText("");t2.setText("");t3.setText("");
t4.setText("");t5.setText("");t6.setText("");ch.select(0);
}
}}}
catch(Exception e)
{System.out.println(e);}
}
public void itemStateChanged(ItemEvent ie)
{
try
{
rs=st.executeQuery("select * from staff1 where eid='"+ch.getSelectedItem()+"'");
if(ch.getSelectedItem().equals("select"))
{ t1.setText("");t2.setText("");t3.setText("");
t4.setText("");t5.setText("");t6.setText("");
}
else
{
while(rs.next())
{
t1.setText(rs.getString("eid"));
t2.setText(rs.getString("ename"));
t3.setText(rs.getString("deptt"));
t4.setText(rs.getString("duty"));
t5.setText(rs.getString("salary"));
t6.setText(rs.getString("joining"));
}
}
}
catch(Exception e)
{System.out.println(e);}
}
}
Page 136
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
class records extends Frame implements ActionListener,ItemListener
{
Label l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,c1,c2,c3,p1,p2,p3,p4,p5;
TextField t1,t2,t3,t4;
Button b1,b2,b3,b4;
Choice ch;
Image img;
Color cl;
JLabel jl,jl1,jl2,jl3,jl4;
JButton jb;
ImageIcon ic;
Font f;
Connection cn=null;
Statement st=null;
ResultSet rs=null;
int cnt=0,i=0,rec=0,ret=0,sinstall=0;
String mode;
records()
{
cl=new Color(245,210,140);
setBackground(cl);
setLayout(null);
ic=new ImageIcon("t121.jpg");
jl=new JLabel(ic);
jl.setBounds(10,10,120,120);
add(jl);
jl=new JLabel(ic);
jl.setBounds(640,10,120,120);
add(jl);
f=new Font("Edwardian Script ITC",Font.BOLD,55);
jl3=new JLabel("Tanshiq Jeweller ");
jl3.setBounds(220,30,350,50);
add(jl3);
jl3.setFont(f);
l1=new Label("Sold Items Record");
l1.setBounds(270,100,250,30);
add(l1);
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,25 );
l1.setFont(f);
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,18 );
Page 137
l2=new Label("Total Sold Items :");
l2.setBounds(15,150,200,30);
add(l2);
l2.setFont(f);
l3=new Label("This is Record:");
l3.setBounds(285,150,170,30);
add(l3);
l3.setFont(f);
l4=new Label("view by category:");
l4.setBounds(560,150,155,30);
add(l4);
l4.setFont(f);
l5=new Label("Design Info:-");
l5.setBounds(15,190,150,30);
add(l5);l5.setForeground(Color.blue);
l5.setFont(f);
l6=new Label("Customer Info:-");
l6.setBounds(285,190,150,30);
add(l6);l6.setForeground(Color.blue);
l6.setFont(f);
l7=new Label("Payment Info:-");
l7.setBounds(560,190,150,30);
add(l7);l7.setForeground(Color.blue);
l7.setFont(f);
l8=new Label("Dno :");
l8.setBounds(15,230,250,30);
add(l8);
f=new Font("New Times Roman",Font.BOLD,15 );
setFont(f);
l9=new Label("Dname :");
l9.setBounds(15,270,250,30);
add(l9);
l10=new Label("Dprice :");
l10.setBounds(15,310,250,30);
add(l10);
l11=new Label("Dimg :");
l11.setBounds(15,350,100,30);
add(l11);
jl4=new JLabel("");
jl4.setBounds(20,350,250,250);
add(jl4);
c1=new Label("Cno :");
c1.setBounds(285,230,250,30);
add(c1);
c2=new Label("Cname :");
c2.setBounds(285,270,270,30);
add(c2);
c3=new Label("Contactno:");
c3.setBounds(285,310,250,30);
add(c3);
p1=new Label("Pmode :");
p1.setBounds(560,230,250,30);
Page 138
add(p1);
p2=new Label("Payment paid :");
p2.setBounds(560,270,270,30);
add(p2);
p3=new Label("Return Amt : ");
p3.setBounds(560,310,250,30);
add(p3);
p4=new Label("Net Received :");
p4.setBounds(560,350,250,30);
add(p4);
p5=new Label("");
p5.setBounds(560,390,250,30);
add(p5);
ch=new Choice();
ch.setBounds(715,152,90,30);
add(ch);
ch.addItem("All");
ch.addItem("Gold");ch.addItem("Diamond");
ch.addItem("Silver");ch.addItem("Pearl");
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,15 );
ch.setFont(f);
b1=new Button("First");
b1.setBounds(305,450,50,20);
add(b1);
b1.setForeground(cl);
b1.setBackground(Color.black);
b2=new Button("Next");
b2.setBounds(360,450,50,20);
add(b2);
b2.setForeground(cl);
b2.setBackground(Color.black);
b3=new Button("Prev");
b3.setBounds(415,450,50,20);
add(b3);
b3.setForeground(cl);
b3.setBackground(Color.black);
b4=new Button("Last");
b4.setBounds(470,450,50,20);
add(b4);
b4.setForeground(cl);
b4.setBackground(Color.black);
ic=new ImageIcon("back_home.gif");
jb=new JButton(ic);
jb.setBounds(550,490,150,30);
add(jb);jb.setOpaque(true);jb.setBackground(Color.orange);
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver
(*.mdb)};DBQ=e:/wel/tanishq");
st=cn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
Page 139
rs=st.executeQuery("select * from customer where status='Sold'");
while(rs.next())
{cnt++;}
if(cnt==0)
{
l2.setText("Total Sold Items :"+" "+cnt);
JOptionPane.showMessageDialog((null),"No Records Found","Search
Fails",JOptionPane.INFORMATION_MESSAGE);i=0;
l3.setText("This is Record:"+""+i);
l8.setText("Dno :");
l9.setText("Dname :");
l10.setText("Dprice :");
ic=new ImageIcon("");
jl4.setIcon(ic);
c1.setText("Cno :");
c2.setText("Cname :");
c3.setText("Contactno:");
p1.setText("Pmode :");
p2.setText("Payment paid :");
p3.setText("Return Amt : ");
p4.setText("Net Received :");
p5.setText("");
b1.setEnabled(false);b2.setEnabled(false);b3.setEnabled(false);
b4.setEnabled(false);
}
else
{
rs.close();
rs=st.executeQuery("select * from customer where status='Sold'");
rs.absolute(1);
l2.setText("Total Sold Items :"+" "+cnt);i++;
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
ret=rs.getInt("Return");
if(mode.equals("Full"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("Payment paid :"+" "+rec);
p3.setText("Return Amt :"+" "+ret);
p4.setText("Net Received :"+" "+(rec-ret));
}
else if(mode.equals("Installment"))
Page 140
{
sinstall=rs.getInt("2ndInstallment");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Final installment :"+" "+sinstall);
p4.setText("Return Amt :"+" "+ret);
p5.setText("Net Received :"+" "+((rec+sinstall)-ret));
} b1.setEnabled(false);b2.setEnabled(true);b3.setEnabled(false);
b4.setEnabled(true);
}}
catch(Exception ex)
{System.out.println(ex);}
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
jb.addActionListener(this);
ch.addItemListener(this);
}
public void actionPerformed(ActionEvent ae)
{
try
{
if(ae.getSource()==b1)
{ i=1;
rs.absolute(i);
l2.setText("Total Sold Items :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
ret=rs.getInt("Return");
if(mode.equals("Full"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("Payment paid :"+" "+rec);
p3.setText("Return Amt :"+" "+ret);
p4.setText("Net Received :"+" "+(rec-ret));
p5.setText("");
}
else if(mode.equals("Installment"))
{
sinstall=rs.getInt("2ndInstallment");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
Page 141
p3.setText("Final installment :"+" "+sinstall);
p4.setText("Return Amt :"+" "+ret);
p5.setText("Net Received :"+" "+((rec+sinstall)-ret));
}
b1.setEnabled(false);b2.setEnabled(true);
b3.setEnabled(false);b4.setEnabled(true);
}
if(ae.getSource()==b2)
{
i++;
if(i<=cnt)
{
b1.setEnabled(true);b2.setEnabled(true);
b3.setEnabled(true);b4.setEnabled(true);
rs.absolute(i);
l2.setText("Total Sold Items :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
ret=rs.getInt("Return");
if(mode.equals("Full"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("Payment paid :"+" "+rec);
p3.setText("Return Amt :"+" "+ret);
p4.setText("Net Received :"+" "+(rec-ret));p5.setText("");
}
else if(mode.equals("Installment"))
{
sinstall=rs.getInt("2ndInstallment");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Final installment :"+" "+sinstall);
p4.setText("Return Amt :"+" "+ret);
p5.setText("Net Received :"+" "+((rec+sinstall)-ret));
}
if(i==cnt)
{
b2.setEnabled(false);b3.setEnabled(true);b4.setEnabled(false);
}
}}
if(ae.getSource()==b3)
{ i--;
if(i>0)
Page 142
{
b1.setEnabled(true);b2.setEnabled(true);b3.setEnabled(true);
b4.setEnabled(true);
rs.absolute(i);
l2.setText("Total Sold Items :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
ret=rs.getInt("Return");
if(mode.equals("Full"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("Payment paid :"+" "+rec);
p3.setText("Return Amt :"+" "+ret);
p4.setText("Net Received :"+" "+(rec-ret));
p5.setText("");
}
else if(mode.equals("Installment"))
{
sinstall=rs.getInt("2ndInstallment");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Final installment :"+" "+sinstall);
p4.setText("Return Amt :"+" "+ret);
p5.setText("Net Received :"+" "+((rec+sinstall)-ret));
}
if(i==1)
{
b1.setEnabled(false);b3.setEnabled(false);
}
}}
if(ae.getSource()==b4)
{
i=cnt;
rs.absolute(cnt);
l2.setText("Total Sold Items :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
Page 143
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
ret=rs.getInt("Return");
if(mode.equals("Full"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("Payment paid :"+" "+rec);
p3.setText("Return Amt :"+" "+ret);
p4.setText("Net Received :"+" "+(rec-ret));
p5.setText("");
}
else if(mode.equals("Installment"))
{
sinstall=rs.getInt("2ndInstallment");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Final installment :"+" "+sinstall);
p4.setText("Return Amt :"+" "+ret);
p5.setText("Net Received :"+" "+((rec+sinstall)-ret));
}
b1.setEnabled(true);b2.setEnabled(false);b3.setEnabled(true);
b4.setEnabled(false);
}
}
catch(Exception ex)
{System.out.println(ex);}
if(ae.getSource()==jb)
{
admin ob=new admin();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Admin");
dispose();
}
}
public void itemStateChanged(ItemEvent ae)
{
try
{
i=0;
cnt=0;
if(ch.getSelectedItem().equals("Gold"))
{
rs=st.executeQuery("select * from customer where Dname like 'Gold%' and status='Sold'");
while(rs.next())
{cnt++;}
if(cnt==0)
{
l2.setText("Total Sold Items :"+" "+cnt);i=0;
Page 144
l3.setText("This is Record:"+""+i);
JOptionPane.showMessageDialog((null),"No Records Found","Search Fails",JOptionPane.
INFORMATION_MESSAGE);
l8.setText("Dno :");
l9.setText("Dname :");
l10.setText("Dprice :");
ic=new ImageIcon("");
jl4.setIcon(ic);
c1.setText("Cno :");
c2.setText("Cname :");
c3.setText("Contactno:");
p1.setText("Pmode :");
p2.setText("Payment paid :");
p3.setText("Return Amt : ");
p4.setText("Net Received :");
p5.setText("");
b1.setEnabled(false);b2.setEnabled(false);b3.setEnabled(false);
b4.setEnabled(false);
}
else
{
rs.absolute(1);
i++;
l2.setText("Total Sold Items :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
ret=rs.getInt("Return");
if(mode.equals("Full"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("Payment paid :"+" "+rec);
p3.setText("Return Amt :"+" "+ret);
p4.setText("Net Received :"+" "+(rec-ret));
p5.setText("");
}
else if(mode.equals("Installment"))
{
sinstall=rs.getInt("2ndInstallment");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Final installment :"+" "+sinstall);
p4.setText("Return Amt :"+" "+ret);
p5.setText("Net Received :"+" "+((rec+sinstall)-ret));
Page 145
}
if(cnt==1)
{
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
b1.setEnabled(false);b2.setEnabled(true);
b3.setEnabled(false);b4.setEnabled(true);}
}
}
if(ch.getSelectedItem().equals("Diamond"))
{
rs=st.executeQuery("select * from customer where Dname like 'Diamond%' and status='Sold'");
while(rs.next())
{cnt++;}
if(cnt==0)
{
l2.setText("Total Sold Items :"+" "+cnt);i=0;
l3.setText("This is Record:"+""+i);
JOptionPane.showMessageDialog((null),"No Records Found","Search Fails",JOptionPane.
INFORMATION_MESSAGE);
l8.setText("Dno :");
l9.setText("Dname :");
l10.setText("Dprice :");
ic=new ImageIcon("");
jl4.setIcon(ic);
c1.setText("Cno :");
c2.setText("Cname :");
c3.setText("Contactno:");
p1.setText("Pmode :");
p2.setText("Payment paid :");
p3.setText("Return Amt : ");
p4.setText("Net Received :");
p5.setText("");
b1.setEnabled(false);b2.setEnabled(false);b3.setEnabled(false);
b4.setEnabled(false);
}
else
{
rs.absolute(1);
i++;
l2.setText("Total Sold Items :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
Page 146
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
ret=rs.getInt("Return");
if(mode.equals("Full"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("Payment paid :"+" "+rec);
p3.setText("Return Amt :"+" "+ret);
p4.setText("Net Received :"+" "+(rec-ret));
p5.setText("");
}
else if(mode.equals("Installment"))
{
sinstall=rs.getInt("2ndInstallment");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Final installment :"+" "+sinstall);
p4.setText("Return Amt :"+" "+ret);
p5.setText("Net Received :"+" "+((rec+sinstall)-ret));
}
if(cnt==1)
{
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
b1.setEnabled(false);b2.setEnabled(true);
b3.setEnabled(false);b4.setEnabled(true);}
}
}
if(ch.getSelectedItem().equals("Silver"))
{
rs=st.executeQuery("select * from customer where Dname like 'Silver%' and status='Sold'");
while(rs.next())
{cnt++;}
if(cnt==0)
{
l2.setText("Total Sold Items :"+" "+cnt);i=0;
l3.setText("This is Record:"+""+i);
JOptionPane.showMessageDialog((null),"No Records Found","Search Fails",JOptionPane.
INFORMATION_MESSAGE);
l8.setText("Dno :");
l9.setText("Dname :");
l10.setText("Dprice :");
ic=new ImageIcon("");
jl4.setIcon(ic);
c1.setText("Cno :");
c2.setText("Cname :");
c3.setText("Contactno:");
Page 147
p1.setText("Pmode :");
p2.setText("Payment paid :");
p3.setText("Return Amt : ");
p4.setText("Net Received :");
p5.setText("");
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
rs.absolute(1);
i++;
l2.setText("Total Sold Items :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
ret=rs.getInt("Return");
if(mode.equals("Full"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("Payment paid :"+" "+rec);
p3.setText("Return Amt :"+" "+ret);
p4.setText("Net Received :"+" "+(rec-ret));
p5.setText("");
}
else if(mode.equals("Installment"))
{
sinstall=rs.getInt("2ndInstallment");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Final installment :"+" "+sinstall);
p4.setText("Return Amt :"+" "+ret);
p5.setText("Net Received :"+" "+((rec+sinstall)-ret));
}
if(cnt==1)
{
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);}
else
{
b1.setEnabled(false);b2.setEnabled(true);
b3.setEnabled(false);b4.setEnabled(true);}
}
}
Page 148
if(ch.getSelectedItem().equals("Pearl"))
{
rs=st.executeQuery("select * from customer where Dname like 'Pearl%' and status='Sold'");
while(rs.next())
{cnt++;}
if(cnt==0)
{
l2.setText("Total Sold Items :"+" "+cnt);i=0;
l3.setText("This is Record:"+""+i);
JOptionPane.showMessageDialog((null),"No Records Found","Search Fails",JOptionPane.
INFORMATION_MESSAGE);
l8.setText("Dno :");
l9.setText("Dname :");
l10.setText("Dprice :");
ic=new ImageIcon("");
jl4.setIcon(ic);
c1.setText("Cno :");
c2.setText("Cname :");
c3.setText("Contactno:");
p1.setText("Pmode :");
p2.setText("Payment paid :");
p3.setText("Return Amt : ");
p4.setText("Net Received :");
p5.setText("");
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
rs.absolute(1);
i++;
l2.setText("Total Sold Items :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
ret=rs.getInt("Return");
if(mode.equals("Full"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("Payment paid :"+" "+rec);
p3.setText("Return Amt :"+" "+ret);
p4.setText("Net Received :"+" "+(rec-ret));
p5.setText("");
}
Page 149
else if(mode.equals("Installment"))
{
sinstall=rs.getInt("2ndInstallment");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Final installment :"+" "+sinstall);
p4.setText("Return Amt :"+" "+ret);
p5.setText("Net Received :"+" "+((rec+sinstall)-ret));
}
if(cnt==1)
{
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
b1.setEnabled(false);b2.setEnabled(true);
b3.setEnabled(false);b4.setEnabled(true);
}
}
}
if(ch.getSelectedItem().equals("All"))
{
rs=st.executeQuery("select * from customer where status='Sold'");
while(rs.next())
{cnt++;}
if(cnt==0)
{
l2.setText("Total Sold Items :"+" "+cnt);i=0;
l3.setText("This is Record:"+""+i);
JOptionPane.showMessageDialog((null),"No Records Found","Search Fails",JOptionPane.
INFORMATION_ MESSAGE);
l8.setText("Dno :");
l9.setText("Dname :");
l10.setText("Dprice :");
ic=new ImageIcon("");
jl4.setIcon(ic);
c1.setText("Cno :");
c2.setText("Cname :");
c3.setText("Contactno:");
p1.setText("Pmode :");
p2.setText("Payment paid :");
p3.setText("Return Amt : ");
p4.setText("Net Received :");
p5.setText("");
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
rs.absolute(1);
Page 150
i++;
l2.setText("Total Sold Items :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
ret=rs.getInt("Return");
if(mode.equals("Full"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("Payment paid :"+" "+rec);
p3.setText("Return Amt :"+" "+ret);
p4.setText("Net Received :"+" "+(rec-ret));
p5.setText("");
}
else if(mode.equals("Installment"))
{
sinstall=rs.getInt("2ndInstallment");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Final installment :"+" "+sinstall);
p4.setText("Return Amt :"+" "+ret);
p5.setText("Net Received :"+" "+((rec+sinstall)-ret));
}
if(cnt==1)
{
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
b1.setEnabled(false);b2.setEnabled(true);
b3.setEnabled(false);b4.setEnabled(true);
}
}}}
catch(Exception ex)
{System.out.println(ex);}
}}
Page 151
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
Page 152
l2=new Label("Total Records :");
l2.setBounds(15,150,200,30);
add(l2);
l2.setFont(f);
l3=new Label("This is Record:");
l3.setBounds(285,150,170,30);
add(l3);
l3.setFont(f);
l4=new Label("view by category:");
l4.setBounds(560,150,155,30);
add(l4);
l4.setFont(f);
l5=new Label("Design Info:-");
l5.setBounds(15,190,150,30);
add(l5);l5.setForeground(Color.blue);
l5.setFont(f);
l6=new Label("Customer Info:-");
l6.setBounds(285,190,150,30);
add(l6);l6.setForeground(Color.blue);
l6.setFont(f);
l7=new Label("Payment Info:-");
l7.setBounds(560,190,150,30);
add(l7);l7.setForeground(Color.blue);
l7.setFont(f);
l8=new Label("Dno :");
l8.setBounds(15,230,250,30);
add(l8);
f=new Font("New Times Roman",Font.BOLD,15 );
setFont(f);
l9=new Label("Dname :");
l9.setBounds(15,270,250,30);
add(l9);
l10=new Label("Dprice :");
l10.setBounds(15,310,250,30);
add(l10);
l11=new Label("Dimg :");
l11.setBounds(15,350,100,30);
add(l11);
jl4=new JLabel("");
jl4.setBounds(20,350,250,250);
add(jl4);
c1=new Label("Cno :");
c1.setBounds(285,230,250,30);
add(c1);
c2=new Label("Cname :");
c2.setBounds(285,270,270,30);
add(c2);
c3=new Label("Contactno:");
c3.setBounds(285,310,250,30);
add(c3);
p1=new Label("Pmode :");
p1.setBounds(560,230,250,30);
Page 153
add(p1);
p2=new Label("1st installment :");
p2.setBounds(560,270,270,30);
add(p2);
p3=new Label("Due Balance :");
p3.setBounds(560,310,250,30);
add(p3);
p4=new Label("");
p4.setBounds(560,350,250,30);
add(p4);
p5=new Label("");
p5.setBounds(560,390,250,30);
add(p5);
p6=new Label("");
p6.setBounds(560,430,250,30);
add(p6);
if(str.equals("Cancel Order"))
{
cl=new Color(220,120,125);
setBackground(cl);
ic=new ImageIcon("logo1.jpg");
jl1.setIcon(ic);
jl2.setIcon(ic);
p4.setText("Penalty 30% :");
p5.setText("Return Amt :");
p6.setText("Net Received :");
}
ch=new Choice();
ch.setBounds(715,152,90,30);
add(ch);
ch.addItem("All");ch.addItem("Gold");ch.addItem("Diamond");
ch.addItem("Silver");ch.addItem("Pearl");
f=new Font("New Times Roman",Font.BOLD|Font.ITALIC,15 );
ch.setFont(f);
b1=new Button("First");
b1.setBounds(305,450,50,20);
add(b1);
b1.setForeground(cl);
b1.setBackground(Color.black);
b2=new Button("Next");
b2.setBounds(360,450,50,20);
add(b2);
b2.setForeground(cl);
b2.setBackground(Color.black);
b3=new Button("Prev");
b3.setBounds(415,450,50,20);
add(b3);
b3.setForeground(cl);
b3.setBackground(Color.black);
b4=new Button("Last");
b4.setBounds(470,450,50,20);
add(b4);
Page 154
b4.setForeground(cl);
b4.setBackground(Color.black);
ic=new ImageIcon("back_home.gif");
jb=new JButton(ic);
jb.setBounds(550,490,150,30);
add(jb);jb.setOpaque(true);jb.setBackground(Color.orange);
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver
(*.mdb)};DBQ=e:/wel/tanishq");
st=cn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
if(str.equals("On Order"))
{
rs=st.executeQuery("select * from customer where status='On Order'");
}
else if(str.equals("Cancel Order"))
{
rs=st.executeQuery("select * from customer where status='Order Cancel'");
}
while(rs.next())
{cnt++;}
if(cnt==0)
{
l2.setText("Total Records :"+" "+cnt);
JOptionPane.showMessageDialog((null),"No Records Found","Search
Fails",JOptionPane.INFORMATION_MESSAGE);i=0;
l3.setText("This is Record:"+""+i);
l8.setText("Dno :");
l9.setText("Dname :");
l10.setText("Dprice :");
ic=new ImageIcon("");
jl4.setIcon(ic);
c1.setText("Cno :");
c2.setText("Cname :");
c3.setText("Contactno:");
p1.setText("Pmode :");
p2.setText("1st installment :");
p3.setText("Due Balance :");
p4.setText("");p5.setText("");p6.setText("");
if(str.equals("Cancel Order"))
{
p4.setText("Penalty 30% :");
p5.setText("Return Amt :");
p6.setText("Net Received :");
}
b1.setEnabled(false);b2.setEnabled(false);b3.setEnabled(false);
b4.setEnabled(false);
}
else
{
Page 155
rs.absolute(1);
l2.setText("Total Records :"+" "+cnt);i++;
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
bal=rs.getInt("Balance");
ret=rs.getInt("Return");
if(str.equals("On Order"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("");p5.setText("");p6.setText("");
}
else if(str.equals("Cancel Order"))
{
penalty=rs.getInt("Penalty");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("Penalty 30% :"+" "+penalty);
p5.setText("Return Amt :"+" "+ret);
p6.setText("Net Received :"+" "+(rec-ret));
} b1.setEnabled(false);b2.setEnabled(true);b3.setEnabled(false);
b4.setEnabled(true);
}}
catch(Exception ex)
{System.out.println(ex);}
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
jb.addActionListener(this);
ch.addItemListener(this);
}
public void actionPerformed(ActionEvent ae)
{
try
{
if(ae.getSource()==b1)
{
i=1;
rs.absolute(i);
l2.setText("Total Records :"+" "+cnt);
Page 156
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
bal=rs.getInt("Balance");
ret=rs.getInt("Return");
if(str.equals("On Order"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("");p5.setText("");p6.setText("");
}
else if(str.equals("Cancel Order"))
{
penalty=rs.getInt("Penalty");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("Penalty 30% :"+" "+penalty);
p5.setText("Return Amt :"+" "+ret);
p6.setText("Net Received :"+" "+(rec-ret));
} b1.setEnabled(false);b2.setEnabled(true);b3.setEnabled(false);
b4.setEnabled(true);
}
if(ae.getSource()==b2)
{
i++;
if(i<=cnt)
{ b1.setEnabled(true);b2.setEnabled(true);b3.setEnabled(true);
b4.setEnabled(true);
rs.absolute(i);
l2.setText("Total Records :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
Page 157
bal=rs.getInt("Balance");
ret=rs.getInt("Return");
if(str.equals("On Order"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("");p5.setText("");p6.setText("");
}
else if(str.equals("Cancel Order"))
{
penalty=rs.getInt("Penalty");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("Penalty 30% :"+" "+penalty);
p5.setText("Return Amt :"+" "+ret);
p6.setText("Net Received :"+" "+(rec-ret));
}
if(i==cnt)
{
b2.setEnabled(false);b3.setEnabled(true);b4.setEnabled(false);
}}}
if(ae.getSource()==b3)
{
i--;
if(i>0)
{
b1.setEnabled(true);b2.setEnabled(true);b3.setEnabled(true);
b4.setEnabled(true);
rs.absolute(i);
l2.setText("Total Records :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
bal=rs.getInt("Balance");
ret=rs.getInt("Return");
if(str.equals("On Order"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("");p5.setText("");p6.setText("");
}
Page 158
else if(str.equals("Cancel Order"))
{
penalty=rs.getInt("Penalty");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("Penalty 30% :"+" "+penalty);
p5.setText("Return Amt :"+" "+ret);
p6.setText("Net Received :"+" "+(rec-ret));
}
if(i==1)
{
b1.setEnabled(false);b3.setEnabled(false);
}
}}
if(ae.getSource()==b4)
{
i=cnt;
rs.absolute(cnt);
l2.setText("Total Records :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
bal=rs.getInt("Balance");
ret=rs.getInt("Return");
if(str.equals("On Order"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("");p5.setText("");p6.setText("");
}
else if(str.equals("Cancel Order"))
{
penalty=rs.getInt("Penalty");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("Penalty 30% :"+" "+penalty);
p5.setText("Return Amt :"+" "+ret);
p6.setText("Net Received :"+" "+(rec-ret));
}
b1.setEnabled(true);b2.setEnabled(false);b3.setEnabled(true);
b4.setEnabled(false);
Page 159
}}
catch(Exception ex)
{System.out.println(ex);}
if(ae.getSource()==jb)
{ admin ob=new admin();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Admin");
dispose();
}}
public void itemStateChanged(ItemEvent ae)
{
try
{
i=0;
cnt=0;
if(ch.getSelectedItem().equals("Gold"))
{
if(str.equals("On Order"))
{
rs=st.executeQuery("select * from customer where status='On Order' and Dname like 'Gold%'");
}
else if(str.equals("Cancel Order"))
{
rs=st.executeQuery("select * from customer where status='Order Cancel'and Dname like 'Gold
%'");
}
while(rs.next())
{cnt++;}
if(cnt==0)
{
l2.setText("Total Sold Items :"+" "+cnt);i=0;
l3.setText("This is Record:"+""+i);
JOptionPane.showMessageDialog((null),"No Records Found","Search Fails",JOptionPane .
INFORMATION_MESSAGE);
l8.setText("Dno :");
l9.setText("Dname :");
l10.setText("Dprice :");
ic=new ImageIcon("");
jl4.setIcon(ic);
c1.setText("Cno :");
c2.setText("Cname :");
c3.setText("Contactno:");
p1.setText("Pmode :");
p2.setText("1st installment :");
p3.setText("Due Balance :");
p4.setText("");p5.setText("");p6.setText("");
if(str.equals("Cancel Order"))
{
p4.setText("Penalty 30% :");
p5.setText("Return Amt :");
p6.setText("Net Received :");
Page 160
}
b1.setEnabled(false);b2.setEnabled(false);b3.setEnabled(false);
b4.setEnabled(false);
}
else
{
rs.absolute(1);
i++;
l2.setText("Total Records :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
bal=rs.getInt("Balance");
ret=rs.getInt("Return");
if(str.equals("On Order"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("");p5.setText("");p6.setText("");
}
else if(str.equals("Cancel Order"))
{
penalty=rs.getInt("Penalty");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("Penalty 30% :"+" "+penalty);
p5.setText("Return Amt :"+" "+ret);
p6.setText("Net Received :"+" "+(rec-ret));
}
if(cnt==1)
{
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
b1.setEnabled(false);b2.setEnabled(true);
b3.setEnabled(false);b4.setEnabled(true);}
}}
if(ch.getSelectedItem().equals("Diamond"))
{
if(str.equals("On Order"))
Page 161
{
rs=st.executeQuery("select * from customer where status='On Order' and Dname
like 'Diamond%'");
}
else if(str.equals("Cancel Order"))
{
rs=st.executeQuery("select * from customer where
status='Order Cancel'and Dname like 'Diamond%'");
}
while(rs.next())
{cnt++;}
if(cnt==0)
{
l2.setText("Total Sold Items :"+" "+cnt);i=0;
l3.setText("This is Record:"+""+i);
JOptionPane.showMessageDialog((null),"No Records Found","Search
Fails",JOptionPane.INFORMATION_MESSAGE);
l8.setText("Dno :");
l9.setText("Dname :");
l10.setText("Dprice :");
ic=new ImageIcon("");
jl4.setIcon(ic);
c1.setText("Cno :");
c2.setText("Cname :");
c3.setText("Contactno:");
p1.setText("Pmode :");
p2.setText("1st installment :");
p3.setText("Due Balance :");
p4.setText("");p5.setText("");p6.setText("");
if(str.equals("Cancel Order"))
{
p4.setText("Penalty 30% :");
p5.setText("Return Amt :");
p6.setText("Net Received :");
}
b1.setEnabled(false);b2.setEnabled(false);b3.setEnabled(false);
b4.setEnabled(false);
}
else
{
rs.absolute(1);
i++;
l2.setText("Total Records :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
Page 162
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
bal=rs.getInt("Balance");
ret=rs.getInt("Return");
if(str.equals("On Order"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("");p5.setText("");p6.setText("");
}
else if(str.equals("Cancel Order"))
{
penalty=rs.getInt("Penalty");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("Penalty 30% :"+" "+penalty);
p5.setText("Return Amt :"+" "+ret);
p6.setText("Net Received :"+" "+(rec-ret));
}
if(cnt==1)
{
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
b1.setEnabled(false);b2.setEnabled(true);
b3.setEnabled(false);b4.setEnabled(true);
}}}
if(ch.getSelectedItem().equals("Silver"))
{
if(str.equals("On Order"))
{
rs=st.executeQuery("select * from customer where status='On
Order' and Dname like 'Silver%'");
}
else if(str.equals("Cancel Order"))
{
rs=st.executeQuery("select * from customer where
status='Order Cancel'and Dname like 'Silver%'");
}
while(rs.next())
{cnt++;}
if(cnt==0)
{
l2.setText("Total Sold Items :"+" "+cnt);i=0;
l3.setText("This is Record:"+""+i);
JOptionPane.showMessageDialog((null),"No Records Found",
"Search Fails",JOptionPane.INFORMATION_MESSAGE);
l8.setText("Dno :");
Page 163
l9.setText("Dname :");
l10.setText("Dprice :");
ic=new ImageIcon("");
jl4.setIcon(ic);
c1.setText("Cno :");
c2.setText("Cname :");
c3.setText("Contactno:");
p1.setText("Pmode :");
p2.setText("1st installment :");
p3.setText("Due Balance :");
p4.setText("");p5.setText("");p6.setText("");
if(str.equals("Cancel Order"))
{
p4.setText("Penalty 30% :");
p5.setText("Return Amt :");
p6.setText("Net Received :");
}
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
rs.absolute(1);
i++;
l2.setText("Total Records :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
bal=rs.getInt("Balance");
ret=rs.getInt("Return");
if(str.equals("On Order"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("");p5.setText("");p6.setText("");
}
else if(str.equals("Cancel Order"))
{
penalty=rs.getInt("Penalty");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("Penalty 30% :"+" "+penalty);
Page 164
p5.setText("Return Amt :"+" "+ret);
p6.setText("Net Received :"+" "+(rec-ret));
}
if(cnt==1)
{
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
b1.setEnabled(false);b2.setEnabled(true);
b3.setEnabled(false);b4.setEnabled(true);
}}}
if(ch.getSelectedItem().equals("Pearl"))
{
if(str.equals("On Order"))
{
rs=st.executeQuery("select * from customer where status='On
Order' and Dname like 'Pearl%'");
}
else if(str.equals("Cancel Order"))
{
rs=st.executeQuery("select * from customer where
status='Order Cancel'and Dname like 'Pearl%'");
}
while(rs.next())
{cnt++;}
if(cnt==0)
{
l2.setText("Total Sold Items :"+" "+cnt);i=0;
l3.setText("This is Record:"+""+i);
JOptionPane.showMessageDialog((null),"No Records Found","Search
Fails",JOptionPane.INFORMATION_MESSAGE);
l8.setText("Dno :");
l9.setText("Dname :");
l10.setText("Dprice :");
ic=new ImageIcon("");
jl4.setIcon(ic);
c1.setText("Cno :");
c2.setText("Cname :");
c3.setText("Contactno:");
p1.setText("Pmode :");
p2.setText("1st installment :");
p3.setText("Due Balance :");
p4.setText("");p5.setText("");p6.setText("");
if(str.equals("Cancel Order"))
{
p4.setText("Penalty 30% :");
p5.setText("Return Amt :");
p6.setText("Net Received :");
}
b1.setEnabled(false);b2.setEnabled(false);
Page 165
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
rs.absolute(1);
i++;
l2.setText("Total Records :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
rec=rs.getInt("ReceivedAmount");
bal=rs.getInt("Balance");
ret=rs.getInt("Return");
if(str.equals("On Order"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("");p5.setText("");p6.setText("");
}
else if(str.equals("Cancel Order"))
{
penalty=rs.getInt("Penalty");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("Penalty 30% :"+" "+penalty);
p5.setText("Return Amt :"+" "+ret);
p6.setText("Net Received :"+" "+(rec-ret));
}
if(cnt==1)
{
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
b1.setEnabled(false);b2.setEnabled(true);
b3.setEnabled(false);b4.setEnabled(true);
}}}
if(ch.getSelectedItem().equals("All"))
{
if(str.equals("On Order"))
{
Page 166
rs=st.executeQuery("select * from customer where status='On
Order'");
}
else if(str.equals("Cancel Order"))
{
rs=st.executeQuery("select * from customer where
status='Order Cancel'");
}
while(rs.next())
{cnt++;}
if(cnt==0)
{
l2.setText("Total Sold Items :"+" "+cnt);i=0;
l3.setText("This is Record:"+""+i);
JOptionPane.showMessageDialog((null),"No Records Found","Search Fails",JOptionPane.
INFORMATION_MESSAGE);
l8.setText("Dno :");
l9.setText("Dname :");
l10.setText("Dprice :");
ic=new ImageIcon("");
jl4.setIcon(ic);
c1.setText("Cno :");
c2.setText("Cname :");
c3.setText("Contactno:");
p1.setText("Pmode :");
p2.setText("1st installment :");
p3.setText("Due Balance :");
p4.setText("");p5.setText("");p6.setText("");
if(str.equals("Cancel Order"))
{
p4.setText("Penalty 30% :");
p5.setText("Return Amt :");
p6.setText("Net Received :");
}
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
rs.absolute(1);
i++;
l2.setText("Total Records :"+" "+cnt);
l3.setText("This is Record:"+""+i);
l8.setText("Dno :"+""+rs.getString("Dno"));
l9.setText("Dname :"+""+rs.getString("Dname"));
l10.setText("Dprice :"+""+rs.getString("Dprice"));
ic=new ImageIcon(rs.getString("Dimg"));
jl4.setIcon(ic);
c1.setText("Cno :"+" "+rs.getString("Cid"));
c2.setText("Cname :"+" "+rs.getString("Cname"));
c3.setText("Contactno:"+" "+rs.getString("Contactno"));
mode=rs.getString("Mode");
Page 167
rec=rs.getInt("ReceivedAmount");
bal=rs.getInt("Balance");
ret=rs.getInt("Return");
if(str.equals("On Order"))
{
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("");p5.setText("");p6.setText("");
}
else if(str.equals("Cancel Order"))
{
penalty=rs.getInt("Penalty");
p1.setText("Pmode :"+" "+mode);
p2.setText("1st installment :"+" "+rec);
p3.setText("Due Balance :"+" "+bal);
p4.setText("Penalty 30% :"+" "+penalty);
p5.setText("Return Amt :"+" "+ret);
p6.setText("Net Received :"+" "+(rec-ret));
}
if(cnt==1)
{
b1.setEnabled(false);b2.setEnabled(false);
b3.setEnabled(false);b4.setEnabled(false);
}
else
{
b1.setEnabled(false);b2.setEnabled(true);
b3.setEnabled(false);b4.setEnabled(true);
}
}
}}
catch(Exception ex)
{System.out.println(ex);}
}
}
Page 168
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class aboutus extends Frame implements ActionListener
{
Label l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11;
Button b1;
Color cl;
Font f;
Image img;
String st,st1;
aboutus(String name,String name1)
{
cl=new Color(255,215,215);
setBackground(cl);
setLayout(null);
st=name;st1=name1;
img=Toolkit.getDefaultToolkit().getImage("uni2.jpg");
f=new Font("Baskerville Old Face",Font.BOLD,32);
l1=new Label("LOVELY PROFESSIONAL UNIVERSITY");
l1.setBounds(130,50,525,50);
add(l1);
l1.setFont(f);
f=new Font("Baskerville Old Face",Font.BOLD,22);
setFont(f);
l2=new Label("PROJECT ON : JEWELLERY SHOP MANAGEMENT");
l2.setBounds(120,170,560,30);
add(l2);
l2.setForeground(Color.blue);
l3=new Label("FRONT-END : ADVANCE JAVA (JDK1.6)");
l3.setBounds(120,230,560,30);
add(l3);
l3.setForeground(Color.blue);
l4=new Label("BACK-END : MS-ACCESS(2003)");
l4.setBounds(120,290,560,30);
add(l4);
l4.setForeground(Color.blue);
l5=new Label("Submitted By:-");
l5.setBounds(70,400,150,30);
add(l5);
l6=new Label("NAME : Dheeraj Sharma ");
l6.setBounds(70,440,250,25);
add(l6);
f=new Font("Baskerville Old Face",Font.BOLD,18);
l6.setFont(f);
Page 169
l7=new Label("COURSE : MCA (Sem-VI)");
l7.setBounds(70,470,250,25);
add(l7);
l7.setFont(f);
l8=new Label("ROLL NO : ");
l8.setBounds(70,495,250,25);
add(l8);
l8.setFont(f);
l9=new Label("Submitted To:-");
l9.setBounds(400,400,150,30);
add(l9);
l10=new Label("MR. RAKESH GUPTA");
l10.setBounds(400,440,250,25);
add(l10);
l10.setFont(f);
l11=new Label("(HOD)");
l11.setBounds(400,470,330,25);
add(l11);
l11.setFont(f);
b1=new Button("Thanks");
b1.setBounds(340,510,100,30);
add(b1);
cl=new Color(250,140,140);
b1.setBackground(cl);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(st.equalsIgnoreCase("Admin"))
{
admin ob=new admin();
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Admin");
dispose();
}
else if(st.equalsIgnoreCase("home"))
{
home ob=new home(st1);
ob.setExtendedState(Frame.MAXIMIZED_BOTH);
ob.setVisible(true);
ob.setTitle("Home");
dispose();
} }
public void paint(Graphics g)
{
g.drawImage(img,40,40,this);
g.drawImage(img,680,40,this);
g.setColor(Color.black);
g.drawLine(150,105,625,105);
}}
Page 170
8. TESTING
Page 171
Software Testing :-
Levels of Testing:
Unit Testing
Integration Testing
System Testing
Acceptance Testing
Page 172
9. CONCLUSION & ENHANCEMENT
Page 173
CONCLUSION & ENHANCEMENT
Page 174
10. BIBLIOGRAPHY
Page 175
BIBLIOGRAPHY
AG98
Ken Arnold and James Gosling.
The Java Programming Language,second ed.,Addison Wesley,1998.
Peter Norton’s Guide to Java Programming
William R. Stanek,Peter Norton.
Java 2 Black Book
By Steve Holzner.
Java in a Nutshell
David Flanagan: java in a Nutshell 4th edition. O’Reilly,2002(cover
java 1.4).
Java Puzzlers
By Joshua Bloch.
Page 176
Page 177