Repository navigation
Expand file tree
/
Copy pathSearchDepartmentFrame.java
More file actions
76 lines (52 loc) · 1.63 KB
/
Copy pathSearchDepartmentFrame.java
File metadata and controls
76 lines (52 loc) · 1.63 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
package com.ems.gui.analytics;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Font;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import com.ems.db.DBConnection;
public class LowestAttendanceFrame extends JFrame {
public LowestAttendanceFrame() {
setTitle("Lowest Attendance Employee");
setSize(600,300);
setLocationRelativeTo(null);
setLayout(null);
JLabel label =
new JLabel();
label.setBounds(
50,
100,
500,
30);
label.setFont(
new Font(
"Arial",
Font.BOLD,
18));
add(label);
try {
Connection con =
DBConnection.getConnection();
String query =
"select name,attendance from employee order by attendance asc limit 1";
PreparedStatement ps =
con.prepareStatement(query);
ResultSet rs =
ps.executeQuery();
if(rs.next()) {
label.setText(
"Lowest Employee : "
+ rs.getString("name")
+ " | Attendance : "
+ rs.getInt("attendance")
);
}
con.close();
}
catch(Exception e) {
System.out.println(e);
}
setVisible(true);
}
}