-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmployeeInfo.java
101 lines (84 loc) · 2.83 KB
/
EmployeeInfo.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Creating class for get employee information
// Import required packages.....
import net.proteanit.sql.DbUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.ResultSet;
public class EmployeeInfo extends JFrame implements ActionListener {
// Creating Jtable object
JTable tbl;
JButton btn;
// Creating constructor
EmployeeInfo(){
getContentPane().setBackground(Color.GRAY);
setLayout(null);
JLabel head1 = new JLabel ("Employees Information");
head1.setForeground(Color.CYAN);
head1.setBackground(Color.GRAY);
head1.setFont(new Font("Serif",Font.PLAIN,26));
head1.setBounds(500,10,250,40);
add(head1);
JLabel l1 = new JLabel("Employee Name");
l1.setBounds(62,55,110,30);
l1.setForeground(Color.white);
add(l1);
JLabel l2 = new JLabel("ID Number");
l2.setForeground(Color.white);
l2.setBounds(219,55,110,30);
add(l2);
JLabel l3 = new JLabel("Age");
l3.setForeground(Color.white);
l3.setBounds(385,55,110,30);
add(l3);
JLabel l4 = new JLabel("Gender");
l4.setForeground(Color.white);
l4.setBounds(520,55,110,30);
add(l4);
JLabel l5 = new JLabel("Role");
l5.setForeground(Color.white);
l5.setBounds(670,55,110,30);
add(l5);
JLabel l6 = new JLabel("Salary");
l6.setForeground(Color.white);
l6.setBounds(805,55,110,30);
add(l6);
JLabel l7 = new JLabel("Phone number");
l7.setForeground(Color.white);
l7.setBounds(940,55,110,30);
add(l7);
JLabel l8 = new JLabel("Email ID");
l8.setForeground(Color.white);
l8.setBounds(1080,55,110,30);
add(l8);
tbl = new JTable();
tbl.setBounds(40,87,1155,450);
add(tbl);
try{
Connector cn = new Connector();
ResultSet rst = cn.stmt.executeQuery("select * from employee");
tbl.setModel(DbUtils.resultSetToTableModel(rst));
}
catch (Exception er){
er.printStackTrace();
}
btn = new JButton("Back");
btn.setBackground(Color.black);
btn.setForeground(Color.white);
btn.setBounds(555,560,120,35);
btn.setFont(new Font("Serif",Font.PLAIN,20));
btn.addActionListener(this);
add(btn);
setBounds(240,99,1250,650);
setVisible(true);
}
public void actionPerformed(ActionEvent a){
setVisible(false);
new Reception();
}
// Creating main function
public static void main(String[] args) {
new EmployeeInfo();
}
}