Java Project
Java Project
ON
GPF MANAGEMENT
SYSTEM
OF
BIHAR STATE ELECTRICITY
BOARD
DEVELOPED BY:-
Richa (87)
CERTIFICATE OF APPROVAL
…………………………………………….. ……………………………………………..
……………………………………………..
CO-ORDINATOR
DECLARATION
SUBMITTED BY:
ACKNOWLEDMENT
I would like to thank our principal Dr. Sister DORIS D’SOUZA whose friendly,
cooperative and inspirational
Words always helped us to complete the project in the best manner . I would
also like to thank our coordinator mam ‘ Mrs. APRAJITA KRISHNA’ for
providing us the best environment required for the proper completion of a full-
pledged project . our endeavor is also gift of faculties members who taught us
the basics of the subject in friendly and supportive way.
Last but not the least ; I would like to thank our seniors whose tips of making a
good project can’t be ignored.
PEFACE
I have made this software under the demand of the BCA course to
undergo On-Job-Training in the final year . Training can be done by
any private or public sector organization where I can employ all the
studied computer languages and the tools. The objective of the
training is that the students should experience or gain the practical
knowledge of working environment and I have gained this very
experience from B.S.E.B , Bailey road ,Patna.
The project incharge has given us the responsibility of developing
‘GPF MANAGEMENT SYSTEM’ We made a study and overviewed the
section . We have gathered necessary and relevant information
regarding the section with the cordial support of the project
incharge.
“GPF Management System” is the outcome of that proposal. The
frontend used in its development is java(jdk 1.5.0) and SQL Server
2005 , the RDBMS package, as the backend.
The project contains information about organization, provides
general provident fund,software for the employee information in
B.S.E.B. department and other details using the latest facilities as well
as following the sequential actions of the different phases in the
system development life cycle.
Contents
Pag
e No
1. INTRODUCTION 7-17
2. FEASIBILITY STUDY 18-20
3. INITIAL INVESTIGATION 21-24
4. SYSTEM ANALYSIS 25-35
5. CODING AND SYSTEM DESIGN 36-249
6. SYSTEM TESTING AND 250-254
IMPLEMENTATION
7. RUN TIME WINDOWS 255-281
8. PROJECT MAINTAINANCE 279-282
9. BIBLIOGRAPHY 283-285
INTRODUCTION
About BSEB
ABOUT MY PROJECT
OBJECTIVES
The system provide queries and reliable at all level at any point
of time.
ABOUT WINDOW XP
Minimum Recommended
Processor 233MHz 300 MHz /higher
Memory 64 MB RAM 128 MB RAM / higher
Video adapter Super VGA(800 x 600) or higher
and monitor resolution
Hard drive disk 1.5 GB or higher
Free spaces
Drives CD-ROM DRIVE or DVD DRIVE
Input devices Keyboard,Mouse or any compatible
pointing device
Sound Sound cards,Speakers or head
phones
Introduction
Platform Independent
Network based architectures involve multiple hardware and
software plarforms and sql server delivers on all the major
platforms.
Client-Server Architecture
It is good to store data on server and provide facilities to access
data with restricted permission to the client. This feature can be
easily developed to SQL Server’s database.
ABOUT JAVA
Introduction
Features:
(1) Simple: -
Java is a simple language that can be learned easily. A java
programmer does not need to know the internal details of java as to
how memory is allocated to data because in java , the programmer
does not need to handle memory manipulation.
(2) Object-oriented:-
Java supports the object-oriented approach to develop
programs.It supports various features of an object-oriented language,
such as abstraction , encapsulation , and polymorphism. The java
language does not support stand-alone statements.
(3) Compiled and Interpreted:-
Java has built-in security features that verify that the program
do not perform any destructive task, such as accessing the files
on a remote system. Java does not allow the use of explicit
pointers , which are used to refer to the memory locations in a
c++ program. All references to the memory are symbolic
references, which means that the programs cannot access
memory locations without proper authorization.
FEASIBILITY
STUDY
FEASIBILITY STUDY
INTRODUCTION
Economic Feasibility
INITIAL
INVESTIGATION
Feasibility
Study
Analysis
Design
Coding
Testing
Implement
ation
Maintenance
SYSTEM
ANALYSIS
EXISTING SYSTEM
PROPOSED SYSTEM
ENTITY-RELATIONSHIP DIAGRAM
Designatio
n
GPF
Addres Month
contributo
s
n
Name Employe
Employe
e code DA
e code
Volume
GE PAY GIVE
T N
Date Balanc
Balanc Balance
Date of e (B/F)
e (C/F)
Employe of refun
e code issue d
Employe
Insatllmen LOAN
e code
tamount REFUND
GPF
MANAGEMENT
SYSTEM
Employee Administrator
Level-0 DFD
LEVEL-1 DFD
INTEND
1.0
ERROR MESSAGE REGISTRATION EMPINFO-DETAILS
LOAN-DETAILS
1.1
PROVIDE
LOAN
1.2
GPF
CALCULATION
1.4
GPF-DETAILS
REFUND
REFUND-DETAILS
Administrator module
Employee detail module
GPF calculation module
Loan module
Refund module
Administrator Module
The administrator module is basically designed for security purposes,
by which an authorized person of the company can access the data,
which has the permission to access the software by giving username,
password that means the information of the company is locked, by
username and password to protect from unauthorized accessibility.
Employee Details Module
The employee details module is designed for keeping the information
of employees. It keeps the basic information of a employee like
name, date of joining , address , designation , basic salary , nominee
names etc.
CODING IN SQL
1. User
create table user
(
User_id Varchar(10),
User_passwd Varchar(20),
User_post Varchar(20)
);
2. Empinfo
M_status varchar(10),
S_name varchar(30),
Add Varchar(40),
Add1 Varchar(40),
basic float(6),
Idmark Varchar(20),
N_1name Varchar(30),
N_2name Varchar(30),
N_3name Varchar(30),
N_1age Varchar(2),
N_2age Varchar(2),
N_3age Varchar(2),
N_1relation Varchar(10),
N_2relation Varchar(10),
N_3relation varchar(10),
N_1pa int,
N_2pa int,
N_3pa int
);
3. gpf
create table gpf
(
Acno Varchar(6),
Date Date,
Contributed float(6),
DA float(6),
);
4. loan
create table loan
PATNA WOMEN’S COLLEGE Page 39
GPF MANAGMENT SYSTEM
(
Acno varchar(6),
Date date,
L_TYPE varchar(15),
L_amount float(6),
I_NO INT,
I_amount float(6),
Remarks varchar(20)
);
5. refund
create table refund
(
Acno varchar(6),
Date date,
R_amt float(6),
Balance float(6)
);
6. GPFSUMMARY
create table GPFSUMMARY
(
Acno varchar(6),
GPF_B_F float,
G_C float,
Interest int,
PATNA WOMEN’S COLLEGE Page 40
GPF MANAGMENT SYSTEM
Tot float,
G_total float
);
CODE FOR
LOGIN FORM
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
PATNA WOMEN’S COLLEGE Page 41
GPF MANAGMENT SYSTEM
import java.sql.*;
public class Login extends JFrame implements
ActionListener,Runnable
{
boolean pflag = false;
Thread thread1;
Connection cn;
PreparedStatement stmt;
ResultSet rs;
JScrollPane scrollPane;
GridBagLayout gb1 = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
JLabel lblhead = new JLabel("LOGIN
FOrm",JLabel.CENTER);
JPanel pnl = new JPanel(new GridLayout(1,3,10,20));
ImageIcon im = new ImageIcon("icon_sign.gif");
JLabel i = new JLabel(im,JLabel.LEFT);
ImageIcon logo = new ImageIcon("bseb-logo.jpg");
JLabel l = new JLabel(logo,JLabel.RIGHT);
JPanel pn = new JPanel(new GridLayout(1,15,5,10));
JTextField txtuid= new JTextField(10);
JPasswordField txtpwd = new JPasswordField(10);
panel1.add(lblhead);
panel1.add(l);
panel1.setBackground(Color.WHITE);
lblhead.setFont(new Font("Times",Font.BOLD,20));
addcomp(1,0,1,1,new JLabel(" "),panel);
addcomp(2,0,1,1,new JLabel("USER ID"),panel);
addcomp(2,1,1,1,txtuid,panel);
addcomp(2,2,1,1,new JLabel(" "),panel);
addcomp(3,0,1,1,new JLabel("PASSWORD"),panel);
addcomp(3,1,1,1,txtpwd,panel);
addcomp(3,2,1,1,new JLabel(""),panel);
txtpwd.setEchoChar('*');
addcomp(4,0,110,0,pb,panel);
pb.setStringPainted(true);
pb.setForeground(Color.pink);
add(pn,BorderLayout.SOUTH);
pn.add(new JLabel(" "));
pn.add(login);
login.addActionListener(this);
pn.add(exit);
exit.addActionListener(this);
pn.add(create);
create.addActionListener(this);
pn.add(new JLabel(""));
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(Exception ex)
{
JOptionPane.showMessageDialog(this,ex.toString());
}
setLocation(50,50);
setSize(500,400);
setTitle("LOGIN FORM");
setVisible(true);
}
public void addcomp(int row,int col,int wide,int
high,Component c , Container cn)
{
gbc.gridx = col;
gbc.gridy = row;
gbc.gridheight = high;
gbc.gridwidth = wide;
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx=1;
gbc.weighty=1;
gbc.insets = new Insets(2,2,2,2);
gb1.setConstraints(c,gbc);
cn.add(c);
if(c instanceof JButton)
((JButton)c).addActionListener(this);
}
public void actionPerformed(ActionEvent a)
{
if(a.getSource()==exit)
dispose();
if(a.getSource()==create)
{
this.dispose();
createuser usr= new createuser();
usr.setBounds(325,170,600,400);
}
if(a.getSource()==login)
{
thread1 = new Thread(this);
pb.setValue(0);
pflag = true;
thread1.start();
}
}
public void run()
{
try
{
while(pflag)
{
if(pb.getValue()<100)
{
pb.setValue(pb.getValue()+5);
Thread.sleep(400);
}
else
{
pflag=false;
String uid = "",pwd="";
try
{
cn=DriverManager.getConnection("jdbc:odbc:MYDATASOURC
E2","sa","kankarbagh");
stmt=cn.prepareStatement("select * from ACCOUNT where
username=? and password =?");
stmt.setString(1,txtuid.getText().trim());
stmt.setString(2,txtpwd.getText().trim());
ResultSet rs=stmt.executeQuery();
if(!rs.next())
{
JOptionPane.showMessageDialog(this,"UserId or password is
invalid");
txtuid.setText("");
txtpwd.setText("");
txtuid.requestFocus();
}
else
{
JOptionPane.showMessageDialog(this,"Welcome
"+rs.getString(1));
new Menu();
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
}
}
catch(InterruptedException e)
{
}
pb.setValue(0);
}
public static void main(String args[ ])
{
login obj = new login();
}
}
import java.awt.*;
import java.sql.*;
import javax.swing.*;
import java.awt.event.*;
public class createuser extends JFrame implements
ActionListener
{
Connection cn;
Statement stmt;
ResultSet rs;
PATNA WOMEN’S COLLEGE Page 50
GPF MANAGMENT SYSTEM
JScrollPane scrollpane;
GridBagLayout gb1= new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
JLabel head = new JLabel("CREATE USER",JLabel.CENTER);
JPanel panel = new JPanel(new GridLayout(1,1,10,10));
ImageIcon logo = new ImageIcon("bseb-logo.jpg");
JLabel i = new JLabel(logo,JLabel.LEFT);
JLabel admin = new JLabel("ADMINISTRATOR ID");
JTextField tadmin = new JTextField(15);
JLabel password = new JLabel("PASSWORD");
JPasswordField tpassword = new JPasswordField(15);
JButton ok = new JButton("OK");
JLabel user = new JLabel(" USER NAME");
JTextField tuser = new JTextField(15);
JLabel userpwd = new JLabel(" PASSWORD");
JPasswordField tuserpwd = new JPasswordField(15);
JLabel confirmpwd = new JLabel("CONFIRM PASSWORD");
JPasswordField tconfirmpwd = new JPasswordField(15);
JLabel post = new JLabel(" POST");
JTextField tpost = new JTextField(15);
JButton search = new JButton("SEARCH");
JButton create = new JButton("CREATE");
addcomp(1,0,1,1, admin,panel);
addcomp(1,1,1,1,tadmin,panel);
addcomp(1,2,1,1,password,panel);
addcomp(1,3,1,1,tpassword,panel);
addcomp(2,3,1,1,ok,panel);
add(pnl,BorderLayout.SOUTH);
pnl.add(new JLabel(" "));
pnl.add(cancel);
cancel.addActionListener(this);
pnl.add(create);
create.addActionListener(this);
pnl.add(new JLabel(" "));
user.setEnabled(false);
tuser.setEnabled(false);
userpwd.setEnabled(false);
tuserpwd.setEnabled(false);
confirmpwd.setEnabled(false);
confirmpwd.setEnabled(false);
post.setEnabled(false);
tpost.setEnabled(false);
addcomp(3,0,1,1,user,panel);
addcomp(3,1,1,1,tuser,panel);
addcomp(4,0,1,1,userpwd,panel);
addcomp(4,1,1,1,tuserpwd,panel);
addcomp(5,0,1,1,confirmpwd,panel);
addcomp(5,1,1,1,tconfirmpwd,panel);
addcomp(6,0,1,1,post,panel);
addcomp(6,1,1,1,tpost,panel);
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}
catch(Exception ex)
{
JOptionPane.showMessageDialog(this,ex.toString());
}
setTitle("CREATE NEW USER");
setLocation(50,50);
setSize(600,400);
setVisible(true);
}
public void addcomp(int row,int col,int wide,int
high,Component com , Container cn)
{
gbc.gridx = col;
gbc.gridy = row;
gbc.gridheight = high;
gbc.gridwidth = wide;
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx=1;
gbc.weighty=1;
gbc.insets = new Insets(2,2,2,2);
gb1.setConstraints(com,gbc);
cn.add(com);
if(com instanceof JButton)
((JButton)com).addActionListener(this);
com.setFont(new Font("Times",Font.BOLD,15));
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==cancel)
{
dispose();
login usr = new login();
usr.setBounds(325,170,540,350);
}
if(ae.getSource()==ok)
{
String uid="",pwd="",posts="";
try
{
cn =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE
5","sa","kankarbagh");
stmt = cn.createStatement();
rs=stmt.executeQuery("select username,password from
ACCOUNT where desg = 'administrator' and username =
'"+tadmin.getText()+"'");
while(rs.next())
{
uid = rs.getString(1).trim();
pwd = rs.getString(2).trim();
}
if(uid.equalsIgnoreCase(tadmin.getText())&&pwd.equals(S
tring.valueOf(tpassword.getPassword())))
{
user.setEnabled(true);
tuser.setEnabled(true);
userpwd.setEnabled(true);
tuserpwd.setEnabled(true);
PATNA WOMEN’S COLLEGE Page 56
GPF MANAGMENT SYSTEM
confirmpwd.setEnabled(true);
tconfirmpwd.setEnabled(true);
post.setEnabled(true);
tpost.setEnabled(true);
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.toString());
}
}
if(ae.getSource()==create)
{
try
{
cn =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE
5","sa","kankarbagh");
stmt = cn.createStatement();
stmt.executeUpdate("insert into ACCOUNT
values('"+tuser.getText()+"','"+new
String(tuserpwd.getPassword())+"','"+tpost.getText()
+"')");
JOptionPane.showMessageDialog(this,"NEW USER
CREATED");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.toString());
}
}
}
public static void main(String [] args)
{
createuser obj = new createuser();
}
}
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
public class Menu extends JFrame
{
PATNA WOMEN’S COLLEGE Page 59
GPF MANAGMENT SYSTEM
public Menu()
{
setTitle("Menu");
setSize(700, 700);
JMenuBar menuBar = new JMenuBar();
setJMenuBar(menuBar)
JMenu fileMenu = new JMenu("File");
JMenu transMenu = new JMenu("Transaction");
JMenu queryMenu = new JMenu("Query");
JMenu reportMenu = new JMenu("Report");
JMenu quitMenu = new JMenu("Quit");
menuBar.add(fileMenu);
menuBar.add(transMenu);
menuBar.add(queryMenu);
menuBar.add(reportMenu);
menuBar.add(quitMenu);
JMenuItem entryAction = new JMenuItem("Entry");
JMenuItem openAction = new JMenuItem("Employee
detail");
JMenuItem loanAction = new JMenuItem("Loan");
JMenuItem refundAction = new JMenuItem("Refund");
JMenuItem updateAction = new JMenuItem("Update");
JMenuItem deleteAction = new JMenuItem("Delete");
ldetAction.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
new loandet();
}
}
);
rdetAction.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
new gpfdet();
}
}
);
gpfAction.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
new GPF();
}
}
);
loanAction.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
new loan();
}
}
);
refundAction.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
refund rd = new refund();
}
}
);
employeeAction.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
new empreport();
}
}
);
monthAction.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
new monthreport();
}
}
);
yearAction.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
new yearreport();
}
}
);
exitAction.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
dispose();
}
}
);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
setTitle("Main Form");
}
public static void main(String[] args) {
Menu me = new Menu();
}
}
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class Registration extends JFrame implements
ActionListener
{
JPanel panel;
JLabel Head;
JLabel Head1;
JLabel lID;
JLabel lacno;
JLabel lvolume;
JLabel lfname;
JLabel lmname;
JLabel llname;
JLabel lsex;
JLabel lDesignation;
JLabel lDOB;
JLabel ldoj;
JLabel lcaste;
JLabel lreligion;
JLabel lfathername;
JLabel lmobileno;
JLabel lmaritalstatus;
JLabel lspousename;
JLabel lAddress;
JLabel lAddress1;
JLabel lbasic;
JLabel lidmark;
JLabel lnominee1;
JLabel lnominee2;
JLabel lnominee3;
JLabel lnom1age;
JLabel lnom2age;
JLabel lnom3age;
JLabel lnom1relation;
JLabel lnom2relation;
JLabel lnom3relation;
JLabel lnom1pa;
JLabel lnom2pa;
JLabel lnom3pa;
JLabel lstate;
JLabel lcity;
JButton submit;
JButton reset;
JButton exit;
JTextField tID;
JTextField tacno;
JTextField tvolume;
JTextField tfname;
JTextField tmname;
JTextField tlname;
JTextField tsex;
JTextField tDesignation;
JTextField tDOB;
JTextField tdoj;
JTextField tfathername;
JTextField tmobileno;
JTextField tspousename;
JTextField tAddress;
JTextField tidmark;
JTextField tnominee1;
JTextField tnominee2;
JTextField tnominee3;
JTextField tAddress1;
JTextField tnom1age;
JTextField tnom2age;
JTextField tnom3age;
JTextField tnom1relation;
JTextField tnom2relation;
JTextField tnom3relation;
JTextField tnom1pa;
JTextField tnom2pa;
JTextField tnom3pa;
JTextField tstate;
JTextField tcity;
JTextField tbasic;
JComboBox cb1;
JComboBox cb2;
JComboBox cb3;
JComboBox cb4;
JRadioButton rb1;
JRadioButton rb2;
GridBagLayout g;
GridBagConstraints gbc;
Connection con;
PreparedStatement stat;
public Registration()
{
g = new GridBagLayout();
gbc = new GridBagConstraints();
panel = (JPanel)getContentPane();
panel.setLayout(null);
ImageIcon im = new ImageIcon("bseb-logo.jpg");
JLabel logo = new JLabel(im,JLabel.LEFT);
logo.setBounds(400,2,120,100);
panel.add(logo);
ImageIcon i = new ImageIcon("icon_reg.gif");
JLabel blogo = new JLabel(i,JLabel.LEFT);
blogo.setBounds(0,0,84,70);
panel.add(blogo);
Head=new JLabel("GPF REGISTRATION FORM");
Head.setFont(new Font("Times",Font.BOLD,20));
Head.setBounds(500,25,900,30);
panel.add(Head);
lID= new JLabel("CODE");
lID.setFont(new Font("Times",Font.BOLD,15));
lID.setBounds(40,35,90,100);
panel.add(lID);
tID = new JTextField(5);
tID.setFont(new Font("Times",Font.BOLD,15));
tID.setBounds(250,70,90,30);
panel.add(tID);
lacno= new JLabel("AC/NO");
lacno.setBounds(600,35,90,100);
lacno.setFont(new Font("Times",Font.BOLD,15));
panel.add(lacno);
tacno = new JTextField(5);
tacno.setFont(new Font("Times",Font.BOLD,15));
tacno.setBounds(760,70,90,30);
panel.add(tacno);
lvolume= new JLabel("VOLUME");
lvolume.setBounds(920,35,90,100);
lvolume.setFont(new Font("Times",Font.BOLD,15));
panel.add(lvolume);
cb1= new JComboBox();
cb1.addItem("1");
cb1.addItem("2");
cb1.addItem("3");
cb1.addItem("4");
cb1.addItem("5");
cb1.addItem("6");
cb1.addItem("7");
cb1.addItem("8");
cb1.addItem("9");
cb1.setBounds(1050,70,90,30);
cb1.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb1);
lfname= new JLabel("FIRST NAME");
lfname.setBounds(40,35,100,200);
lfname.setFont(new Font("Times",Font.BOLD,15));
panel.add(lfname);
tfname = new JTextField(30);
tfname.setFont(new Font("Times",Font.BOLD,15));
tfname.setBounds(250,120,90,30);
panel.add(tfname);
lmname= new JLabel("MIDDLE NAME");
lmname.setBounds(600,35,150,200);
lmname.setFont(new Font("Times",Font.BOLD,15));
panel.add(lmname);
tmname = new JTextField(30);
tmname.setFont(new Font("Times",Font.BOLD,15));
tmname.setBounds(760,120,90,30);
panel.add(tmname);
llname= new JLabel("LAST NAME");
llname.setBounds(920,35,150,200);
llname.setFont(new Font("Times",Font.BOLD,15));
panel.add(llname);
tlname = new JTextField(15);
tlname.setFont(new Font("Times",Font.BOLD,15));
tlname.setBounds(1050,120,90,30);
panel.add(tlname);
panel.add(tDesignation);
lDOB = new JLabel("DATE OF BIRTH");
lDOB.setBounds(40,35,150,400);
lDOB.setFont(new Font("Times",Font.BOLD,15));
panel.add(lDOB);
tDOB = new JTextField(30);
tDOB.setFont(new Font("Times",Font.BOLD,15));
tDOB.setBounds(250,220,90,30);
panel.add(tDOB);
ldoj = new JLabel("DATE OF JOINING");
ldoj.setBounds(600,30,150,400);
ldoj.setFont(new Font("Times",Font.BOLD,15));
panel.add(ldoj);
tdoj = new JTextField(30);
tdoj.setFont(new Font("Times",Font.BOLD,15));
tdoj.setBounds(760,220,90,30);
panel.add(tdoj);
lcaste = new JLabel("CASTE");
lcaste.setBounds(40,35,90,500);
lcaste.setFont(new Font("Times",Font.BOLD,15));
panel.add(lcaste);
cb4= new JComboBox();
cb4.addItem("GENERAL");
cb4.addItem("SC");
cb4.addItem("ST");
cb4.addItem("OBC");
cb4.setBounds(250,270,110,30);
cb4.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb4);
lreligion = new JLabel("RELIGION");
lreligion.setBounds(600,35,90,500);
lreligion.setFont(new Font("Times",Font.BOLD,15));
panel.add(lreligion);
cb2= new JComboBox();
cb2.addItem("HINDU");
cb2.addItem("MUSLIM");
cb2.addItem("CHRISTIAN");
cb2.addItem("SHIKH");
cb2.setBounds(760,270,90,30);
cb2.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb2);
lfathername = new JLabel("FATHER'S NAME");
lfathername.setBounds(40,35,140,600);
lfathername.setFont(new Font("Times",Font.BOLD,15));
panel.add(lfathername);
tfathername = new JTextField(30);
tfathername.setFont(new Font("Times",Font.BOLD,15));
tfathername.setBounds(250,320,200,30);
panel.add(tfathername);
lmobileno = new JLabel("MOBILE NO");
lmobileno.setBounds(600,35,140,600);
lmobileno.setFont(new Font("Times",Font.BOLD,15));
panel.add(lmobileno);
tmobileno = new JTextField(30);
tmobileno.setFont(new Font("Times",Font.BOLD,15));
tmobileno.setBounds(760,320,90,30);
panel.add(tmobileno);
lmaritalstatus = new JLabel("MARITAL STATUS");
lmaritalstatus.setBounds(40,35,150,700);
lmaritalstatus.setFont(new Font("Times",Font.BOLD,15));
panel.add(lmaritalstatus);
cb3 = new JComboBox();
cb3.addItem("SINGLE");
cb3.addItem("MARRIED");
cb3.addItem("WIDOW");
cb3.setBounds(250,370,100,30);
cb3.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb3);
lspousename = new JLabel("SPOUSE NAME");
lspousename.setBounds(40,35,150,800);
lspousename.setFont(new Font("Times",Font.BOLD,15));
panel.add(lspousename);
tspousename = new JTextField(30);
tspousename.setFont(new Font("Times",Font.BOLD,15));
lspousename.setFont(new Font("Times",Font.BOLD,15));
tspousename.setBounds(250,420,200,30);
panel.add(tspousename);
lAddress = new JLabel("PRESENT ADDRESS");
lAddress.setBounds(40,35,150,900);
lAddress.setFont(new Font("Times",Font.BOLD,15));
panel.add(lAddress);
tAddress = new JTextField(30);
tAddress.setFont(new Font("Times",Font.BOLD,15));
tAddress.setBounds(250,470,200,30);
panel.add(tAddress);
lAddress1 = new JLabel("PERMANENT ADDRESS");
lAddress1.setBounds(600,35,200,900);
lAddress1.setFont(new Font("Times",Font.BOLD,15));
panel.add(lAddress1);
tAddress1 = new JTextField(30);
tAddress1.setFont(new Font("Times",Font.BOLD,15));
tAddress1.setBounds(780,470,200,30);
panel.add(tAddress1);
lbasic = new JLabel("BASIC SALARY");
lbasic.setBounds(40,35,200,1000);
lbasic.setFont(new Font("Times",Font.BOLD,15));
panel.add(lbasic);
tbasic = new JTextField(30);
tbasic.setFont(new Font("Times",Font.BOLD,15));
tbasic.setBounds(250,520,90,30);
panel.add(tbasic);
lidmark = new JLabel("IDENTIFICATION MARK");
lidmark.setBounds(600,35,200,1000);
lidmark.setFont(new Font("Times",Font.BOLD,15));
panel.add(lidmark);
tidmark = new JTextField(30);
tidmark.setFont(new Font("Times",Font.BOLD,15));
tidmark.setBounds(780,520,200,30);
panel.add(tidmark);
lnominee1 = new JLabel("NOMINEE 1");
lnominee1.setBounds(40,30,100,1100);
lnominee1.setFont(new Font("Times",Font.BOLD,15));
panel.add(lnominee1);
tnominee1 = new JTextField(30);
tnominee1.setFont(new Font("Times",Font.BOLD,15));
tnominee1.setBounds(250,570,150,30);
panel.add(tnominee1);
lnom1age = new JLabel("AGE");
lnom1age.setBounds(440,30,90,1100);
lnom1age.setFont(new Font("Times",Font.BOLD,15));
panel.add(lnom1age);
tnom1age = new JTextField(2);
tnom1age.setFont(new Font("Times",Font.BOLD,15));
tnom1age.setBounds(490,570,90,30);
panel.add(tnom1age);
lnom1relation = new JLabel("RELATION");
lnom1relation.setFont(new Font("Times",Font.BOLD,15));
lnom1relation.setBounds(600,30,90,1100);
panel.add(lnom1relation);
tnom1relation = new JTextField(15);
tnom1relation.setFont(new Font("Times",Font.BOLD,15));
tnom1relation.setBounds(690,570,90,30);
panel.add(tnom1relation);
lnom1pa = new JLabel("PAYABLE AMOUNT");
lnom1pa.setFont(new Font("Times",Font.BOLD,15));
lnom1pa.setBounds(800,30,150,1100);
panel.add(lnom1pa);
tnom1pa = new JTextField(15);
tnom1pa.setFont(new Font("Times",Font.BOLD,15));
tnom1pa.setBounds(950,570,90,30);
panel.add(tnom1pa);
lnominee2 = new JLabel("NOMINEE 2");
lnominee2.setFont(new Font("Times",Font.BOLD,15));
lnominee2.setBounds(40,35,100,1160);
panel.add(lnominee2);
tnominee2 = new JTextField(30);
tnominee2.setFont(new Font("Times",Font.BOLD,15));
tnominee2.setBounds(250,600,150,30);
panel.add(tnominee2);
lnom2age = new JLabel("AGE");
lnom2age.setFont(new Font("Times",Font.BOLD,15));
lnom2age.setBounds(440,35,90,1160);
panel.add(lnom2age);
tnom2age = new JTextField(2);
tnom2age.setFont(new Font("Times",Font.BOLD,15));
tnom2age.setBounds(490,600,90,30);
panel.add(tnom2age);
lnom2relation = new JLabel("RELATION");
lnom2relation.setBounds(600,35,90,1160);
lnom2relation.setFont(new Font("Times",Font.BOLD,15));
panel.add(lnom2relation);
tnom2relation = new JTextField(15);
tnom2relation.setFont(new Font("Times",Font.BOLD,15));
tnom2relation.setBounds(690,600,90,30);
panel.add(tnom2relation);
lnom2pa = new JLabel("PAYABLE AMOUNT");
lnom2pa.setFont(new Font("Times",Font.BOLD,15));
lnom2pa.setBounds(800,35,150,1160);
panel.add(lnom2pa);
tnom2pa = new JTextField(15);
tnom2pa.setFont(new Font("Times",Font.BOLD,15));
tnom2pa.setBounds(950,600,90,30);
panel.add(tnom2pa);
lnominee3 = new JLabel("NOMINEE 3");
lnominee3.setBounds(40,35,100,1230);
lnominee3.setFont(new Font("Times",Font.BOLD,15));
panel.add(lnominee3);
tnominee3 = new JTextField(30);
tnominee3.setFont(new Font("Times",Font.BOLD,15));
tnominee3.setBounds(250,630,150,30);
panel.add(tnominee3);
lnom3age = new JLabel(" AGE");
lnom3age.setFont(new Font("Times",Font.BOLD,15));
lnom3age.setBounds(440,35,90,1230);
panel.add(lnom3age);
tnom3age = new JTextField(2);
tnom3age.setFont(new Font("Times",Font.BOLD,15));
tnom3age.setBounds(490,630,90,30);
panel.add(tnom3age);
lnom3relation = new JLabel("RELATION");
lnom3relation.setFont(new Font("Times",Font.BOLD,15));
lnom3relation.setBounds(600,35,90,1230);
panel.add(lnom3relation);
tnom3relation =new JTextField(15);
tnom3relation.setFont(new Font("Times",Font.BOLD,15));
tnom3relation.setBounds(690,630,90,30);
panel.add(tnom3relation);
lnom3pa = new JLabel("PAYABLE AMOUNT");
lnom3pa.setFont(new Font("Times",Font.BOLD,15));
lnom3pa.setBounds(800,35,150,1230);
panel.add(lnom3pa);
tnom3pa = new JTextField(15);
tnom3pa.setFont(new Font("Times",Font.BOLD,15));
tnom3pa.setBounds(950,630,90,30);
panel.add(tnom3pa);
JButton submit = new JButton("SAVE");
submit.setFont(new Font("Times",Font.BOLD,15));
submit.setActionCommand("submit");
submit.setBounds(1100,400,80,40);
panel.add(submit);
JButton reset = new JButton("RESET");
reset.setFont(new Font("Times",Font.BOLD,15));
reset.setActionCommand("reset");
reset.setBounds(1100,500,90,40);
panel.add(reset);
JButton exit = new JButton("EXIT");
exit.setActionCommand("exit");
exit.setFont(new Font("Times",Font.BOLD,15));
exit.setBounds(1100,600,80,40);
panel.add(exit);
exit.addActionListener(this);
submit.addActionListener(this);
reset.addActionListener(this);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(1220,720);
setVisible(true);
setTitle("Registration details");
panel.setBackground(Color.pink);
}
public void actionPerformed(ActionEvent ae){
if(ae.getActionCommand() == "submit"){
Try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE2",
"sa","kankarbagh");
stat=con.prepareStatement("INSERT INTO EMPINFO
VALUES(? , ?,? , ? , ? , ? , ? , ? , ? , ? , ? ,?, ? , ? ,? , ? , ? , ? , ?, ?, ?, ? , ? ,
? , ? , ? , ? , ? , ? , ? , ? , ? )");
String ID = tID.getText();
String acno = tacno.getText();
String volume = cb1.getSelectedItem().toString();
String fname = tfname.getText();
stat.setString(13, fathername);
stat.setString(14,mobileno);
stat.setString(15, maritalstatus);
stat.setString(16, spousename);
stat.setString(17,address);
stat.setString(18,address1);
stat.setFloat(19,Float.parseFloat(basic));
stat.setString(20,idmark);
stat.setString(21, nom1);
stat.setString(22, nom2);
stat.setString(23, nom3);
stat.setString(24, nom1age);
stat.setString(25, nom2age);
stat.setString(26, nom3age);
stat.setString(27, nom1relation);
stat.setString(28, nom2relation);
stat.setString(29, nom3relation);
stat.setInt(30,Integer.parseInt( nom1pa));
stat.setInt(31, Integer.parseInt(nom2pa));
stat.setInt(32, Integer.parseInt(nom3pa));
stat.executeUpdate();
JOptionPane.showMessageDialog(this,"Inserted
Sucessfully");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
if(ae.getActionCommand() == "reset")
{
tID.setText(" ");
tacno.setText(" ");
tfname.setText(" ");
tmname.setText(" ");
tlname.setText("");
tDesignation.setText(" ");
tDOB.setText("");
tdoj.setText("");
tfathername.setText(" ");
tmobileno.setText("");
tspousename.setText(" ");
tAddress.setText("");
tAddress1.setText("");
tbasic.setText("");
tidmark.setText(" ");
tnominee1.setText("");
tnominee2.setText("");
tnominee3.setText("");
tnom1age.setText("");
tnom2age.setText("");
tnom3age.setText("");
tnom1relation.setText("");
tnom2relation.setText("");
tnom3relation.setText("");
tnom1pa.setText("");
tnom2pa.setText("");
tnom3pa.setText("");
}
if(ae.getActionCommand() == "exit")
dispose();
}
public static void main(String[] args){
Registration reg=new Registration();
}
}
}
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class modify extends JFrame implements
ActionListener
{
JPanel panel;
JLabel Head;
JLabel Head1;
JLabel lID;
JLabel lacno;
JLabel lvolume;
JLabel lfname;
JLabel lmname;
JLabel llname;
JLabel lsex;
JLabel lDesignation;
JLabel lDOB;
JLabel ldoj;
JLabel lcaste;
JLabel lreligion;
JLabel lfathername;
JLabel lmobileno;
JLabel lmaritalstatus;
JLabel lspousename;
JLabel lAddress;
JLabel lAddress1;
JLabel lbasic;
JLabel lidmark;
JLabel lnominee1;
JLabel lnominee2;
JLabel lnominee3;
JLabel lnom1age;
JLabel lnom2age;
JLabel lnom3age;
JLabel lnom1relation;
JLabel lnom2relation;
JLabel lnom3relation;
JLabel lnom1pa;
JLabel lnom2pa;
JLabel lnom3pa;
JLabel lstate;
JLabel lcity;
JButton show;
JButton reset;
JButton exit;
JButton update;
JTextField tID;
JTextField tacno;
JTextField tvolume;
JTextField tfname;
JTextField tmname;
JTextField tlname;
JTextField tDesignation;
JTextField tDOB;
JTextField tdoj;
JTextField tfathername;
JTextField tmobileno;
JTextField tspousename;
JTextField tAddress;
JTextField tAddress1;
JTextField tbasic;
JTextField tidmark;
JTextField tnominee1;
JTextField tnominee2;
JTextField tnominee3;
JTextField tnom1age;
JTextField tnom2age;
JTextField tnom3age;
JTextField tnom1relation;
JTextField tnom2relation;
JTextField tnom3relation;
JTextField tnom1pa;
JTextField tnom2pa;
JTextField tnom3pa;
JTextField tstate;
JTextField tcity;
JComboBox cb1;
JComboBox cb2;
JComboBox cb3;
JComboBox cb4;
JRadioButton rb1;
JRadioButton rb2;
GridBagLayout g;
GridBagConstraints gbc;
Connection con;
PreparedStatement stmt;
public modify()
{
g = new GridBagLayout();
gbc = new GridBagConstraints();
panel = (JPanel)getContentPane();
panel.setLayout(null);
ImageIcon im = new ImageIcon("bseb-logo.jpg");
JLabel logo = new JLabel(im,JLabel.LEFT);
logo.setBounds(400,2,120,100);
panel.add(logo);
ImageIcon i = new ImageIcon("icon_reg.gif");
panel.add(tacno);
lvolume= new JLabel("VOLUME");
lvolume.setBounds(920,35,90,100);
lvolume.setFont(new Font("Times",Font.BOLD,15));
panel.add(lvolume);
cb1= new JComboBox();
cb1.addItem("1");
cb1.addItem("2");
cb1.addItem("3");
cb1.addItem("4");
cb1.addItem("5");
cb1.addItem("6");
cb1.addItem("7");
cb1.addItem("8");
cb1.addItem("9");
cb1.setBounds(1050,70,90,30);
cb1.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb1);
lfname= new JLabel("FIRST NAME");
lfname.setBounds(40,35,100,200);
lfname.setFont(new Font("Times",Font.BOLD,15));
panel.add(lfname);
lsex.setFont(new Font("Times",Font.BOLD,15));
panel.add(lsex);
rb1 = new JRadioButton("MALE");
rb2 = new JRadioButton("FEMALE");
ButtonGroup bg = new ButtonGroup();
rb1.setBounds(250,170,80,30);
rb1.setFont(new Font("Times",Font.BOLD,15));
rb2.setBounds(340,170,100,30);
rb2.setFont(new Font("Times",Font.BOLD,15));
panel.add(rb1);
panel.add(rb2);
bg.add(rb1);
bg.add(rb2);
lDesignation = new JLabel("DESIGNATION");
lDesignation.setBounds(600,35,150,300);
lDesignation.setFont(new Font("Times",Font.BOLD,15));
panel.add(lDesignation);
tDesignation = new JTextField(20);
tDesignation.setFont(new Font("Times",Font.BOLD,15));
tDesignation.setBounds(760,170,150,30);
panel.add(tDesignation);
lDOB = new JLabel("DATE OF BIRTH");
lDOB.setBounds(40,35,150,400);
lDOB.setFont(new Font("Times",Font.BOLD,15));
panel.add(lDOB);
tDOB = new JTextField(30);
tDOB.setFont(new Font("Times",Font.BOLD,15));
tDOB.setBounds(250,220,90,30);
panel.add(tDOB);
ldoj = new JLabel("DATE OF JOINING");
ldoj.setBounds(600,30,150,400);
ldoj.setFont(new Font("Times",Font.BOLD,15));
panel.add(ldoj);
tdoj = new JTextField(30);
tdoj.setFont(new Font("Times",Font.BOLD,15));
tdoj.setBounds(760,220,90,30);
panel.add(tdoj);
lcaste = new JLabel("CASTE");
lcaste.setBounds(40,35,90,500);
lcaste.setFont(new Font("Times",Font.BOLD,15));
panel.add(lcaste);
cb4= new JComboBox();
cb4.addItem("GENERAL");
cb4.addItem("SC");
cb4.addItem("ST");
cb4.addItem("OBC");
cb4.setBounds(250,270,110,30);
cb4.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb4);
lreligion = new JLabel("RELIGION");
lreligion.setBounds(600,35,90,500);
lreligion.setFont(new Font("Times",Font.BOLD,15));
panel.add(lreligion);
cb2= new JComboBox();
cb2.addItem("HINDU");
cb2.addItem("MUSLIM");
cb2.addItem("CHRISTIAN");
cb2.addItem("SHIKH");
cb2.setBounds(760,270,90,30);
cb2.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb2);
lfathername = new JLabel("FATHER'S NAME");
lfathername.setBounds(40,35,140,600);
lfathername.setFont(new Font("Times",Font.BOLD,15));
panel.add(lfathername);
tfathername = new JTextField(30);
tfathername.setFont(new Font("Times",Font.BOLD,15));
tfathername.setBounds(250,320,200,30);
panel.add(tfathername);
lmobileno = new JLabel("MOBILE NO");
lmobileno.setBounds(600,35,140,600);
lmobileno.setFont(new Font("Times",Font.BOLD,15));
panel.add(lmobileno);
tmobileno = new JTextField(30);
tmobileno.setFont(new Font("Times",Font.BOLD,15));
tmobileno.setBounds(760,320,90,30);
panel.add(tmobileno);
lmaritalstatus = new JLabel("MARITAL STATUS");
lmaritalstatus.setBounds(40,35,150,700);
lmaritalstatus.setFont(new Font("Times",Font.BOLD,15));
panel.add(lmaritalstatus);
cb3 = new JComboBox();
cb3.addItem("SINGLE");
cb3.addItem("MARRIED");
cb3.addItem("WIDOW");
cb3.setBounds(250,370,100,30);
cb3.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb3);
tAddress1.setFont(new Font("Times",Font.BOLD,15));
tAddress1.setBounds(780,470,200,30);
panel.add(tAddress1);
lbasic = new JLabel("BASIC SALARY");
lbasic.setBounds(40,35,200,1000);
lbasic.setFont(new Font("Times",Font.BOLD,15));
panel.add(lbasic);
tbasic = new JTextField(30);
tbasic.setFont(new Font("Times",Font.BOLD,15));
tbasic.setBounds(250,520,90,30);
panel.add(tbasic);
lidmark = new JLabel("IDENTIFICATION MARK");
lidmark.setBounds(600,35,200,1000);
lidmark.setFont(new Font("Times",Font.BOLD,15));
panel.add(lidmark);
tidmark = new JTextField(30);
tidmark.setFont(new Font("Times",Font.BOLD,15));
tidmark.setBounds(780,520,200,30);
panel.add(tidmark);
lnominee1 = new JLabel("NOMINEE 1");
lnominee1.setBounds(40,30,100,1100);
lnominee1.setFont(new Font("Times",Font.BOLD,15));
panel.add(lnominee1);
tnominee1 = new JTextField(30);
tnominee1.setFont(new Font("Times",Font.BOLD,15));
tnominee1.setBounds(250,570,150,30);
panel.add(tnominee1);
lnom1age = new JLabel("AGE");
lnom1age.setBounds(440,30,90,1100);
lnom1age.setFont(new Font("Times",Font.BOLD,15));
panel.add(lnom1age);
tnom1age = new JTextField(2);
tnom1age.setFont(new Font("Times",Font.BOLD,15));
tnom1age.setBounds(490,570,90,30);
panel.add(tnom1age);
lnom1relation = new JLabel("RELATION");
lnom1relation.setFont(new Font("Times",Font.BOLD,15));
lnom1relation.setBounds(600,30,90,1100);
panel.add(lnom1relation);
tnom1relation = new JTextField(15);
tnom1relation.setFont(new Font("Times",Font.BOLD,15));
tnom1relation.setBounds(690,570,90,30);
panel.add(tnom1relation);
lnom1pa = new JLabel("PAYABLE AMOUNT");
lnom1pa.setFont(new Font("Times",Font.BOLD,15));
lnom1pa.setBounds(800,30,150,1100);
panel.add(lnom1pa);
tnom1pa = new JTextField(15);
tnom1pa.setFont(new Font("Times",Font.BOLD,15));
tnom1pa.setBounds(950,570,90,30);
panel.add(tnom1pa);
lnominee2 = new JLabel("NOMINEE 2");
lnominee2.setFont(new Font("Times",Font.BOLD,15));
lnominee2.setBounds(40,35,100,1160);
panel.add(lnominee2);
tnominee2 = new JTextField(30);
tnominee2.setFont(new Font("Times",Font.BOLD,15));
tnominee2.setBounds(250,600,150,30);
panel.add(tnominee2);
lnom2age = new JLabel("AGE");
lnom2age.setFont(new Font("Times",Font.BOLD,15));
lnom2age.setBounds(440,35,90,1160);
panel.add(lnom2age);
tnom2age = new JTextField(2);
tnom2age.setFont(new Font("Times",Font.BOLD,15));
tnom2age.setBounds(490,600,90,30);
panel.add(tnom2age);
lnom2relation = new JLabel("RELATION");
lnom2relation.setBounds(600,35,90,1160);
lnom2relation.setFont(new Font("Times",Font.BOLD,15));
panel.add(lnom2relation);
tnom2relation = new JTextField(15);
tnom2relation.setFont(new Font("Times",Font.BOLD,15));
tnom2relation.setBounds(690,600,90,30);
panel.add(tnom2relation);
lnom2pa = new JLabel("PAYABLE AMOUNT");
lnom2pa.setFont(new Font("Times",Font.BOLD,15));
lnom2pa.setBounds(800,35,150,1160);
panel.add(lnom2pa);
tnom2pa = new JTextField(15);
tnom2pa.setFont(new Font("Times",Font.BOLD,15));
tnom2pa.setBounds(950,600,90,30);
panel.add(tnom2pa);
lnominee3 = new JLabel("NOMINEE 3");
lnominee3.setBounds(40,35,100,1230);
lnominee3.setFont(new Font("Times",Font.BOLD,15));
panel.add(lnominee3);
tnominee3 = new JTextField(30);
tnominee3.setFont(new Font("Times",Font.BOLD,15));
tnominee3.setBounds(250,630,150,30);
panel.add(tnominee3);
lnom3age = new JLabel(" AGE");
lnom3age.setFont(new Font("Times",Font.BOLD,15));
lnom3age.setBounds(440,35,90,1230);
panel.add(lnom3age);
tnom3age = new JTextField(2);
tnom3age.setFont(new Font("Times",Font.BOLD,15));
tnom3age.setBounds(490,630,90,30);
panel.add(tnom3age);
lnom3relation = new JLabel("RELATION");
lnom3relation.setFont(new Font("Times",Font.BOLD,15));
lnom3relation.setBounds(600,35,90,1230);
panel.add(lnom3relation);
tnom3relation =new JTextField(15);
tnom3relation.setFont(new Font("Times",Font.BOLD,15));
tnom3relation.setBounds(690,630,90,30);
panel.add(tnom3relation);
lnom3pa = new JLabel("PAYABLE AMOUNT");
lnom3pa.setFont(new Font("Times",Font.BOLD,15));
lnom3pa.setBounds(800,35,150,1230);
panel.add(lnom3pa);
tnom3pa = new JTextField(15);
tnom3pa.setFont(new Font("Times",Font.BOLD,15));
tnom3pa.setBounds(950,630,90,30);
panel.add(tnom3pa);
JButton show = new JButton("SHOW");
show.setActionCommand("show");
show.setFont(new Font("Times",Font.BOLD,15));
show.setBounds(1100,400,100,40);
panel.add(show);
JButton update = new JButton("UPDATE");
update.setFont(new Font("Times",Font.BOLD,15));
update.setActionCommand("update");
update.setBounds(1100,450,100,40);
panel.add(update);
JButton reset = new JButton("RESET");
reset.setFont(new Font("Times",Font.BOLD,15));
reset.setActionCommand("reset");
reset.setBounds(1100,500,100,40);
panel.add(reset);
JButton exit = new JButton("EXIT");
exit.setFont(new Font("Times",Font.BOLD,15));
exit.setActionCommand("exit");
exit.setBounds(1100,550,100,40);
panel.add(exit);
exit.addActionListener(this);
reset.addActionListener(this);
show.addActionListener(this);
update.addActionListener(this);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(1250,750);
setVisible(true);
setTitle("Update form");
panel.setBackground(Color.pink);
}
public void actionPerformed(ActionEvent ae){
if(ae.getActionCommand() == "show"){
if(tID.getText().trim().length()==0){
JOptionPane.showMessageDialog(this,"Code cant be left
blank");
return;}
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:MYDATASOURC
E2","sa","kankarbagh");
stmt=con.prepareStatement("select * from EMPINFO where
code=?");
stmt.setString(1,tID.getText());
ResultSet rs=stmt.executeQuery();
if(!rs.next()){
JOptionPane.showMessageDialog(this,"Code is not Valid");}
else{
tacno.setText(rs.getString(2));
String volume=rs.getString(3).toString().trim();
if(volume.equalsIgnoreCase("1")){
cb4.setSelectedIndex(0);}
if(volume.equalsIgnoreCase("2")){
cb4.setSelectedIndex(1);}
if(volume.equalsIgnoreCase("3")){
cb4.setSelectedIndex(2);}
if(volume.equalsIgnoreCase("4")){
cb4.setSelectedIndex(3);}
if(volume.equalsIgnoreCase("5")){
cb4.setSelectedIndex(4);}
if(volume.equalsIgnoreCase("6")){
cb4.setSelectedIndex(5);}
if(volume.equalsIgnoreCase("7")){
cb4.setSelectedIndex(6);}
if(volume.equalsIgnoreCase("8")){
cb4.setSelectedIndex(7);}
if(volume.equalsIgnoreCase("9")){
cb4.setSelectedIndex(8);}
tfname.setText(rs.getString(4));
tmname.setText(rs.getString(5));
tlname.setText(rs.getString(6));
String sex=rs.getString(7).toString().trim();
if(sex.equalsIgnoreCase("MALE")){
rb1.setSelected(true);}
if(sex.equalsIgnoreCase("FEMALE")){
rb2.setSelected(true);}
tDesignation.setText(rs.getString(8));
tDOB.setText(rs.getString(9));
tdoj.setText(rs.getString(10));
String caste=rs.getString(11).toString().trim();
if(caste.equalsIgnoreCase("GENERAL")){
cb1.setSelectedIndex(0);}
if(caste.equalsIgnoreCase("SC")){
cb1.setSelectedIndex(1);}
if(caste.equalsIgnoreCase("ST")){
cb1.setSelectedIndex(2);}
if(caste.equalsIgnoreCase("OBC")){
cb1.setSelectedIndex(2);}
String religion=rs.getString(12).toString().trim();
if(religion.equalsIgnoreCase("HINDU")){
cb2.setSelectedIndex(0);}
if(religion.equalsIgnoreCase("MUSLIM")){
cb2.setSelectedIndex(1);}
if(religion.equalsIgnoreCase("CHRISTIAN")){
cb2.setSelectedIndex(2);}
if(religion.equalsIgnoreCase("SHIKH")){
cb2.setSelectedIndex(3);}
tfathername.setText(rs.getString(13));
tmobileno.setText(rs.getString(14));
String ms=rs.getString(15).toString().trim();
if(ms.equalsIgnoreCase("SINGLE")){
cb3.setSelectedIndex(0);}
if(ms.equalsIgnoreCase("MARRIED")){
cb3.setSelectedIndex(1);}
if(ms.equalsIgnoreCase("WIDOW")){
cb3.setSelectedIndex(2);}
tspousename.setText(rs.getString(16));
tAddress.setText(rs.getString(17));
tAddress1.setText(rs.getString(18));
tbasic.setText(rs.getString(19));
tidmark.setText(rs.getString(20));
tnominee1.setText(rs.getString(21));
tnominee2.setText(rs.getString(22));
tnominee3.setText(rs.getString(23));
tnom1age.setText(rs.getString(24));
tnom2age.setText(rs.getString(25));
tnom3age.setText(rs.getString(26));
tnom1relation.setText(rs.getString(27));
tnom2relation.setText(rs.getString(28));
tnom3relation.setText(rs.getString(29));
tnom1pa.setText(rs.getString(30));
tnom2pa.setText(rs.getString(31));
tnom3pa.setText(rs.getString(32));}}
catch(Exception e){
JOptionPane.showMessageDialog(this,e);}}
if(ae.getActionCommand() == "reset"){
tacno.setText(" ");
tidmark.setText(" ");
tDesignation.setText(" ");
tID.setText(" ");
tdoj.setText("");
tfname.setText(" ");
tfathername.setText(" ");
tspousename.setText(" ");
tID.setText(" ");
tAddress.setText("");
tAddress1.setText("");
tlname.setText("");
tDOB.setText("");
tmobileno.setText("");
tnominee1.setText("");
tnominee2.setText("");
tnominee3.setText("");
tnom1age.setText("");
tnom2age.setText("");
tnom3age.setText("");
tnom1relation.setText("");
tnom2relation.setText("");
tnom3relation.setText("");
tnom1pa.setText("");
tnom2pa.setText("");
tnom3pa.setText("");
tbasic.setText("");}
if(ae.getActionCommand() == "exit")
dispose();
if(ae.getActionCommand() == "update"){
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:MYDATASOURC
E2","sa","kankarbagh");
stmt = con.prepareStatement("UPDATE EMPINFO SET
DESIGNATION = ? , M_NO = ? ,M_STATUS = ? , S_NAME = ? , ADD1
= ? , BASIC= ?
,IDMARK= ?,N_1NAME=?,N_2NAME=?,N_3NAME=?,N_1AGE=?,N_
2AGE=?,N_3AGE=?,N_1RELATION=?,N_2RELATION=?,N_3RELAT
ION=?,N_1PA=?,N_2PA=?,N_3PA=? WHERE CODE = ?");
String designation = tDesignation.getText();
String mobileno = tmobileno.getText();
String maritalstatus = cb3.getSelectedItem().toString();
String spousename = tspousename.getText();
String address= tAddress.getText();
String idmark = tidmark.getText();
Float basic = Float.parseFloat(tbasic.getText().toString());
stmt.setString(10,nom3);
stmt.setString(11,nom1age);
stmt.setString(12,nom2age);
stmt.setString(13,nom3age);
stmt.setString(14,nom1relation);
stmt.setString(15,nom2relation);
stmt.setString(16,nom3relation);
stmt.setInt(17,nom1pa);
stmt.setInt(18,nom2pa);
stmt.setInt(19,nom3pa);
stmt.setString(20,id);
stmt.executeUpdate();
con.close();
JOptionPane.showMessageDialog(this,"ROW UPDATED");}
catch(Exception e){
JOptionPane.showMessageDialog(this,"ROW CANNOT BE
UPDATED");}}}
public static void main(String[] args){
modify reg=new modify();
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.util.Calendar;
public class delete extends JFrame implements
ActionListener,FocusListener
{
Connection con;
PreparedStatement stmt;
public delete()
{
GridBagLayout g = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
JPanel panel = (JPanel)getContentPane();
panel.setLayout(null);
ImageIcon im = new ImageIcon("bseb-logo.jpg");
JLabel logo = new JLabel(im,JLabel.LEFT);
logo.setBounds(400,2,120,100);
panel.add(logo);
ImageIcon i = new ImageIcon("icon_reg.gif");
JLabel blogo = new JLabel(i,JLabel.LEFT);
blogo.setBounds(0,0,84,70);
panel.add(blogo);
Head=new JLabel("DELETE RECORD");
Head.setFont(new Font("Times",Font.BOLD,20));
Head.setBounds(500,25,900,30);
panel.add(Head);
JLabel lID= new JLabel("CODE");
lID.setFont(new Font("Times",Font.BOLD,15));
lID.setBounds(40,35,90,100);
panel.add(lID);
JTextField tID = new JTextField(5);
tID.setBounds(250,70,90,30);
panel.add(tID);
JLabel lacno= new JLabel("AC/NO");
lacno.setBounds(600,35,90,100);
lacno.setFont(new Font("Times",Font.BOLD,15));
panel.add(lacno);
JTextField tacno = new JTextField(5);
tacno.setBounds(760,70,90,30);
panel.add(tacno);
JLabel lvolume= new JLabel("VOLUME");
lvolume.setBounds(920,35,90,100);
lvolume.setFont(new Font("Times",Font.BOLD,15));
panel.add(lvolume);
JComboBox cb1= new JComboBox();
cb1.addItem("1");
cb1.addItem("2");
cb1.addItem("3");
cb1.addItem("4");
cb1.addItem("5");
cb1.addItem("6");
cb1.addItem("7");
cb1.addItem("8");
cb1.addItem("9");
cb1.setBounds(1050,70,90,30);
cb1.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb1);
JLabel lfname= new JLabel("FIRST NAME");
lfname.setBounds(40,35,100,200);
lfname.setFont(new Font("Times",Font.BOLD,15));
panel.add(lfname);
JTextField tfname = new JTextField(30);
tfname.setBounds(250,120,90,30);
panel.add(tfname);
JLabel lmname= new JLabel("MIDDLE NAME");
lmname.setBounds(600,35,150,200);
lmname.setFont(new Font("Times",Font.BOLD,15));
panel.add(lmname);
JTextField tmname = new JTextField(30);
tmname.setBounds(760,120,90,30);
panel.add(tmname);
JLabel llname= new JLabel("LAST NAME");
llname.setBounds(920,35,150,200);
llname.setFont(new Font("Times",Font.BOLD,15));
panel.add(llname);
cb4.addItem("GENERAL");
cb4.addItem("SC");
cb4.addItem("ST");
cb4.addItem("OBC");
cb4.setBounds(250,270,110,30);
cb4.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb4);
JLabel lreligion = new JLabel("RELIGION");
lreligion.setBounds(600,35,90,500);
lreligion.setFont(new Font("Times",Font.BOLD,15));
panel.add(lreligion);
JComboBox cb2= new JComboBox();
cb2.addItem("HINDU");
cb2.addItem("MUSLIM");
cb2.addItem("CHRISTIAN");
cb2.addItem("SHIKH");
cb2.setBounds(760,270,90,30);
cb2.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb2);
JLabel lfathername = new JLabel("FATHER'S NAME");
lfathername.setBounds(40,35,140,600);
lfathername.setFont(new Font("Times",Font.BOLD,15));
panel.add(lfathername);
tfathername = new JTextField(30);
tfathername.setBounds(250,320,200,30);
panel.add(tfathername);
JLabel lmobileno = new JLabel("MOBILE NO");
lmobileno.setBounds(600,35,140,600);
lmobileno.setFont(new Font("Times",Font.BOLD,15));
panel.add(lmobileno);
JTextField tmobileno = new JTextField(30);
tmobileno.setBounds(760,320,90,30);
panel.add(tmobileno);
JLabel lmaritalstatus = new JLabel("MARITAL STATUS");
lmaritalstatus.setBounds(40,35,150,700);
lmaritalstatus.setFont(new Font("Times",Font.BOLD,15));
panel.add(lmaritalstatus);
JComboBox cb3 = new JComboBox();
cb3.addItem("SINGLE");
cb3.addItem("MARRIED");
cb3.addItem("WIDOW");
cb3.setBounds(250,370,100,30);
cb3.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb3);
lbasic.setBounds(40,35,200,1000);
lbasic.setFont(new Font("Times",Font.BOLD,15));
panel.add(lbasic);
JTextField tbasic = new JTextField(30);
tbasic.setBounds(250,520,90,30);
panel.add(tbasic);
JLabel lidmark = new JLabel("IDENTIFICATION MARK");
lidmark.setBounds(600,35,200,1000);
lidmark.setFont(new Font("Times",Font.BOLD,15));
panel.add(lidmark);
JTextField tidmark = new JTextField(30);
tidmark.setBounds(780,520,200,30);
panel.add(tidmark);
JLabel lnominee1 = new JLabel("NOMINEE 1");
lnominee1.setBounds(40,30,100,1100);
lnominee1.setFont(new Font("Times",Font.BOLD,15));
panel.add(lnominee1);
JTextField tnominee1 = new JTextField(30);
tnominee1.setBounds(250,570,150,30);
panel.add(tnominee1);
l JLabel nom1age = new JLabel("AGE");
lnom1age.setBounds(440,30,90,1100);
lnom1age.setFont(new Font("Times",Font.BOLD,15));
panel.add(lnom1age);
JTextField tnom1age = new JTextField(2);
tnom1age.setBounds(490,570,90,30);
panel.add(tnom1age);
JLabel lnom1relation = new JLabel("RELATION");
lnom1relation.setFont(new Font("Times",Font.BOLD,15));
lnom1relation.setBounds(600,30,90,1100);
panel.add(lnom1relation);
JTextField tnom1relation = new JTextField(15);
tnom1relation.setBounds(690,570,90,30);
panel.add(tnom1relation);
JLabel lnom1pa = new JLabel("PAYABLE AMOUNT");
lnom1pa.setFont(new Font("Times",Font.BOLD,15));
lnom1pa.setBounds(800,30,150,1100);
panel.add(lnom1pa);
JTextField tnom1pa = new JTextField(15);
tnom1pa.setBounds(950,570,90,30);
panel.add(tnom1pa);
JLabel lnominee2 = new JLabel("NOMINEE 2");
lnominee2.setFont(new Font("Times",Font.BOLD,15));
lnominee2.setBounds(40,35,100,1160);
panel.add(lnominee2);
JTextField tnominee2 = new JTextField(30);
tnominee2.setBounds(250,600,150,30);
panel.add(tnominee2);
JLabel lnom2age = new JLabel("AGE");
lnom2age.setFont(new Font("Times",Font.BOLD,15));
lnom2age.setBounds(440,35,90,1160);
panel.add(lnom2age);
JTextField tnom2age = new JTextField(2);
tnom2age.setBounds(490,600,90,30);
panel.add(tnom2age);
JLabel lnom2relation = new JLabel("RELATION");
lnom2relation.setBounds(600,35,90,1160);
lnom2relation.setFont(new Font("Times",Font.BOLD,15));
panel.add(lnom2relation);
JTextField tnom2relation = new JTextField(15);
tnom2relation.setBounds(690,600,90,30);
panel.add(tnom2relation);
JLabel lnom2pa = new JLabel("PAYABLE AMOUNT");
lnom2pa.setFont(new Font("Times",Font.BOLD,15));
lnom2pa.setBounds(800,35,150,1160);
panel.add(lnom2pa);
tnom3relation.setBounds(690,630,90,30);
panel.add(tnom3relation);
JLabel lnom3pa = new JLabel("PAYABLE AMOUNT");
lnom3pa.setFont(new Font("Times",Font.BOLD,15));
lnom3pa.setBounds(800,35,150,1230);
panel.add(lnom3pa);
JTextField tnom3pa = new JTextField(15);
tnom3pa.setBounds(950,630,90,30);
panel.add(tnom3pa);
JButton show = new JButton("SHOW");
show.setActionCommand("show");
show.setFont(new Font("Times",Font.BOLD,15));
show.setBounds(1100,400,100,40);
panel.add(show);
JButton delete = new JButton("DELETE");
delete.setFont(new Font("Times",Font.BOLD,15));
delete.setActionCommand("update");
delete.setBounds(1100,450,100,40);
panel.add(delete);
JButton reset = new JButton("RESET");
reset.setFont(new Font("Times",Font.BOLD,15));
reset.setActionCommand("reset");
reset.setBounds(1100,500,100,40);
panel.add(reset);
JButton exit = new JButton("EXIT");
exit.setFont(new Font("Times",Font.BOLD,15));
exit.setActionCommand("exit");
exit.setBounds(1100,550,100,40);
panel.add(exit);
exit.addActionListener(this);
reset.addActionListener(this);
show.addActionListener(this);
delete.addActionListener(this);
setTitle("Delete record");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(1250,750);
setVisible(true);
panel.setBackground(Color.pink);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getActionCommand() == "show")
{
if(tID.getText().trim().length()==0)
{
JOptionPane.showMessageDialog(this,"Code cant be left
blank");
return;
}
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE5","
sa","kankarbagh");
stmt=con.prepareStatement("select * from EMPINFO where
code=?");
stmt.setString(1,tID.getText());
ResultSet rs=stmt.executeQuery();
if(!rs.next())
{
JOptionPane.showMessageDialog(this,"Code is not Valid");
}
else
{
tacno.setText(rs.getString(2));
String volume=rs.getString(3).toString().trim();
if(volume.equalsIgnoreCase("1"))
{
cb4.setSelectedIndex(0);
}
if(volume.equalsIgnoreCase("2"))
{
cb4.setSelectedIndex(1);
}
if(volume.equalsIgnoreCase("3"))
{
cb4.setSelectedIndex(2);
}
if(volume.equalsIgnoreCase("4"))
{
cb4.setSelectedIndex(3);
}
if(volume.equalsIgnoreCase("5"))
{
cb4.setSelectedIndex(4);
}
if(volume.equalsIgnoreCase("6"))
{
cb4.setSelectedIndex(5);
}
if(volume.equalsIgnoreCase("7"))
{
cb4.setSelectedIndex(6);
}
if(volume.equalsIgnoreCase("8"))
{
cb4.setSelectedIndex(7);
}
if(volume.equalsIgnoreCase("9"))
{
cb4.setSelectedIndex(8);
}
tfname.setText(rs.getString(4));
tmname.setText(rs.getString(5));
tlname.setText(rs.getString(6));
String sex=rs.getString(7).toString().trim();
if(sex.equalsIgnoreCase("MALE"))
{
rb1.setSelected(true);
}
if(sex.equalsIgnoreCase("FEMALE"))
{
rb2.setSelected(true);
}
tDesignation.setText(rs.getString(8));
tDOB.setText(rs.getString(9));
tdoj.setText(rs.getString(10));
String caste=rs.getString(11).toString().trim();
if(caste.equalsIgnoreCase("GENERAL"))
{
cb1.setSelectedIndex(0);
}
if(caste.equalsIgnoreCase("SC"))
{
cb1.setSelectedIndex(1);
}
if(caste.equalsIgnoreCase("ST"))
{
cb1.setSelectedIndex(2);
}
if(caste.equalsIgnoreCase("OBC"))
{
cb1.setSelectedIndex(2);
}
String religion=rs.getString(12).toString().trim();
if(religion.equalsIgnoreCase("HINDU"))
{
cb2.setSelectedIndex(0);
}
if(religion.equalsIgnoreCase("MUSLIM"))
{
cb2.setSelectedIndex(1);
}
if(religion.equalsIgnoreCase("CHRISTIAN"))
{
cb2.setSelectedIndex(2);
}
if(religion.equalsIgnoreCase("SHIKH"))
{
cb2.setSelectedIndex(3);
}
tfathername.setText(rs.getString(13));
tmobileno.setText(rs.getString(14));
String ms=rs.getString(15).toString().trim();
if(ms.equalsIgnoreCase("SINGLE"))
{
cb3.setSelectedIndex(0);
}
if(ms.equalsIgnoreCase("MARRIED"))
{
cb3.setSelectedIndex(1);
}
if(ms.equalsIgnoreCase("WIDOW"))
{
cb3.setSelectedIndex(2);
}
tspousename.setText(rs.getString(16));
tAddress.setText(rs.getString(17));
tAddress1.setText(rs.getString(18));
tbasic.setText(rs.getString(19));
tidmark.setText(rs.getString(20));
tnominee1.setText(rs.getString(21));
tnominee2.setText(rs.getString(22));
tnominee3.setText(rs.getString(23));
tnom1relation.setText(rs.getString(24));
tnom2relation.setText(rs.getString(25));
tnom3relation.setText(rs.getString(26));
tnom1age.setText(rs.getString(27));
tnom2age.setText(rs.getString(28));
tnom3age.setText(rs.getString(29));
tnom1pa.setText(rs.getString(30));
tnom2pa.setText(rs.getString(31));
tnom3pa.setText(rs.getString(32));
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
if(ae.getActionCommand() == "reset")
{
tacno.setText(" ");
tidmark.setText(" ");
tDesignation.setText(" ");
tID.setText(" ");
tdoj.setText("");
tfname.setText(" ");
tfathername.setText(" ");
tspousename.setText(" ");
tID.setText(" ");
tAddress.setText("");
tAddress1.setText("");
tlname.setText("");
tDOB.setText("");
tmobileno.setText("");
tnominee1.setText("");
tnominee2.setText("");
tnominee3.setText("");
tnom1age.setText("");
tnom2age.setText("");
tnom3age.setText("");
tnom1relation.setText("");
tnom2relation.setText("");
tnom3relation.setText("");
tnom1pa.setText("");
tnom2pa.setText("");
tnom3pa.setText("");
tbasic.setText("");
}
if(ae.getActionCommand() == "delete")
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE5","
sa","kankarbagh");
stmt=con.prepareStatement("Delete from EMPINFO where
code=?");
stmt.setString(1,tID.getText());
stmt.executeUpdate();
con.close();
JOptionPane.showMessageDialog(this,"Records deleted
sucessfully");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,"Record not deleted ");
}
}
if(ae.getActionCommand() == "exit")
System.exit(0);
}
public static void main(String[] args)
{
delete reg=new delete();
}
}
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class GPF extends JFrame implements ActionListener
{
Connection con;
PreparedStatement stat;
public GPF(){
GridBagLayout g = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
JPanel panel = (JPanel)getContentPane();
panel.setLayout(null);
ImageIcon im = new ImageIcon("bseb-logo.jpg");
lvolume.setFont(new Font("Times",Font.BOLD,15));
lvolume.setBounds(100,35,100,200);
panel.add(lvolume);
JComboBox cb4= new JComboBox();
cb4.addItem("1");
cb4.addItem("2");
cb4.addItem("3");
cb4.addItem("4");
cb4.addItem("5");
cb4.addItem("6");
cb4.addItem("7");
cb4.addItem("8");
cb4.addItem("9");
cb4.setBounds(200,120,90,30);
cb4.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb4);
JLabel lcode = new JLabel("CODE");
lcode.setBounds(550,35,100,200);
lcode.setFont(new Font("Times",Font.BOLD,15));
panel.add(lcode);
JTextField tcode = new JTextField(6);
tcode.setBounds(700,120,90,30);
panel.add(tcode);
JLabel lname= new JLabel(" NAME");
lname.setBounds(100,35,100,300);
lname.setFont(new Font("Times",Font.BOLD,15));
panel.add(lname);
JTextField tname = new JTextField(20);
tname.setBounds(200,170,100,30);
panel.add(tname);
JLabel ldesignation = new JLabel("DESIGNATION");
ldesignation.setBounds(550,35,150,300);
ldesignation.setFont(new Font("Times",Font.BOLD,15));
panel.add(ldesignation);
JTextField tDesignation = new JTextField(20);
tDesignation.setBounds(700,170,100,30);
panel.add(tDesignation);
JLabel lcontribution = new JLabel("GPF(C)");
lcontribution.setBounds(100,35,100,400);
lcontribution.setFont(new Font("Times",Font.BOLD,15));
panel.add(lcontribution);
JTextField tcontribution = new JTextField(8);
tcontribution.setBounds(200,220,90,30);
panel.add(tcontribution);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE5","
sa","kankarbagh");
stat=con.prepareStatement("INSERT INTO GPF
VALUES(?,?,?,?)");
String month = tmonth.getText();
String acno = tacno.getText();
String contribution = tcontribution.getText();
String DA = tDA.getText();
stat.setString(1, month);
stat.setString(2, acno);
stat.setFloat(3, Float.parseFloat(contribution));
stat.setFloat(4, Float.parseFloat(DA));
stat.executeUpdate();
JOptionPane.showMessageDialog(this,"Inserted Sucessfully");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
if(ae.getActionCommand() == "reset")
{
tacno.setText(" ");
tvolume.setText(" ");
tcode.setText(" ");
tname.setText(" ");
tmonth.setText(" ");
tcontribution.setText("");
tDesignation.setText("");
tDA.setText("");
tinterest.setText("");
}
if(ae.getActionCommand() == "exit")
dispose();
if(ae.getActionCommand() == "search")
{
if(tacno.getText().trim().length()==0)
{
JOptionPane.showMessageDialog(this,"acno cant be left
blank");
return;
}
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE5","
sa","kankarbagh");
stat=con.prepareStatement("select volume , code , f_name ,
designation from EMPINFO where acno=?");
stat.setString(1,tacno.getText());
ResultSet rs=stat.executeQuery();
if(!rs.next())
{
JOptionPane.showMessageDialog(this,"acno is not Valid");
}
else
{
String volume=rs.getString(1).toString().trim();
if(volume.equalsIgnoreCase("1"))
{
cb4.setSelectedIndex(0);
}
if(volume.equalsIgnoreCase("2"))
{
cb4.setSelectedIndex(1);
}
if(volume.equalsIgnoreCase("3"))
{
cb4.setSelectedIndex(2);
}
if(volume.equalsIgnoreCase("4"))
{
cb4.setSelectedIndex(3);
}
if(volume.equalsIgnoreCase("5"))
{
cb4.setSelectedIndex(4);
}
if(volume.equalsIgnoreCase("6"))
{
cb4.setSelectedIndex(5);
}
if(volume.equalsIgnoreCase("7"))
{
cb4.setSelectedIndex(6);
}
if(volume.equalsIgnoreCase("8"))
{
cb4.setSelectedIndex(7);
}
if(volume.equalsIgnoreCase("9"))
{
cb4.setSelectedIndex(8);
}
tcode.setText(rs.getString(2));
tname.setText(rs.getString(3));
tDesignation.setText(rs.getString(4));
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
}
public static void main(String[] args)
{
GPF reg=new GPF(); }}
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class loan extends JFrame implements ActionListener
{
GridBagLayout g;
GridBagConstraints gbc;
Connection con;
PreparedStatement stat;
public loan()
{
GridBagLayout g = new GridBagLayout();
GridBagConstraints gbc = new GridBagConstraints();
JPanel panel = (JPanel)getContentPane();
panel.setLayout(null);
ImageIcon im = new ImageIcon("bseb-logo.jpg");
JLabel logo = new JLabel(im,JLabel.LEFT);
logo.setBounds(0,2,120,100);
panel.add(logo);
JLabel Head=new JLabel("LOAN FORM");
Head.setFont(new Font("Times",Font.BOLD,24));
Head.setBounds(400,0,900,30);
panel.add(Head);
JLabel lacno= new JLabel("AC/NO");
lacno.setFont(new Font("Times",Font.BOLD,15));
lacno.setBounds(100,35,90,100);
panel.add(lacno);
JTextField tacno = new JTextField(6);
tacno.setBounds(300,70,90,30);
panel.add(tacno);
cb4.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb4);
JLabel lcode= new JLabel("CODE");
lcode.setFont(new Font("Times",Font.BOLD,15));
lcode.setBounds(550,35,50,200);
panel.add(lcode);
JTextField tcode = new JTextField(30);
tcode.setBounds(750,120,90,30);
panel.add(tcode);
JLabel lname= new JLabel(" NAME");
lname.setFont(new Font("Times",Font.BOLD,15));
lname.setBounds(100,35,50,300);
panel.add(lname);
JTextField tname = new JTextField(20);
tname.setBounds(300,170,90,30);
panel.add(tname);
JLabel ldesignation = new JLabel("DESIGNATION");
ldesignation.setFont(new Font("Times",Font.BOLD,15));
ldesignation.setBounds(550,35,150,300);
panel.add(ldesignation);
JTextField tdesignation = new JTextField(30);
tdesignation.setBounds(750,170,90,30);
panel.add(tdesignation);
JLabel lbalance = new JLabel(" GRAND BALANCE");
lbalance.setFont(new Font("Times",Font.BOLD,15));
lbalance.setBounds(100,35,150,400);
panel.add(lbalance);
JTextField tbalance = new JTextField(6);
tbalance.setBounds(300,220,100,30);
panel.add(tbalance);
JLabel lloantype = new JLabel("LOAN TYPE");
lloantype.setFont(new Font("Times",Font.BOLD,15));
lloantype.setBounds(100,35,100,500);
panel.add(lloantype);
JRadioButton rb1 = new JRadioButton("Refundabel");
JRadioButton rb2 = new JRadioButton("Non-Refundabel");
ButtonGroup bg = new ButtonGroup();
rb1.setBounds(300,270,155,30);
rb1.setFont(new Font("Times",Font.BOLD,15));
rb2.setBounds(300,300,155,30);
rb2.setFont(new Font("Times",Font.BOLD,15));
panel.add(rb1);
panel.add(rb2);
bg.add(rb1);
bg.add(rb2);
JLabel lloanamount = new JLabel("LOAN AMOUNT");
lloanamount.setFont(new Font("Times",Font.BOLD,15));
lloanamount.setBounds(550,35,150,500);
panel.add(lloanamount);
JTextField tloanamount = new JTextField(30);
tloanamount.setBounds(750,270,90,30);
panel.add(tloanamount);
JLabel linstallmentno = new JLabel("NO.OF INSTALLMENT");
linstallmentno.setFont(new Font("Times",Font.BOLD,15));
linstallmentno.setBounds(100,35,200,650);
panel.add(linstallmentno);
JTextField tinstallmentno = new JTextField(30);
tinstallmentno.setBounds(300,350,90,30);
panel.add(tinstallmentno);
JLabel linstallmentamt = new JLabel("INSTALLMENT
AMOUNT");
linstallmentamt.setFont(new Font("Times",Font.BOLD,15));
linstallmentamt.setBounds(550,35,200,650);
panel.add(linstallmentamt);
JTextField tinstallmentamt = new JTextField(30);
tinstallmentamt.setBounds(750,350,90,30);
panel.add(tinstallmentamt);
JLabel remarks=new JLabel("REMARKS");
remarks.setFont(new Font("Times",Font.BOLD,15));
remarks.setBounds(200,420,90,30);
panel.add(remarks);
JRadioButton rb3 = new JRadioButton("DAUGHTER
MARRIAGE");
JRadioButton rb4 = new JRadioButton("SON MARRIAGE");
JRadioButton rb5 = new JRadioButton("HOME LOAN");
JRadioButton rb6 = new JRadioButton("CHILD EDUCATION");
ButtonGroup bg1 = new ButtonGroup();
rb3.setBounds(300,430,180,40);
rb3.setFont(new Font("Times",Font.BOLD,15));
rb4.setBounds(300,480,180,40);
rb4.setFont(new Font("Times",Font.BOLD,15));
rb5.setBounds(300,530,180,40);
rb5.setFont(new Font("Times",Font.BOLD,15));
rb6.setBounds(300,580,180,40);
rb6.setFont(new Font("Times",Font.BOLD,15));
panel.add(rb3);
panel.add(rb4);
panel.add(rb5);
panel.add(rb6);
bg1.add(rb3);
bg1.add(rb4);
bg1.add(rb5);
bg1.add(rb6);
JButton show = new JButton("SHOW");
show.setFont(new Font("Times",Font.BOLD,15));
show.setActionCommand("show");
show.setBounds(100,650,100,40);
panel.add(show);
JButton submit = new JButton("SUBMIT");
submit.setFont(new Font("Times",Font.BOLD,15));
submit.setActionCommand("submit");
submit.setBounds(200,650,100,40);
panel.add(submit);
JButton reset = new JButton("RESET");
reset.setFont(new Font("Times",Font.BOLD,15));
reset.setActionCommand("reset");
reset.setBounds(300,650,100,40);
panel.add(reset);
JButton exit = new JButton("EXIT");
exit.setFont(new Font("Times",Font.BOLD,15));
exit.setActionCommand("exit");
exit.setBounds(400,650,100,40);
panel.add(exit);
JButton cal = new JButton("CALCULATE");
cal.setFont(new Font("Times",Font.BOLD,15));
cal.setActionCommand("cal");
cal.setBounds(500,650,130,40);
panel.add(cal);
exit.addActionListener(this);
submit.addActionListener(this);
reset.addActionListener(this);
show.addActionListener(this);
cal.addActionListener(this);
setTitle("Loan details");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(900,800);
setVisible(true);
panel.setBackground(Color.pink);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getActionCommand() == "submit")
{
System.out.println(" Executing...");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE5","
sa","kankarbagh");
stat=con.prepareStatement("INSERT INTO LOAN
VALUES(? , ? , ?,?, ? ,?,? )");
String acno = tacno.getText();
String date = tdate.getText();
String loantype="";
if(rb1.isSelected())
{
loantype="Refundable";
}
if(rb2.isSelected())
{
loantype="Non Refundable";
}
String loanamount = tloanamount.getText();
String installmentno = tinstallmentno.getText();
stat.setString(5, installmentno);
stat.setString(6, installmentamt);
stat.setString(7,remarks);
stat.executeUpdate();
JOptionPane.showMessageDialog(this,"Inserted Sucessfully");
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
if(ae.getActionCommand() == "reset")
{
tacno.setText(" ");
tvolume.setText(" ");
tcode.setText(" ");
tdate.setText(" ");
tloanamount.setText(" ");
tname.setText("");
tdesignation.setText("");
rb1.setSelected(false);
rb2.setSelected(false);
tinstallmentno.setText("");
tinstallmentamt.setText("");
}
if(ae.getActionCommand() == "exit")
System.exit(0);
if(ae.getActionCommand() == "cal")
{
Float inst,lamt,iamt;
inst = Float.parseFloat(tinstallmentno.getText());
lamt =Float.parseFloat(tloanamount.getText());
iamt = lamt/inst;
tinstallmentamt.setText(String.valueOf(iamt));
}
if(ae.getActionCommand() == "show")
{
if(tacno.getText().trim().length()==0)
{
JOptionPane.showMessageDialog(this,"acno cant be left
blank");
return;
}
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE5","
sa","kankarbagh");
stat=con.prepareStatement("select volume , code , f_name ,
designation from EMPINFO where acno=?");
stat.setString(1,tacno.getText());
ResultSet rs=stat.executeQuery();
if(!rs.next())
{
JOptionPane.showMessageDialog(this,"acno is not Valid");
}
else
{
String volume=rs.getString(1).toString().trim();
if(volume.equalsIgnoreCase("1"))
{
cb4.setSelectedIndex(0);
}
if(volume.equalsIgnoreCase("2"))
{
cb4.setSelectedIndex(1);
}
if(volume.equalsIgnoreCase("3"))
{
cb4.setSelectedIndex(2);
}
if(volume.equalsIgnoreCase("4"))
{
cb4.setSelectedIndex(3);
}
if(volume.equalsIgnoreCase("5"))
{
cb4.setSelectedIndex(4);
}
if(volume.equalsIgnoreCase("6"))
{
cb4.setSelectedIndex(5);
}
if(volume.equalsIgnoreCase("7"))
{
cb4.setSelectedIndex(6);
}
if(volume.equalsIgnoreCase("8"))
{
cb4.setSelectedIndex(7);
}
if(volume.equalsIgnoreCase("9"))
{
cb4.setSelectedIndex(8);
}
tcode.setText(rs.getString(2));
tname.setText(rs.getString(3));
tdesignation.setText(rs.getString(4));
tbalance.setText(rs.getString(5));
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
}
public static void main(String[] args)
{
loan reg=new loan(); } }
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class refund extends JFrame implements
ActionListener
{
Connection con;
JComboBox cb4;
PreparedStatement stat;
public refund()
{
GridBagLayout g = new GridBagLayout();
lcode.setBounds(500,35,50,200);
panel.add(lcode);
JTextField tcode = new JTextField(30);
tcode.setBounds(650,120,90,30);
panel.add(tcode);
JLabel lname= new JLabel(" NAME");
lname.setFont(new Font("Times",Font.BOLD,15));
lname.setBounds(150,35,50,300);
panel.add(lname);
JTextField tname = new JTextField(20);
tname.setBounds(250,170,100,30);
panel.add(tname);
JLabel ldesignation = new JLabel("DESIGNATION");
ldesignation.setFont(new Font("Times",Font.BOLD,15));
ldesignation.setBounds(500,35,150,300);
panel.add(ldesignation);
JTextField tdesignation = new JTextField(30);
tdesignation.setBounds(650,170,100,30);
panel.add(tdesignation);
JLabel lloanamount = new JLabel("LOAN");
lloanamount.setFont(new Font("Times",Font.BOLD,15));
lloanamount.setBounds(150,35,100,400);
panel.add(lloanamount);
JTextField tloanamount = new JTextField(10);
tloanamount.setBounds(250,220,90,30);
panel.add(tloanamount);
JLabel lrefundamount = new JLabel("REFUND");
lrefundamount.setFont(new Font("Times",Font.BOLD,15));
lrefundamount.setBounds(150,35,100,500);
panel.add(lrefundamount);
JTextField trefundamount = new JTextField(10);
trefundamount.setBounds(250,270,90,30);
panel.add(trefundamount);
JLabel lbalance = new JLabel("BALANCE");
lbalance.setFont(new Font("Times",Font.BOLD,15));
lbalance.setBounds(500,35,100,500);
panel.add(lbalance);
JTextField tbalance = new JTextField(10);
tbalance.setBounds(650,270,90,30);
panel.add(tbalance);
JButton show = new JButton("SHOW");
show.setFont(new Font("Times",Font.BOLD,15));
show.setActionCommand("show");
show.setBounds(100,400,100,40);
panel.add(show);
JButton submit = new JButton("SUBMIT");
submit.setFont(new Font("Times",Font.BOLD,15));
submit.setActionCommand("submit");
submit.setBounds(200,400,100,40);
panel.add(submit);
JButton reset = new JButton("RESET");
reset.setFont(new Font("Times",Font.BOLD,15));
reset.setActionCommand("reset");
reset.setBounds(300,400,100,40);
panel.add(reset);
JButton cal = new JButton("CALCULATE");
cal.setFont(new Font("Times",Font.BOLD,15));
cal.setActionCommand("cal");
cal.setBounds(400,400,150,40);
panel.add(cal);
JButton exit = new JButton("EXIT");
exit.setActionCommand("exit");
exit.setFont(new Font("Times",Font.BOLD,15));
exit.setBounds(550,400,100,40);
panel.add(exit);
exit.addActionListener(this);
submit.addActionListener(this);
reset.addActionListener(this);
show.addActionListener(this);
cal.addActionListener(this);
setTitle("Refund details");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(800,500);
setVisible(true);
panel.setBackground(Color.pink);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getActionCommand() == "submit")
{
System.out.println(" Executing...");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE5","
sa","kankarbagh");
stat=con.prepareStatement("INSERT INTO REFUND VALUES(? ,
? , ? , ? )");
bal = lamt-ramt;
tbalance.setText(String.valueOf(bal));
}
if(ae.getActionCommand() == "reset")
{
tacno.setText(" ");
tvolume.setText(" ");
tcode.setText(" ");
tdate.setText(" ");
tloanamount.setText(" ");
tname.setText(" ");
tdesignation.setText(" ");
tbalance.setText(" ");
trefundamount.setText(" ");
}
if(ae.getActionCommand() == "exit")
System.exit(0);
if(ae.getActionCommand() == "show")
{
if(tacno.getText().trim().length()==0)
{
}
if(volume.equalsIgnoreCase("2"))
{
cb4.setSelectedIndex(1);
}
if(volume.equalsIgnoreCase("3"))
{
cb4.setSelectedIndex(2);
}
if(volume.equalsIgnoreCase("4"))
{
cb4.setSelectedIndex(3);
}
if(volume.equalsIgnoreCase("5"))
{
cb4.setSelectedIndex(4);
}
if(volume.equalsIgnoreCase("6"))
{
cb4.setSelectedIndex(5);
}
if(volume.equalsIgnoreCase("7"))
{
cb4.setSelectedIndex(6);
}
if(volume.equalsIgnoreCase("8"))
{
cb4.setSelectedIndex(7);
}
if(volume.equalsIgnoreCase("9"))
{
cb4.setSelectedIndex(8);
}
tcode.setText(rs.getString(2));
tname.setText(rs.getString(3));
tdesignation.setText(rs.getString(4));
tloanamount.setText(rs.getString(5));
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
}
public static void main(String[] args)
{
refund r=new refund();
}
}
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class show extends JFrame implements
ActionListener
Connection con;
PreparedStatement stmt;
public show()
{
panel.add(tID);
JLabel lacno= new JLabel("AC/NO");
lacno.setBounds(600,35,90,100);
lacno.setFont(new Font("Times",Font.BOLD,15));
panel.add(lacno);
JTextField tacno = new JTextField(5);
tacno.setBounds(760,70,90,30);
panel.add(tacno);
JLabel lvolume= new JLabel("VOLUME");
lvolume.setBounds(920,35,90,100);
lvolume.setFont(new Font("Times",Font.BOLD,15));
panel.add(lvolume);
JComboBox cb1= new JComboBox();
cb1.addItem("1");
cb1.addItem("2");
cb1.addItem("3");
cb1.addItem("4");
cb1.addItem("5");
cb1.addItem("6");
cb1.addItem("7");
cb1.addItem("8");
cb1.addItem("9");
cb1.setBounds(1050,70,90,30);
cb1.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb1);
panel.add(tlname);
JLabel lsex = new JLabel("SEX");
lsex.setBounds(40,35,90,300);
lsex.setFont(new Font("Times",Font.BOLD,15));
panel.add(lsex);
JRadioButton rb1 = new JRadioButton("MALE");
JRadioButton rb2 = new JRadioButton("FEMALE");
ButtonGroup bg = new ButtonGroup();
rb1.setBounds(250,170,80,30);
rb1.setFont(new Font("Times",Font.BOLD,15));
rb2.setBounds(340,170,100,30);
rb2.setFont(new Font("Times",Font.BOLD,15));
panel.add(rb1);
panel.add(rb2);
bg.add(rb1);
bg.add(rb2);
JLabel lDesignation = new JLabel("DESIGNATION");
lDesignation.setBounds(600,35,150,300);
lDesignation.setFont(new Font("Times",Font.BOLD,15));
panel.add(lDesignation);
JTextField tDesignation = new JTextField(20);
tDesignation.setBounds(760,170,150,30);
panel.add(tDesignation);
JLabel lDOB = new JLabel("DATE OF BIRTH");
lDOB.setBounds(40,35,150,400);
lDOB.setFont(new Font("Times",Font.BOLD,15));
panel.add(lDOB);
JTextField tDOB = new JTextField(30);
tDOB.setBounds(250,220,90,30);
panel.add(tDOB);
JLabel ldoj = new JLabel("DATE OF JOINING");
ldoj.setBounds(600,30,150,400);
ldoj.setFont(new Font("Times",Font.BOLD,15));
panel.add(ldoj);
JTextField tdoj = new JTextField(30);
tdoj.setBounds(760,220,90,30);
panel.add(tdoj);
JLabel lcaste = new JLabel("CASTE");
lcaste.setBounds(40,35,90,500);
lcaste.setFont(new Font("Times",Font.BOLD,15));
panel.add(lcaste);
lfathername.setFont(new Font("Times",Font.BOLD,15));
panel.add(lfathername);
JTextField tfathername = new JTextField(30);
tfathername.setBounds(250,320,200,30);
panel.add(tfathername);
JLabel lmobileno = new JLabel("MOBILE NO");
lmobileno.setBounds(600,35,140,600);
lmobileno.setFont(new Font("Times",Font.BOLD,15));
panel.add(lmobileno);
JTextField tmobileno = new JTextField(30);
tmobileno.setBounds(760,320,90,30);
panel.add(tmobileno);
JLabel lmaritalstatus = new JLabel("MARITAL STATUS");
lmaritalstatus.setBounds(40,35,150,700);
lmaritalstatus.setFont(new Font("Times",Font.BOLD,15));
panel.add(lmaritalstatus);
JComboBox cb3 = new JComboBox();
cb3.addItem("SINGLE");
cb3.addItem("MARRIED");
cb3.addItem("WIDOW");
cb3.setBounds(250,370,100,30);
cb3.setFont(new Font("Times",Font.BOLD,15));
panel.add(cb3);
JLabel lspousename = new JLabel("SPOUSE NAME");
lspousename.setBounds(40,35,150,800);
lspousename.setFont(new Font("Times",Font.BOLD,15));
panel.add(lspousename);
JTextField tspousename = new JTextField(30);
tspousename.setBounds(250,420,200,30);
panel.add(tspousename);
JLabel lAddress = new JLabel("PRESENT ADDRESS");
lAddress.setBounds(40,35,150,900);
lAddress.setFont(new Font("Times",Font.BOLD,15));
panel.add(lAddress);
JTextField tAddress = new JTextField(30);
tAddress.setBounds(250,470,200,30);
panel.add(tAddress);
JLabel lAddress1 = new JLabel("PERMANENT ADDRESS");
lAddress1.setBounds(600,35,200,900);
lAddress1.setFont(new Font("Times",Font.BOLD,15));
panel.add(lAddress1);
JTextField tAddress1 = new JTextField(30);
tAddress1.setBounds(780,470,200,30);
panel.add(tAddress1);
lnom1age.setBounds(440,30,90,1100);
lnom1age.setFont(new Font("Times",Font.BOLD,15));
panel.add(lnom1age);
JTextField tnom1age = new JTextField(2);
tnom1age.setBounds(490,570,90,30);
panel.add(tnom1age);
JLabel lnom1relation = new JLabel("RELATION");
lnom1relation.setFont(new Font("Times",Font.BOLD,15));
lnom1relation.setBounds(600,30,90,1100);
panel.add(lnom1relation);
JTextField tnom1relation = new JTextField(15);
tnom1relation.setBounds(690,570,90,30);
panel.add(tnom1relation);
JLabel lnom1pa = new JLabel("PAYABLE AMOUNT");
lnom1pa.setFont(new Font("Times",Font.BOLD,15));
lnom1pa.setBounds(800,30,150,1100);
panel.add(lnom1pa);
JTextField tnom1pa = new JTextField(15);
tnom1pa.setBounds(950,570,90,30);
panel.add(tnom1pa);
JLabel lnominee2 = new JLabel("NOMINEE 2");
lnominee2.setFont(new Font("Times",Font.BOLD,15));
lnominee2.setBounds(40,35,100,1160);
panel.add(lnominee2);
JTextField tnominee2 = new JTextField(30);
tnominee2.setBounds(250,600,150,30);
panel.add(tnominee2);
JLabel lnom2age = new JLabel("AGE");
lnom2age.setFont(new Font("Times",Font.BOLD,15));
lnom2age.setBounds(440,35,90,1160);
panel.add(lnom2age);
JTextField tnom2age = new JTextField(2);
tnom2age.setBounds(490,600,90,30);
panel.add(tnom2age);
JLabel lnom2relation = new JLabel("RELATION");
lnom2relation.setBounds(600,35,90,1160);
lnom2relation.setFont(new Font("Times",Font.BOLD,15));
panel.add(lnom2relation);
JTextField tnom2relation = new JTextField(15);
tnom2relation.setBounds(690,600,90,30);
panel.add(tnom2relation);
lnom2pa = new JLabel("PAYABLE AMOUNT");
lnom2pa.setFont(new Font("Times",Font.BOLD,15));
lnom2pa.setBounds(800,35,150,1160);
panel.add(lnom2pa);
JTextField tnom2pa = new JTextField(15);
tnom2pa.setBounds(950,600,90,30);
panel.add(tnom2pa);
JLabel lnominee3 = new JLabel("NOMINEE 3");
lnominee3.setBounds(40,35,100,1230);
lnominee3.setFont(new Font("Times",Font.BOLD,15));
panel.add(lnominee3);
JTextField tnominee3 = new JTextField(30);
tnominee3.setBounds(250,630,150,30);
panel.add(tnominee3);
JLabel lnom3age = new JLabel(" AGE");
lnom3age.setBounds(440,35,90,1230);
panel.add(lnom3age);
JTextField tnom3age = new JTextField(2);
lnom3age.setFont(new Font("Times",Font.BOLD,15));
tnom3age.setBounds(490,630,90,30);
panel.add(tnom3age);
JLabel lnom3relation = new JLabel("RELATION");
lnom3relation.setFont(new Font("Times",Font.BOLD,15));
lnom3relation.setBounds(600,35,90,1230);
panel.add(lnom3relation);
exit.setActionCommand("exit");
exit.setBounds(1100,500,100,40);
panel.add(exit);
exit.addActionListener(this);
reset.addActionListener(this);
show.addActionListener(this);
setTitle("Employee details");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(1300,1300);
setVisible(true);
panel.setBackground(Color.pink);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getActionCommand() == "show")
{
if(tID.getText().trim().length()==0)
{
JOptionPane.showMessageDialog(this,"Code cant be left
blank");
return;
}
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE5",
"sa","kankarbagh");
stmt=con.prepareStatement("select * from EMPINFO where
code=?");
stmt.setString(1,tID.getText());
ResultSet rs=stmt.executeQuery();
if(!rs.next())
{
JOptionPane.showMessageDialog(this,"Code is not Valid");
}
else
{
tacno.setText(rs.getString(2));
String volume=rs.getString(3).toString().trim();
if(volume.equalsIgnoreCase("1"))
{
cb4.setSelectedIndex(0);
}
if(volume.equalsIgnoreCase("2"))
{
cb4.setSelectedIndex(1);
}
if(volume.equalsIgnoreCase("3"))
{
cb4.setSelectedIndex(2);
}
if(volume.equalsIgnoreCase("4"))
{
cb4.setSelectedIndex(3);
}
if(volume.equalsIgnoreCase("5"))
{
cb4.setSelectedIndex(4);
}
if(volume.equalsIgnoreCase("6"))
{
cb4.setSelectedIndex(5);
}
if(volume.equalsIgnoreCase("7"))
{
cb4.setSelectedIndex(6);
}
if(volume.equalsIgnoreCase("8"))
{
cb4.setSelectedIndex(7);
}
if(volume.equalsIgnoreCase("9"))
{
cb4.setSelectedIndex(8);
}
tfname.setText(rs.getString(4));
tmname.setText(rs.getString(5));
tlname.setText(rs.getString(6));
String sex=rs.getString(7).toString().trim();
if(sex.equalsIgnoreCase("MALE"))
{
rb1.setSelected(true);
}
if(sex.equalsIgnoreCase("FEMALE"))
{
rb2.setSelected(true);
}
tDesignation.setText(rs.getString(8));
tDOB.setText(rs.getString(9));
tdoj.setText(rs.getString(10));
String caste=rs.getString(11).toString().trim();
if(caste.equalsIgnoreCase("GENERAL"))
{
cb1.setSelectedIndex(0);
}
if(caste.equalsIgnoreCase("SC"))
{
cb1.setSelectedIndex(1);
}
if(caste.equalsIgnoreCase("ST"))
{
cb1.setSelectedIndex(2);
}
if(caste.equalsIgnoreCase("OBC"))
{
cb1.setSelectedIndex(2);
}
String religion=rs.getString(12).toString().trim();
if(religion.equalsIgnoreCase("HINDU"))
{
cb2.setSelectedIndex(0);
}
if(religion.equalsIgnoreCase("MUSLIM"))
{
cb2.setSelectedIndex(1);
}
if(religion.equalsIgnoreCase("CHRISTIAN"))
{
cb2.setSelectedIndex(2);
}
if(religion.equalsIgnoreCase("SHIKH"))
{
cb2.setSelectedIndex(3);
}
tfathername.setText(rs.getString(13));
tmobileno.setText(rs.getString(14));
String ms=rs.getString(15).toString().trim();
if(ms.equalsIgnoreCase("SINGLE"))
{
cb3.setSelectedIndex(0);
}
if(ms.equalsIgnoreCase("MARRIED"))
{
cb3.setSelectedIndex(1);
}
if(ms.equalsIgnoreCase("WIDOW"))
{
cb3.setSelectedIndex(2);
}
tspousename.setText(rs.getString(16));
tAddress.setText(rs.getString(17));
tAddress1.setText(rs.getString(18));
tbasic.setText(rs.getString(19));
tidmark.setText(rs.getString(20));
tnominee1.setText(rs.getString(21));
tnominee2.setText(rs.getString(22));
tnominee3.setText(rs.getString(23));
tnom1relation.setText(rs.getString(24));
tnom2relation.setText(rs.getString(25));
tnom3relation.setText(rs.getString(26));
tnom1age.setText(rs.getString(27));
tnom2age.setText(rs.getString(28));
tnom3age.setText(rs.getString(29));
tnom1pa.setText(rs.getString(30));
tnom2pa.setText(rs.getString(31));
tnom3pa.setText(rs.getString(32));
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
if(ae.getActionCommand() == "reset")
{
tacno.setText(" ");
tidmark.setText(" ");
tDesignation.setText(" ");
tID.setText(" ");
tdoj.setText("");
tfname.setText(" ");
tfathername.setText(" ");
tspousename.setText(" ");
tID.setText(" ");
tAddress.setText("");
tAddress1.setText("");
tlname.setText("");
tDOB.setText("");
tmobileno.setText("");
tnominee1.setText("");
tnominee2.setText("");
tnominee3.setText("");
tnom1age.setText("");
tnom2age.setText("");
tnom3age.setText("");
tnom1relation.setText("");
tnom2relation.setText("");
tnom3relation.setText("");
tnom1pa.setText("");
tnom2pa.setText("");
tnom3pa.setText("");
tbasic.setText("");
}
if(ae.getActionCommand() == "exit")
dispose();
}
public static void main(String[] args)
{
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class ldet extends JFrame implements ActionListener
{
JPanel panel;
JLabel Head;
JLabel lname;
JLabel lacno;
JLabel ldesignation;
JLabel lbalance;
JLabel lloanamount;
JLabel refundamt;
JButton reset;
JButton exit;
JButton show;
JTextField tacno;
JTextField tbalance;
JTextField trefundamt;
JTextField tname;
JTextField tloanamount;
JTextField tdesignation;
GridBagLayout g;
GridBagConstraints gbc;
Connection con;
PreparedStatement stat;
public ldet()
{
g = new GridBagLayout();
gbc = new GridBagConstraints();
panel = (JPanel)getContentPane();
panel.setLayout(null);
ImageIcon im = new ImageIcon("bseb-logo.jpg");
panel.add(tname);
ldesignation = new JLabel("DESIGNATION");
ldesignation.setFont(new Font("Times",Font.BOLD,15));
ldesignation.setBounds(100,35,150,300);
panel.add(ldesignation);
tdesignation = new JTextField(30);
tdesignation.setFont(new Font("Times",Font.BOLD,15));
tdesignation.setBounds(300,170,90,30);
panel.add(tdesignation);
lloanamount = new JLabel("LOAN AMOUNT");
lloanamount.setFont(new Font("Times",Font.BOLD,15));
lloanamount.setBounds(100,35,150,400);
panel.add(lloanamount);
tloanamount = new JTextField(30);
tloanamount.setFont(new Font("Times",Font.BOLD,15));
tloanamount.setBounds(300,220,90,30);
panel.add(tloanamount);
refundamt = new JLabel("REFUND AMOUNT");
refundamt.setFont(new Font("Times",Font.BOLD,15));
refundamt.setBounds(100,35,200,500);
panel.add(refundamt);
trefundamt = new JTextField(30);
trefundamt.setFont(new Font("Times",Font.BOLD,15));
trefundamt.setBounds(300,270,90,30);
panel.add(trefundamt);
lbalance = new JLabel("BALANCE");
lbalance .setFont(new Font("Times",Font.BOLD,15));
lbalance .setBounds(100,35,200,600);
panel.add(lbalance );
tbalance = new JTextField(30);
tbalance .setFont(new Font("Times",Font.BOLD,15));
tbalance.setBounds(300,320,90,30);
panel.add(tbalance);
show = new JButton("SHOW");
show.setFont(new Font("Times",Font.BOLD,15));
show.setActionCommand("show");
show.setBounds(500,70,90,40);
panel.add(show);
reset = new JButton("RESET");
reset.setFont(new Font("Times",Font.BOLD,15));
reset.setActionCommand("reset");
reset.setBounds(500,120,90,40);
panel.add(reset);
exit = new JButton("EXIT");
exit.setFont(new Font("Times",Font.BOLD,15));
exit.setActionCommand("exit");
exit.setBounds(500,170,90,40);
panel.add(exit);
exit.addActionListener(this);
reset.addActionListener(this);
show.addActionListener(this);
setTitle("Loan details");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(650,350);
setVisible(true);
panel.setBackground(Color.pink);
}public void actionPerformed(ActionEvent ae)
{
if(ae.getActionCommand() == "reset")
{
tacno.setText(" ");
tloanamount.setText(" ");
tname.setText("");
tdesignation.setText("");
trefundamt.setText("");
tbalance.setText("");
}
if(ae.getActionCommand() == "exit")
dispose();
if(ae.getActionCommand() == "show")
{
if(tacno.getText().trim().length()==0)
{
JOptionPane.showMessageDialog(this,"acno cant be left
blank");
return;
}
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE5",
"sa","kankarbagh");
stat=con.prepareStatement("select f_name , designation ,
l_amount , refund , balance from EMPINFO,LOAN,REFUND
where EMPINFO.ACNO=LOAN.ACNO and
LOAN.ACNO=REFUND.ACNO and REFUND.ACNO =?");
stat.setString(1,tacno.getText());
ResultSet rs=stat.executeQuery();
if(!rs.next())
{
JOptionPane.showMessageDialog(this,"acno is not Valid");
}
else
{
tname.setText(rs.getString(1));
tdesignation.setText(rs.getString(2));
tloanamount.setText(rs.getString(3));
trefundamt.setText(rs.getString(4));
tbalance.setText(rs.getString(5));
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
}
public static void main(String[] args)
{
ldet reg=new ldet();
}
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class gpfdet extends JFrame implements
ActionListener
{
JPanel panel;
JLabel Head;
JLabel lacno;
JLabel ldesignation;
JLabel lname;
JLabel lbalance;
JLabel lgrand;
JLabel cont;
JButton reset;
JButton exit;
JButton show;
JTextField tacno;
JTextField tbalance;
JTextField tcont;
JTextField tname;
JTextField total;
JTextField tdesignation;
JTextField tgrand;
GridBagLayout g;
GridBagConstraints gbc;
Connection con;
PreparedStatement stat;
public gpfdet()
{
g = new GridBagLayout();
gbc = new GridBagConstraints();
panel = (JPanel)getContentPane();
panel.setLayout(null);
ImageIcon im = new ImageIcon("bseb-logo.jpg");
JLabel logo = new JLabel(im,JLabel.LEFT);
logo.setBounds(0,2,120,100);
panel.add(logo);
Head=new JLabel("GPF DETAIL");
Head.setFont(new Font("Times",Font.BOLD,24));
Head.setBounds(300,0,900,30);
panel.add(Head);
lacno= new JLabel("AC/NO");
lacno.setFont(new Font("Times",Font.BOLD,15));
lacno.setBounds(100,35,90,100);
panel.add(lacno);
tacno = new JTextField(6);
tacno.setFont(new Font("Times",Font.BOLD,15));
tacno.setBounds(300,70,90,30);
panel.add(tacno);
lname= new JLabel(" NAME");
lname.setFont(new Font("Times",Font.BOLD,15));
lname.setBounds(100,35,50,200);
panel.add(lname);
tname = new JTextField(20);
tname.setFont(new Font("Times",Font.BOLD,15));
tname.setBounds(300,120,90,30);
panel.add(tname);
ldesignation = new JLabel("DESIGNATION");
ldesignation.setFont(new Font("Times",Font.BOLD,15));
ldesignation.setBounds(100,35,150,300);
panel.add(ldesignation);
tdesignation = new JTextField(30);
tdesignation.setFont(new Font("Times",Font.BOLD,15));
tdesignation.setBounds(300,170,90,30);
panel.add(tdesignation);
lbalance = new JLabel("BALANCE(B/F)");
lbalance.setFont(new Font("Times",Font.BOLD,15));
lbalance.setBounds(100,35,150,400);
panel.add(lbalance);
tbalance = new JTextField(30);
tbalance.setFont(new Font("Times",Font.BOLD,15));
tbalance.setBounds(300,220,90,30);
panel.add(tbalance);
cont = new JLabel("CONTRIBUTION AMOUNT");
cont.setFont(new Font("Times",Font.BOLD,15));
cont.setBounds(100,35,200,500);
panel.add(cont);
tcont = new JTextField(30);
tcont.setFont(new Font("Times",Font.BOLD,15));
tcont.setBounds(300,270,90,30);
panel.add(tcont);
lgrand = new JLabel("GRAND TOTAL");
lgrand .setFont(new Font("Times",Font.BOLD,15));
lgrand .setBounds(100,35,200,600);
panel.add(lgrand );
tgrand = new JTextField(30);
tgrand .setFont(new Font("Times",Font.BOLD,15));
tgrand.setBounds(300,320,90,30);
panel.add(tgrand);
show = new JButton("SHOW");
show.setFont(new Font("Times",Font.BOLD,15));
show.setActionCommand("show");
show.setBounds(500,70,90,40);
panel.add(show);
reset = new JButton("RESET");
reset.setFont(new Font("Times",Font.BOLD,15));
reset.setActionCommand("reset");
reset.setBounds(500,120,90,40);
panel.add(reset);
exit = new JButton("EXIT");
exit.setFont(new Font("Times",Font.BOLD,15));
exit.setActionCommand("exit");
exit.setBounds(500,170,90,40);
panel.add(exit);
exit.addActionListener(this);
reset.addActionListener(this);
show.addActionListener(this);
setTitle("Loan details");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(650,450);
setVisible(true);
panel.setBackground(Color.pink);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getActionCommand() == "reset")
{
tacno.setText(" ");
tgrand.setText(" ");
tname.setText("");
tdesignation.setText("");
tcont.setText("");
tbalance.setText("");
}
if(ae.getActionCommand() == "exit")
dispose();
if(ae.getActionCommand() == "show")
{
if(tacno.getText().trim().length()==0)
{
JOptionPane.showMessageDialog(this,"acno cant be left
blank");
return;
}
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE5",
"sa","kankarbagh");
stat=con.prepareStatement("select
f_name,designation,GPF_B_F,CONTRIBUTED from
EMPINFO,GPFSUMMARY,GPF where
EMPINFO.ACNO=GPFSUMMARY.ACNO and
GPFSUMMARY.ACNO=GPF.ACNO and GPF.ACNO =?");
stat.setString(1,tacno.getText());
ResultSet rs=stat.executeQuery();
if(!rs.next())
{
JOptionPane.showMessageDialog(this,"acno is not Valid");
}
else
{
tname.setText(rs.getString(1));
tdesignation.setText(rs.getString(2));
tbalance.setText(rs.getString(3));
tcont.setText(rs.getString(4));
Float ba,cont,tot;
ba = Float.parseFloat(tbalance.getText());
cont =Float.parseFloat(tcont.getText());
tot = ba+cont;
tgrand.setText(String.valueOf(tot));
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e);
}
}
}
public static void main(String[] args)
{
gpfdet reg=new gpfdet();
}
}
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.standard.*;
import javax.print.*;
import java.lang.Object;
{
panel = new JPanel()
{protected void paintcomponent(Graphics g)
{
g.drawLine(10,170,1250,170);
}
};
cn=getContentPane();
panel.setOpaque(false);
panel.setPreferredSize(new Dimension(1,1));
cn.add(panel);
panel.setLayout(null);
panel.addMouseListener(this);
File.add(Print);
File.addSeparator();
File.add(PageSetup);
File.addSeparator();
File.add(Exit);
File.addSeparator();
Print.addActionListener(this);
PageSetup.addActionListener(this);
Exit.addActionListener(this);
addcomp(250,0,200,100,l);
addcomp(350,0,500,30,head);
head.setFont(new Font("Algerian",Font.BOLD,24));
addcomp(520,100,400,30,head1);
head1.setFont(new Font("Times",Font.BOLD,15));
addcomp(900,20,100,30,new JLabel("MONTH"));
addcomp(1000,20,100,30,new JLabel("AUGUST"));
addcomp(900,40,100,30,new JLabel("VOLUME"));
addcomp(1000,40,100,30,new JLabel("1"));
addcomp(10,140,100,30,new JLabel("CODE"));
addcomp(100,140,100,30,new JLabel("NAME"));
addcomp(260,140,100,30,new JLabel("DESIGNATION"));
addcomp(440,140,100,30,new JLabel("BASIC"));
addcomp(580,140,100,30,new JLabel("ACCOUNT NO."));
addcomp(720,140,100,30,new JLabel("GPF(C)"));
addcomp(820,140,100,30,new JLabel("GPF-DA"));
addcomp(920,140,100,30,new JLabel("GPF(R)"));
addcomp(1020,140,100,30,new JLabel("TOTAL Rs"));
try
{
int r=170;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE5",
"sa","kankarbagh");
stmt = con.createStatement();
rs =stmt.executeQuery("select
CODE,F_name,Designation,basic,EMPINFO.ACNO,CONTRIBUT
ED,DA,REFUND,TOT from EMPINFO,GPF,REFUND WHERE
EMPINFO.ACNO = GPF.ACNO and GPF.ACNO = REFUND.ACNO
and REFUND.ACNO = GPF.ACNO");
while(rs.next())
{
addcomp(10,r,100,30,new JLabel(rs.getString("CODE")));
addcomp(100,r,100,30,new JLabel(rs.getString("F_name")));
addcomp(260,r,200,30,new
JLabel(rs.getString("Designation")));
addcomp(440,r,100,30,new JLabel(rs.getString("basic")));
addcomp(580,r,100,30,new JLabel(rs.getString("ACNO")));
addcomp(720,r,100,30,new
JLabel(rs.getString("CONTRIBUTED")));
addcomp(820,r,100,30,new JLabel(rs.getString("DA")));
addcomp(920,r,100,30,new JLabel(rs.getString("REFUND")));
addcomp(1020,r,100,30,new JLabel(rs.getString("TOT")));
r=r+25;
}
}
PATNA WOMEN’S COLLEGE Page 229
GPF MANAGMENT SYSTEM
catch(SQLException e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
}
setBounds(0,0,1250,740);
setTitle("monthly detail");
setResizable(false);
setVisible(true);
}
public void addcomp(int x,int y,int w,int h,Container cn)
{
cn.setBounds(x,y,w,h);
panel.add(cn);
}
public int print(Graphics g,PageFormat pageformat,int
pageindex)
{
if(pageindex>0)
return NO_SUCH_PAGE;
Graphics2D g2D=(Graphics2D)g;
double scalex=pageformat.getImageableWidth()/getWidth();
double
scaley=pageformat.getImageableHeight()/getHeight();
double scale = Math.min(scalex,scaley);
g2D.translate(pageformat.getImageableX(),pageformat.getI
mageableY());
g2D.scale(scale,scale);
print(g2D);
return PAGE_EXISTS;
}
public void actionPerformed(ActionEvent ae)
{
String com=ae.getActionCommand();
if(com.equals("EXIT"))
dispose();
else if(com.equals("PAGE SETUP"))
{
pm.showPageSetup();
}
else if(com.equals("PRINT"))
{
pm.doPrint();
}
}
public void mousePressed(MouseEvent e)
{
if(e.getButton()==MouseEvent.BUTTON3)
{
if(e.getModifiers()!=0)
{
File.show(this,e.getX(),e.getY());
}
}
}
public void mouseClicked(MouseEvent e){}
public void mouseReleased(MouseEvent e){}
public void mouseEntered(MouseEvent e){}
public void mouseExited(MouseEvent e){}
public static void main(String [] args)
{
new monthreport(); } }
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.standard.*;
import javax.print.*;
import java.lang.Object;
public class yearreport extends JFrame implements
ActionListener,Printable,MouseListener
PATNA WOMEN’S COLLEGE Page 233
GPF MANAGMENT SYSTEM
{
Connection con;
Statement stmt;
ResultSet rs;
JPopupMenu File = new JPopupMenu("FILE");
JMenuItem Print = new JMenuItem("PRINT");
JMenuItem PageSetup = new JMenuItem("PAGE SETUP");
JMenuItem Exit = new JMenuItem("EXIT");
JLabel head = new JLabel("BIHAR STATE ELECTRICITY
BOARD",JLabel.CENTER);
JLabel head1 = new JLabel("YEARLY STATEMENT");
ImageIcon logo = new ImageIcon("bseb-logo.jpg");
JLabel l = new JLabel(logo,JLabel.LEFT);
PrintManager pm = new
PrintManager(this.getRootPane(),"REPORT PRINTING");
PrinterJob printerjob = PrinterJob.getPrinterJob();
PageFormat pageformat = printerjob.defaultPage();
PrintService printer = printerjob.getPrintService();
Container cn;
JPanel panel;
public yearreport()
{
addcomp(250,0,200,100,l);
addcomp(350,0,500,30,head);
head.setFont(new Font("Algerian",Font.BOLD,24));
addcomp(520,100,400,30,head1);
head1.setFont(new Font("Times",Font.BOLD,15));
addcomp(10,140,100,30,new JLabel("AC/NO"));
addcomp(100,140,100,30,new JLabel("NAME"));
addcomp(250,140,100,30,new JLabel("DESIGNATION"));
addcomp(460,140,100,30,new JLabel("GPF(B/F)"));
addcomp(680,140,100,30,new JLabel("INTEREST"));
addcomp(880,140,100,30,new JLabel("GPF(C) Rs"));
addcomp(1080,140,100,30,new JLabel("GPF(C/F)"));
try
{
int r=170;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE","
sa","kankarbagh");
stmt = con.createStatement();
rs =stmt.executeQuery("select EMPINFO.ACNO,F_NAME
,DESIGNATION,GPF_B_F,INTEREST,G_C,G_TOTAL from
EMPINFO, GPFSUMMARY WHERE empinfo.ACNO =
gpfsummary.ACNO");
PATNA WOMEN’S COLLEGE Page 236
GPF MANAGMENT SYSTEM
while(rs.next())
{
addcomp(10,r,100,30,new
JLabel(String.valueOf(rs.getString(1))));
addcomp(100,r,100,30,new JLabel(rs.getString(2)));
addcomp(250,r,200,30,new JLabel(rs.getString(3)));
addcomp(460,r,100,30,new JLabel(rs.getString(4)));
addcomp(680,r,100,30,new JLabel(rs.getString(5)));
addcomp(880,r,100,30,new JLabel(rs.getString(6)));
addcomp(1080,r,100,30,new JLabel(rs.getString(7)));
r=r+25;
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
}
setBounds(0,0,1250,740);
setTitle("GPF SUMMARY REPORT");
setResizable(false);
setVisible(true);
}
String com=ae.getActionCommand();
if(com.equals("EXIT"))
dispose();
else if(com.equals("PAGE SETUP"))
{
pm.showPageSetup();
}
else if(com.equals("PRINT"))
{
pm.doPrint();
}
}
public void mousePressed(MouseEvent e)
{
if(e.getButton()==MouseEvent.BUTTON3)
{
if(e.getModifiers()!=0)
{
File.show(this,e.getX(),e.getY());
}
}
}
import javax.swing.*;
import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.print.*;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.standard.*;
import javax.print.*;
import java.lang.Object;
public class empreport extends JFrame implements
ActionListener,Printable,MouseListener
{
Connection con;
Statement stmt;
ResultSet rs;
JPopupMenu File = new JPopupMenu("FILE");
JMenuItem Print = new JMenuItem("PRINT");
JMenuItem PageSetup = new JMenuItem("PAGE SETUP");
JMenuItem Exit = new JMenuItem("EXIT");
JLabel head = new JLabel("BIHAR STATE ELECTRICITY
BOARD",JLabel.CENTER);
panel.setPreferredSize(new Dimension(1,1));
cn.add(panel);
panel.setLayout(null);
panel.addMouseListener(this);
addcomp(0,0,200,100,l);
addcomp(0,20,800,30,head);
head.setFont(new Font("Algerian",Font.BOLD,24));
addcomp(0,50,800,30,head1);
head1.setFont(new Font("Times",Font.BOLD,15));
File.add(Print);
File.addSeparator();
File.add(PageSetup);
File.addSeparator();
File.add(Exit);
File.addSeparator();
Print.addActionListener(this);
PageSetup.addActionListener(this);
Exit.addActionListener(this);
addcomp(750,20,100,30,new JLabel("Financial Year"));
addcomp(900,20,100,30,new JLabel("2011-2012"));
addcomp(750,40,100,30,new JLabel("Interest"));
addcomp(900,40,100,30,new JLabel("8%"));
addcomp(30,100,100,30,new JLabel("VOLUME"));
addcomp(230,140,100,30,new JLabel("AC/NO"));
addcomp(230,170,100,30,new JLabel("NAME"));
addcomp(230,200,100,30,new JLabel("DESIGNATION"));
addcomp(230,230,100,30,new JLabel("BALANCE(B/F)"));
addcomp(230,260,150,30,new
JLabel("GPF(CONTRIBUTION)"));
addcomp(230,290,100,30,new JLabel("LOAN REFUNDED"));
addcomp(230,320,150,30,new JLabel("INTEREST
ACCUMULATE"));
addcomp(230,350,100,30,new JLabel("TOTAL "));
addcomp(230,380,100,30,new JLabel("LOAN BALANCE"));
addcomp(230,410,100,30,new JLabel("GRAND TOTAL"));
String ac = JOptionPane.showInputDialog(this,"ENTER
AC/NO");
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con =
DriverManager.getConnection("jdbc:odbc:MYDATASOURCE","
sa","kankarbagh");
stmt = con.createStatement();
rs =stmt.executeQuery("select
volume,empinfo.ACNO,F_NAME,DESIGNATION,gpf_B_F,CONTRI
BUTED,REFUND,INTEREST,TOT,L_amount,G_TOTAL from
EMPINFO, GPF,refund,gpfsummary,loan WHERE
EMPINFO.ACNO=GPF.ACNO and
EMPINFO.ACNO=REFUND.ACNO and
EMPINFO.ACNO='"+ac+"'");
rs.next();
addcomp(130,100,100,30,new JLabel(rs.getString(1)));
addcomp(600,140,100,30,new JLabel(rs.getString(2)));
addcomp(600,170,100,30,new JLabel(rs.getString(3)));
addcomp(600,200,200,30,new JLabel(rs.getString(4)));
addcomp(600,230,100,30,new JLabel(rs.getString(5)));
addcomp(600,260,100,30,new JLabel(rs.getString(6)));
addcomp(600,290,100,30,new JLabel(rs.getString(7)));
addcomp(600,320,100,30,new JLabel(rs.getString(8)));
addcomp(600,350,100,30,new JLabel(rs.getString(9)));
addcomp(600,380,100,30,new JLabel(rs.getString(10)));
addcomp(600,410,100,30,new JLabel(rs.getString(11)));
}
catch(Exception e)
{
JOptionPane.showMessageDialog(this,e.getMessage());
}
setBounds(40,40,1000,500);
setTitle("YEARLY STATEMENT");
setResizable(false);
setVisible(true);
panel.setBackground(Color.WHITE);
}
public void addcomp(int x,int y,int w,int h,Container cn)
{
cn.setBounds(x,y,w,h);
panel.add(cn);
}
public int print(Graphics g,PageFormat pageFormat,int
pageIndex)
{
if(pageIndex>0)
return NO_SUCH_PAGE;
Graphics2D g2D=(Graphics2D)g;
double scalex =
pageFormat.getImageableWidth()/getWidth();
double
scaley=pageFormat.getImageableHeight()/getHeight();
double scale = Math.min(scalex,scaley);
g2D.translate(pageFormat.getImageableX(),pageFormat.getI
mageableY());
g2D.scale(scale,scale);
print(g2D);
return PAGE_EXISTS;
}
public void actionPerformed(ActionEvent ae)
{
String com=ae.getActionCommand();
if(com.equals("EXIT"))
dispose();
else if(com.equals("PAGE SETUP"))
{
pm.showPageSetup();
}
else if(com.equals("PRINT"))
{
pm.doPrint();
}
}
public void mousePressed(MouseEvent e)
{
if(e.getButton()==MouseEvent.BUTTON3)
{
if(e.getModifiers()!=0)
{
File.show(this,e.getX(),e.getY());
}
}
}
public void mouseClicked(MouseEvent e){}
public void mouseReleased(MouseEvent e){}
public void mouseEntered(MouseEvent e){}
public void mouseExited(MouseEvent e){}
public static void main(String [] args)
{
new empreport();
}
}
SYSTEM TESTING
AND
IMPLEMENTATION
PATNA WOMEN’S COLLEGE Page 249
GPF MANAGMENT SYSTEM
SYSTEM TESTING
Software testing is an investigation conducted to provide stake
holders with information about the quality of the allow the
business to appreciate and understand the risk at implementation
of the software . Test techniques include, but are limited to, the
process of executing a program or application with the intent of
finding software bucks. So, system testing is vital to the success of
the system . The first step in the testing is to prepare a plan that
tests all aspects of a system in a way that promotes its credibility
among potential user.
Test Plan:
The test plan is an important , but often overlooked, product of
software design. A test plane prescribes various kinds of activities
that will be performed to demonstrate that the software product
meets its requirements.
Integration and Testing:
After unit testing, the designers for the code developed by the
tester also carried out integration testing. Integration testing tests
the dependencies between different screens of the application in
the same module or
across module .
System Testing:
System testing makes a logical assumption that if all the parts of
the system are correct, the goal will be successfully achieved . A
small error can conceivably explode into much larger problem.
The best program is worthless if it does not meet user needs.
IMPLEMENTATION
RUN TIME
WINDOWS
PROJECT MAINTENANCE
MAINTAINABILITY
The maintenance phase of the software life cycle is the
time period in which a software product performs useful
work. Generally , it takes 5 times more than development
PATNA WOMEN’S COLLEGE Page 276
GPF MANAGMENT SYSTEM
CONCLUSION
The answer to information technology is a theoretical and
an empirical, hands on discipline . The objective of this
project is to maintaining the employee GPF system . We get
practical experience of working on a large project , has
given us a chance to put into practice of the software
development concepts that we have only been studied in
BIBLIOGRAPHY
BIBLIOGRAPHY
Books Reference
THANK
YOU
PATNA WOMEN’S COLLEGE Page 281
GPF MANAGMENT SYSTEM