-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHome.java
More file actions
71 lines (57 loc) · 2.04 KB
/
Home.java
File metadata and controls
71 lines (57 loc) · 2.04 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
package employee.management.system;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Home extends JFrame implements ActionListener{
JButton view, add, update, remove;
Home() {
setLayout(null);
ImageIcon i1 = new ImageIcon(ClassLoader.getSystemResource("icons/home.jpg"));
Image i2 = i1.getImage().getScaledInstance(1120, 630, Image.SCALE_DEFAULT);
ImageIcon i3 = new ImageIcon(i2);
JLabel image = new JLabel(i3);
image.setBounds(0, 0, 1120, 630);
add(image);
JLabel heading = new JLabel("Employee Management System");
heading.setBounds(620, 20, 400, 40);
heading.setFont(new Font("Raleway", Font.BOLD, 25));
image.add(heading);
add = new JButton("Add Employee");
add.setBounds(650, 80, 150, 40);
add.addActionListener(this);
image.add(add);
view = new JButton("View Employees");
view.setBounds(820, 80, 150, 40);
view.addActionListener(this);
image.add(view);
update = new JButton("Update Employee");
update.setBounds(650, 140, 150, 40);
update.addActionListener(this);
image.add(update);
remove = new JButton("Remove Employee");
remove.setBounds(820, 140, 150, 40);
remove.addActionListener(this);
image.add(remove);
setSize(1120, 630);
setLocation(250, 100);
setVisible(true);
}
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == add) {
setVisible(false);
new AddEmployee();
} else if (ae.getSource() == view) {
setVisible(false);
new ViewEmployee();
} else if (ae.getSource() == update) {
setVisible(false);
new ViewEmployee();
} else {
setVisible(false);
new RemoveEmployee();
}
}
public static void main(String[] args) {
new Home();
}
}