Repository navigation
Expand file tree
/
Copy pathViewProjectsFrame.java
More file actions
93 lines (66 loc) · 1.98 KB
/
Copy pathViewProjectsFrame.java
File metadata and controls
93 lines (66 loc) · 1.98 KB
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
package com.ems.gui.employee;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import com.ems.db.DBConnection;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Font;
public class TotalEmployeesFrame extends JFrame {
public TotalEmployeesFrame() {
setTitle("Total Employees");
setSize(500,300);
setLocationRelativeTo(null);
setLayout(null);
setDefaultCloseOperation(
JFrame.DISPOSE_ON_CLOSE);
JLabel titleLabel =
new JLabel("TOTAL EMPLOYEES");
titleLabel.setBounds(
120,
30,
300,
40);
titleLabel.setFont(
new Font(
"Arial",
Font.BOLD,
24));
add(titleLabel);
JLabel countLabel =
new JLabel(
"Employee Count : 0"
);
try {
Connection con =
DBConnection.getConnection();
String query =
"select count(*) from employee";
PreparedStatement ps =
con.prepareStatement(query);
ResultSet rs =
ps.executeQuery();
if(rs.next()) {
countLabel.setText(
"Employee Count : "
+ rs.getInt(1)
);
}
}
catch(Exception e) {
System.out.println(e);
}
countLabel.setBounds(
140,
120,
250,
30);
countLabel.setFont(
new Font(
"Arial",
Font.PLAIN,
18));
add(countLabel);
setVisible(true);
}
}