/
EmployeeHome.java
118 lines (105 loc) · 3.01 KB
/
EmployeeHome.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
import java.lang.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class EmployeeHome extends JFrame implements ActionListener
{
JLabel title;
JButton changepass,managedriver,myinfo,logout,businfo,back,borrowinfo;
JLabel imgLabel;
JPanel panel;
ImageIcon img;
String UserId;
public EmployeeHome(String UserId)
{
super("Employee Home ");
this.UserId=UserId;
this.setSize(800, 500);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Color myColor3=new Color(50,210,210);
panel =new JPanel();
panel.setLayout(null);
panel.setBackground(Color.white);
img = new ImageIcon("emp.png");
imgLabel = new JLabel(img);
imgLabel.setBounds(50,20,300,300);
panel.add(imgLabel);
logout=new JButton(" Log out ");
logout.setBounds(50,380,280,50);
logout.setBackground(Color.red);
logout.addActionListener(this);
panel.add(logout);
title= new JLabel("Welcome, "+ UserId);
title.setBounds(400,20,200,50);
panel.add(title);
myinfo = new JButton("My Information");
myinfo.setBounds(450,100,280,50);
myinfo.setBackground(myColor3);
myinfo.addActionListener(this);
panel.add(myinfo);
managedriver=new JButton("Manage Driver");
managedriver.setBounds(450,200,280,50);
managedriver.setBackground(Color.green);
managedriver.addActionListener(this);
panel.add(managedriver);
businfo=new JButton("Bus Information");
businfo.setBounds(450,300,280,50);
businfo.setBackground(Color.yellow);
businfo.addActionListener(this);
panel.add(businfo);
borrowinfo=new JButton("Borrow Information");
borrowinfo.setBounds(450,400,280,50);
borrowinfo.setBackground(Color.orange);
borrowinfo.addActionListener(this);
panel.add(borrowinfo);
back=new JButton("Back");
back.setBounds(650,10,80,40);
back.setBackground(Color.blue);
back.setForeground(Color.white);
back.addActionListener(this);
panel.add(back);
this.add(panel);
}
public void actionPerformed(ActionEvent ae)
{
String text=ae.getActionCommand();
if(text.equals(logout.getText()))
{
LogIn ln=new LogIn();
ln.setVisible(true);
this.setVisible(false);
}
else if(text.equals(back.getText()))
{
LogIn ln=new LogIn();
ln.setVisible(true);
this.setVisible(false);
}
else if(text.equals(myinfo.getText()))
{
EmployeeInfo ei=new EmployeeInfo(UserId);
ei.setVisible(true);
this.setVisible(false);
ei.autoInfoE(UserId);
}
else if(text.equals(managedriver.getText()))
{
ManageDriver md=new ManageDriver(UserId);
md.setVisible(true);
this.setVisible(false);
}
else if(text.equals(businfo.getText()))
{
BusInfo bi=new BusInfo(UserId);
bi.setVisible(true);
this.setVisible(false);
}
else if(text.equals(borrowinfo.getText()))
{
BorrowE be=new BorrowE(UserId);
be.setVisible(true);
this.setVisible(false);
}
}
}