0% found this document useful (0 votes)
5 views22 pages

Ex9 Connectivity

The document outlines a lab assignment for UCS2411 focusing on database programming using JDBC/ODBC. It includes the creation of an 'emp' table and a PL/SQL procedure for calculating employee pay based on various parameters. Additionally, it provides Java code for a graphical user interface to manage employee records, including functionalities for inserting, updating, searching, and deleting employee data.

Uploaded by

Jayasree Files
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views22 pages

Ex9 Connectivity

The document outlines a lab assignment for UCS2411 focusing on database programming using JDBC/ODBC. It includes the creation of an 'emp' table and a PL/SQL procedure for calculating employee pay based on various parameters. Additionally, it provides Java code for a graphical user interface to manage employee records, including functionalities for inserting, updating, searching, and deleting employee data.

Uploaded by

Jayasree Files
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

UCS2411 – Database Management System Lab

Assignment - 9
Database Programming using JDBC/ODBC

Jithu Morrison S
3122225001051
Creating emp table

Java
create table emp(
emp_id varchar2(4) constraint emp_pk primary key,
name varchar2(20),
basic number(6),
design varchar2(20),
dob date,
sex char(1),
hra number(6),
da number(6),
pf number(6),
mc number(6),
gross number(6),
td number(6),
net_pay number(6)
);

PL/SQL Procedure block

Java
CREATE OR REPLACE PROCEDURE pay( e_id IN VARCHAR2, basic IN NUMBER)
AS
pda NUMBER;
phra NUMBER;
ppf NUMBER;
pmc NUMBER;
pgross NUMBER;
ptd NUMBER;
pnet_pay NUMBER;
BEGIN
phra := basic * 0.11;
pda := basic * 0.6;
ppf := basic * 0.04;
pmc := basic * 0.03;
pgross := basic * 1.71;
ptd := basic * 0.07;
pnet_pay := basic * 1.64;
UPDATE emp
SET
hra = phra,
da = pda,
pf = ppf,
mc = pmc,
gross = pgross,
td = ptd,
net_pay = pnet_pay
WHERE emp_id = e_id;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line("");
END;
/

CODE:

Java
package ex9;
import javax.swing.*;
import java.sql.*;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
*
* @author WPL
*/
public class emp extends javax.swing.JFrame {
Connection con;
Statement st;
PreparedStatement ps;
ResultSet rs;
/**
* Creates new form emp
*/
public emp() {
initComponents();
try{
Class.forName("oracle.jdbc.OracleDriver");
JOptionPane.showMessageDialog(this,"Driver Loaded!");
try {
con =
DriverManager.getConnection("jdbc:oracle:thin:@10.6.4.33:1521:orcl","cse1046","
ssn");

JOptionPane.showMessageDialog(this,"Connected to Oracle database!");


}
catch (SQLException ex) {
Logger.getLogger(emp.class.getName()).log(Level.SEVERE,null, ex);
JOptionPane.showMessageDialog(this,ex.getMessage());
}
}
catch(ClassNotFoundException ex){
Logger.getLogger(emp.class.getName()).log(Level.SEVERE,null, ex);
JOptionPane.showMessageDialog(this,ex.getMessage());

}
}

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jlabel1 = new javax.swing.JLabel();


emp_id = new javax.swing.JTextField();
jlabel2 = new javax.swing.JLabel();
emp_name = new javax.swing.JTextField();
jlabel3 = new javax.swing.JLabel();
emp_sal = new javax.swing.JTextField();
Clear = new javax.swing.JButton();
Insert = new javax.swing.JButton();
Search = new javax.swing.JButton();
Delete = new javax.swing.JButton();
Update = new javax.swing.JButton();
jlabel4 = new javax.swing.JLabel();
jlabel5 = new javax.swing.JLabel();
jlabel6 = new javax.swing.JLabel();
jlabel7 = new javax.swing.JLabel();
design = new javax.swing.JTextField();
sex = new javax.swing.JTextField();
dob = new javax.swing.JTextField();
net_pay = new javax.swing.JTextField();
jlabel8 = new javax.swing.JLabel();
da = new javax.swing.JTextField();
jlabel9 = new javax.swing.JLabel();
hra = new javax.swing.JTextField();
pf = new javax.swing.JTextField();
jlabel10 = new javax.swing.JLabel();
mc = new javax.swing.JTextField();
jlabel11 = new javax.swing.JLabel();
emp_id5 = new javax.swing.JTextField();
gross = new javax.swing.JTextField();
jlabel13 = new javax.swing.JLabel();
td = new javax.swing.JTextField();
jlabel14 = new javax.swing.JLabel();
jlabel12 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jlabel1.setText("Employee id");

jlabel2.setText("Employee name");

jlabel3.setText("Net Pay");

emp_sal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
emp_salActionPerformed(evt);
}
});

