Repository navigation
Expand file tree
/
Copy pathApplyLeaveFrame.java
More file actions
112 lines (77 loc) · 2.75 KB
/
Copy pathApplyLeaveFrame.java
File metadata and controls
112 lines (77 loc) · 2.75 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package com.ems.gui.auth;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JButton;
import javax.swing.JFrame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import com.ems.gui.dashboard.DashboardFrame;
public class LoginFrame extends JFrame {
public LoginFrame() {
setTitle("EMS Login");
setSize(500, 400);
setLocationRelativeTo(null);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(null);
JLabel titleLabel =
new JLabel("Employee Management System");
titleLabel.setBounds(90, 30, 350, 40);
add(titleLabel);
JLabel userLabel =
new JLabel("Username");
userLabel.setBounds(80, 120, 100, 30);
add(userLabel);
JTextField userField =
new JTextField();
userField.setBounds(180, 120, 180, 30);
add(userField);
JLabel passLabel =
new JLabel("Password");
passLabel.setBounds(80, 180, 100, 30);
add(passLabel);
JPasswordField passField =
new JPasswordField();
passField.setBounds(180, 180, 180, 30);
add(passField);
JButton loginButton =
new JButton("Login");
loginButton.addActionListener(
new ActionListener() {
public void actionPerformed(
ActionEvent e
) {
String username =
userField.getText();
String password = String.valueOf(
passField.getPassword());
if(
username.equals("Varshitha")
&&
password.equals("Varshi@*#")
) {
JOptionPane.showMessageDialog(
null,
"Login Successful"
);
new DashboardFrame();
dispose();
}
else {
JOptionPane.showMessageDialog(
null,
"Invalid Username or Password"
);
}
}
}
);
loginButton.setBounds(180, 260, 120, 35);
add(loginButton);
setVisible(true);
}
public static void main(String[] args) {
new LoginFrame();
}
}