-
Notifications
You must be signed in to change notification settings - Fork 2
/
CentralPanel.java
80 lines (67 loc) · 2.34 KB
/
CentralPanel.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
import java.awt.*;
import javax.swing.*;
import javax.swing.border.LineBorder;
import java.awt.event.*;
import java.sql.SQLException;
/**
* @category Server Side
* @summary Creates the central panel to take orders from the customers
*/
public class CentralPanel extends JPanel{
CentralPanel() {
JButton entree = new JButton("Entrees"); // entree
JButton sides = new JButton("Sides"); // side
JButton combos = new JButton("Combos"); //meal
JButton extras = new JButton("Extras"); // extra
int w = 200;
int h = 200;
entree.setPreferredSize(new Dimension(w, h));
sides.setPreferredSize(new Dimension(w, h));
combos.setPreferredSize(new Dimension(w, h));
extras.setPreferredSize(new Dimension(w, h));
add(entree);
add(sides);
add(combos);
add(extras);
entree.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
Main.cardlayout.show(Main.cards, "entreePanel");
}
catch(Exception x) {
System.out.println(x.getMessage());
}
}
} );
sides.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
Main.cardlayout.show(Main.cards, "sidesPanel");
}
catch(Exception x) {
System.out.println(x.getMessage());
}
}
} );
extras.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
Main.cardlayout.show(Main.cards, "extrasPanel");
}
catch(Exception x) {
System.out.println(x.getMessage());
}
}
} );
combos.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
try {
Main.cardlayout.show(Main.cards, "combosPanel");
}
catch(Exception x) {
System.out.println(x.getMessage());
}
}
});
}
}