Clear.setText("Clear");
Clear.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ClearActionPerformed(evt);
}
});

Insert.setText("Insert");
Insert.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
InsertActionPerformed(evt);
}
});

Search.setText("Search");
Search.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
SearchActionPerformed(evt);
}
});

Delete.setText("Delete");
Delete.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
DeleteActionPerformed(evt);
}
});

Update.setText("Update");
Update.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
UpdateActionPerformed(evt);
}
});

jlabel4.setText("Designation");

jlabel5.setText("DOB");

jlabel6.setText("Sex");

jlabel7.setText("Basic salary");

jlabel8.setText("Toal_deduction");
jlabel9.setText("DA");

jlabel10.setText("PF");

jlabel11.setText("MC");

jlabel13.setText("GROSS");

jlabel14.setText("HRA");

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(

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

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addContainerGap()

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

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING
, false)

.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
layout.createSequentialGroup()
.addComponent(jlabel1)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(emp_id,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE))

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

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jlabel2)
.addComponent(jlabel7))
.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(emp_sal,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(emp_name,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(design,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(sex,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(dob,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Insert))))
.addComponent(jlabel4)
.addComponent(jlabel5)
.addComponent(jlabel6))

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jlabel9)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(da,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jlabel10)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(pf,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jlabel11)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(mc,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jlabel13)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(gross,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE))

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

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(hra,
javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(emp_id5,
javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addComponent(jlabel8)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 19,
Short.MAX_VALUE)
.addComponent(td,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addComponent(jlabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(net_pay,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()

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

.addGroup(layout.createSequentialGroup()
.addGap(44, 44, 44)
.addComponent(jlabel12)))
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup(layout.createSequentialGroup()
.addGap(48, 48, 48)
.addComponent(Search)
.addGap(0, 0, Short.MAX_VALUE))))
.addGroup(layout.createSequentialGroup()
.addGap(38, 38, 38)
.addComponent(Clear)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(Delete)
.addGap(59, 59, 59)
.addComponent(Update)
.addGap(17, 17, 17)))
.addGap(30, 30, 30))
);
layout.setVerticalGroup(

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

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

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(jlabel1)
.addComponent(emp_id,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(hra,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

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

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(jlabel2)
.addComponent(emp_name,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlabel9)
.addComponent(da,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))

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

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(emp_sal,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlabel10)
.addComponent(pf,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlabel7))

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

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(jlabel4)
.addComponent(design,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlabel11)
.addComponent(mc,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(7, 7, 7)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(jlabel5)
.addComponent(dob,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlabel13)
.addComponent(gross,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(emp_id5,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlabel14))

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

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(jlabel6)
.addComponent(sex,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jlabel8)
.addComponent(td,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)))

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

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jlabel12)
.addGap(85, 85, 85))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(net_pay,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jlabel3))
.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(Insert)
.addComponent(Search))
.addGap(18, 18, 18)))

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

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(Update)
.addComponent(Delete)))
.addContainerGap(14, Short.MAX_VALUE))
);

pack();
}// </editor-fold>
private void refresh(){
emp_id.setText("");
emp_name.setText("");
emp_sal.setText("");
design.setText("");
dob.setText("");
sex.setText("");
hra.setText("");
da.setText("");
pf.setText("");
mc.setText("");
gross.setText("");
td.setText("");
net_pay.setText("");
}
private void ClearActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:


refresh();
}

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

// TODO add your handling code here:


try {
String sql = "insert into emp
values(?,?,?,?,?,?,?*0.11,?*0.6,?*0.04,?*0.03,?*1.71,?*.07,?*1.64)";
ps = con.prepareStatement(sql);
ps.setString(1, emp_id.getText());
ps.setString(2, emp_name.getText());
ps.setString(3, emp_sal.getText());
ps.setString(4, design.getText());
ps.setString(5, dob.getText());
ps.setString(6, sex.getText());
ps.setString(7, emp_sal.getText());
ps.setString(8, emp_sal.getText());
ps.setString(9, emp_sal.getText());
ps.setString(10, emp_sal.getText());
ps.setString(11, emp_sal.getText());
ps.setString(12, emp_sal.getText());
ps.setString(13, emp_sal.getText());

ps.execute();
JOptionPane.showMessageDialog(this,"Inserted!");
}
catch (SQLException ex) {
Logger.getLogger(emp.class.getName()).log(Level.SEVERE,null, ex);
JOptionPane.showMessageDialog(this,ex.getMessage());
}

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

