-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathGuiFrame.java
More file actions
87 lines (71 loc) · 2.85 KB
/
Copy pathGuiFrame.java
File metadata and controls
87 lines (71 loc) · 2.85 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
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
//GuiFrame for displaying desk information.
public class GuiFrame extends JFrame {
/* Instant Variable from FlightList, PassengerList and Airport
*
*/
private FlightList flightList;
private PassengerList passengerList;
private Airport airportDesk;
//GUI Components
JScrollPane scrollList;
JSplitPane splitPane1, splitPane2a, splitPane2b;
JTextPane desk1Pane, desk2Pane;
JTextArea displayList, desk1List, desk2List, flight1List, flight2List, flight3List;
JPanel flight1Pane, flight2Pane, flight3Pane;
//Create Frame & panel
public GuiFrame(FlightList flist, PassengerList plist, Airport adesk){
//Set Close by default close button of window
setDefaultCloseOperation(EXIT_ON_CLOSE);
//Set Window Title showing the current desk
setTitle("Desk" );//+ String.format("%-4s", adesk.findCurrentDesk()));
//Set Panels
setupSouthPanel();
setupNorthPanel();
setupCenterPanel();
//pack and set visible
pack();
setVisible(true);
//Pack with CheckInGUI
CheckInGUI cig = new CheckInGUI(flightList, passengerList);
cig.pack();
cig.setVisible(true);
}
//Set NorthPanel for the passenger queue
private void setupNorthPanel() {
displayList = new JTextArea(15,200);
displayList.setFont(new Font (Font.MONOSPACED, Font.PLAIN,14));
displayList.setEditable(false);
//displayList.setText(airportDesk.queueList());
scrollList = new JScrollPane(displayList);
this.add(scrollList,BorderLayout.NORTH);
}
//Set CenterPanel for two desk status
private void setupCenterPanel() {
//Create a split pane with the two text panel for desk 1 and desk 2 status
splitPane1 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, desk1Pane, desk2Pane);
splitPane1.setDividerLocation(100);
desk1Pane.setFont(new Font (Font.MONOSPACED, Font.PLAIN,14));
desk1Pane.setEditable(false);
//desk1Pane.setText(airportDesk.useDesk());
desk2Pane.setFont(new Font (Font.MONOSPACED, Font.PLAIN,14));
desk2Pane.setEditable(false);
//desk2Pane.setText(airportDesk.useDesk());
this.add(splitPane1, BorderLayout.CENTER);
}
//Set SouthPanel for all flights information
private void setupSouthPanel() {
splitPane2a = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, flight1Pane, flight2Pane);
splitPane2b = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, splitPane2a, flight3Pane);
flight1Pane.setBackground(Color.PINK);
flight2Pane.setBackground(Color.ORANGE);
flight3Pane.setBackground(Color.BLUE);
//flight1Pane.setText(flightList.getFlightDetails());
//flight2Pane.setText(flightList.getFlightDetails());
//flight3Pane.setText(flightList.getFlightDetails());
this.add(splitPane2b, BorderLayout.SOUTH);
}
}