-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEmployee_GUI.java
More file actions
83 lines (69 loc) · 2.43 KB
/
Copy pathEmployee_GUI.java
File metadata and controls
83 lines (69 loc) · 2.43 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
/**
* When an employee logs in, this is loaded and shows
* everything that an employee can do
*
* Dalton Lee
* 1.0
* 2/28/2016
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
@SuppressWarnings("serial")
public class Employee_GUI extends JFrame implements ActionListener
{
String ID;
private JButton settings = new JButton ("Settings");
private JButton shipment = new JButton ("Receive Shipment");
private JButton checkOut = new JButton ("Check-out");
@SuppressWarnings("unused")
public static void main (String [] args) /**For Testing*/
{
Employee_GUI test = new Employee_GUI ("8496738");
}
/**
* Constructor for objects of class Employee_View
*/
public Employee_GUI(String emp)
{
ID = emp;
this.setTitle ("ID: " + ID);
this.setLayout(null);
settings.addActionListener(this);
shipment.addActionListener(this);
checkOut.addActionListener(this);
/**Absolute Positioning of the components*/
Insets insets = this.getInsets(); /**The dimentsions of the JFrame*/
/**Adding components*/
this.add (settings);
settings.setBounds (365 + insets.left, 20 + insets.top,
100, 25);
this.add (shipment);
shipment.setBounds (90 + insets.left, 145 + insets.top,
150, 50);
this.add (checkOut);
checkOut.setBounds (265 + insets.left, 145 + insets.top,
150, 50);
this.setPreferredSize(new Dimension(500,400));
this.setDefaultCloseOperation(EXIT_ON_CLOSE);
this.pack(); /**Opens in the middle of the screen*/
this.setLocationRelativeTo(null); /**Opens in the middle of the screen*/
this.setVisible(true);
}
public void actionPerformed (ActionEvent e)
{
String action = e.getActionCommand();
if (e.getSource() == settings) /**Settings button with gear picture*/
{
System.out.println ("Settings");
}
else if (action.equals ("Receive Shipment"))
{
//Shipment_GUI shipmentInterface = new Shipment_GUI (ID);
}
else if (action.equals ("Check-out"))
{
JOptionPane.showMessageDialog(null, "Check-out GUI");
}
}
}