// TODO add your handling code here:


try {
String sql = "select * from emp where
emp_id='"+emp_id.getText()+"'";
st=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATAB
LE);
//ps = con.prepareStatement(sql);
//ps.setString(1, emp_id.getText());
rs=st.executeQuery(sql);
if(rs.next()){
emp_id.setText(rs.getString(1));
emp_name.setText(rs.getString(2));
emp_sal.setText(rs.getString(3));
design.setText(rs.getString(4));
dob.setText((rs.getString(5)).substring(0,11));
sex.setText(rs.getString(6));
hra.setText(rs.getString(7));
da.setText(rs.getString(8));
pf.setText(rs.getString(9));
mc.setText(rs.getString(10));
gross.setText(rs.getString(11));
td.setText(rs.getString(12));
net_pay.setText(rs.getString(13));
JOptionPane.showMessageDialog(this,"Record fetched!");
}
else{
JOptionPane.showMessageDialog(this,"Record not fetched!");
}}
catch (SQLException ex) {
Logger.getLogger(emp.class.getName()).log(Level.SEVERE,null, ex);
JOptionPane.showMessageDialog(this,ex.getMessage());
}

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

// TODO add your handling code here:


try {
String sql = "delete from emp where emp_id=?";
ps = con.prepareStatement(sql);
ps.setString(1, emp_id.getText());
ps.execute();
JOptionPane.showMessageDialog(this,"Deleted!");
}
catch (SQLException ex) {
Logger.getLogger(emp.class.getName()).log(Level.SEVERE,null, ex);
JOptionPane.showMessageDialog(this,ex.getMessage());
}

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

try {
String sql = "update emp set
basic=?,hra=?*0.11,da=?*0.6,pf=?*0.04,mc=?*0.03,gross=?*1.71,td=?*0.07,net_pay=
?*1.64 where emp_id=?";
ps = con.prepareStatement(sql);
ps.setString(9, emp_id.getText());
ps.setString(1, emp_sal.getText());
ps.setString(2, emp_sal.getText());
ps.setString(3, emp_sal.getText());
ps.setString(4, emp_sal.getText());
ps.setString(5, emp_sal.getText());
ps.setString(6, emp_sal.getText());
ps.setString(7, emp_sal.getText());
ps.setString(8, emp_sal.getText());
ps.execute();
JOptionPane.showMessageDialog(this,"Updated!");
}
catch (SQLException ex) {
Logger.getLogger(emp.class.getName()).log(Level.SEVERE,null, ex);
JOptionPane.showMessageDialog(this,ex.getMessage());
}

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

// TODO add your handling code here:


}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the
default look and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {

java.util.logging.Logger.getLogger(emp.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(emp.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(emp.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(emp.class.getName()).log(java.util.logging.L
evel.SEVERE, null, ex);
}
//</editor-fold>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new emp().setVisible(true);
}
});
}
// Variables declaration - do not modify
// End of variables declaration
// Variables declaration - do not modify
private javax.swing.JButton Clear;
private javax.swing.JButton Delete;
private javax.swing.JButton Insert;
private javax.swing.JButton Search;
private javax.swing.JButton Update;
private javax.swing.JTextField da;
private javax.swing.JTextField design;
private javax.swing.JTextField dob;
private javax.swing.JTextField emp_id;
private javax.swing.JTextField emp_id5;
private javax.swing.JTextField emp_name;
private javax.swing.JTextField emp_sal;
private javax.swing.JTextField gross;
private javax.swing.JTextField hra;
private javax.swing.JLabel jlabel1;
private javax.swing.JLabel jlabel10;
private javax.swing.JLabel jlabel11;
private javax.swing.JLabel jlabel12;
private javax.swing.JLabel jlabel13;
private javax.swing.JLabel jlabel14;
private javax.swing.JLabel jlabel2;
private javax.swing.JLabel jlabel3;
private javax.swing.JLabel jlabel4;
private javax.swing.JLabel jlabel5;
private javax.swing.JLabel jlabel6;
private javax.swing.JLabel jlabel7;
private javax.swing.JLabel jlabel8;
private javax.swing.JLabel jlabel9;
private javax.swing.JTextField mc;
private javax.swing.JTextField net_pay;
private javax.swing.JTextField pf;
private javax.swing.JTextField sex;
private javax.swing.JTextField td;
// End of variables declaration
}
SAMPLE I/O:

You might also like