-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplayScreen.java
More file actions
212 lines (158 loc) · 6.17 KB
/
Copy pathdisplayScreen.java
File metadata and controls
212 lines (158 loc) · 6.17 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
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
//Required packages
package mainframe;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
public class displayScreen extends JFrame implements ActionListener {
private JPanel mainPanel = new JPanel();
private JPanel panel_1 = new JPanel();
private JPanel panel_2 = new JPanel();
private JPanel mainPanel1 = new JPanel();
private JPanel mainPanel2 = new JPanel();
private JPanel mainPanel3 = new JPanel();
private JPanel mainPanel4 = new JPanel();
private JPanel mainPanel5 = new JPanel();
private JPanel mainPanel6 = new JPanel();
private JPanel mainPanel7 = new JPanel();
private JPanel mainPanel8 = new JPanel();
private JTabbedPane tabbedPane = new JTabbedPane();
private static final Dimension MAIN_SIZE = new Dimension(400, 400);
private JLabel textType;
private JLabel text1;
private JLabel text2;
private JLabel text3;
private JLabel text4;
private JLabel text5;
private JLabel text6;
private JLabel text7;
private JLabel comment;
private JButton back;
private JButton done;
private JTextField scheduleTypeText = new JTextField(10);
private JTextField number = new JTextField(10);
private JTextField name = new JTextField(10);
private JTextField destinationText = new JTextField(10);
private JTextField departureText = new JTextField(10);
private JTextField destinationDate = new JTextField(10);
private JTextField departureDate = new JTextField(10);
private JTextField seatNumber = new JTextField(10);
private JTextField hotelName = new JTextField(10);
private JTextField contact1 = new JTextField(10);
private JTextField contact2 = new JTextField(10);
public displayScreen(Integer id) {
super("SCHEDULE DETAILS");
ImageIcon icon = new ImageIcon("C:\\Users\\Win\\Documents\\NetBeansProjects\\mainFrame\\build\\aggarwal_Project\\icon.gif");
tabbedPane.addTab("PAGE-1",icon, panel_1,
"SCHEDULE DETAILS - SCREEN 1");
tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);
tabbedPane.addTab("PAGE-2", icon, panel_2,
"SCHEDULE DETAILS - SCREEN 1");
tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);
textType = new JLabel("SCHEDULE TYPE:");
text3 = new JLabel("DEPARTURE DATE:");
text4 = new JLabel("ARRIVAL DATE:");
text1 = new JLabel("TRAVELLING FROM :");
text2 = new JLabel("TO");
text5 = new JLabel ("SEAT NUMBER:");
text6 = new JLabel ("STAYING AT");
text7 = new JLabel("IMPORTANT CONTACTS");
comment = new JLabel("PRESS -> OR CLICK ON THE NEXT TAB ON THE TOP TO TURN TO NEXT PAGE");
back = new JButton("BACK");
done = new JButton("DONE");
scheduleTypeText.setEditable(false);
number.setEditable(false);
name.setEditable(false);
destinationText.setEditable(false);
departureText.setEditable(false);
destinationDate.setEditable(false);
departureDate.setEditable(false);
seatNumber.setEditable(false);
hotelName.setEditable(false);
contact1.setEditable(false);
contact2.setEditable(false);
mainPanel.add(tabbedPane);
mainPanel1.add(textType);
mainPanel1.add(scheduleTypeText);
mainPanel2.add(text1);
mainPanel2.add(departureText);
mainPanel2.add(text2);
mainPanel2.add(destinationText);
mainPanel3.add(text3);
mainPanel3.add(departureDate);
mainPanel3.add(text4);
mainPanel3.add(destinationDate);
mainPanel4.add(back);
mainPanel4.add(comment);
panel_1.setLayout(new BoxLayout(panel_1, BoxLayout.Y_AXIS));
panel_2.setLayout(new BoxLayout(panel_2, BoxLayout.Y_AXIS));
panel_1.add(mainPanel1);
panel_1.add(mainPanel2);
panel_1.add(mainPanel3);
panel_1.add(mainPanel4);
mainPanel5.add(text5);
mainPanel5.add(seatNumber);
mainPanel6.add(text6);
mainPanel6.add(hotelName);
mainPanel7.add(text7);
mainPanel7.add(contact1);
mainPanel7.add(contact2);
mainPanel8.add(done);
mainPanel8.add(back);
panel_2.add(mainPanel5);
panel_2.add(mainPanel6);
panel_2.add(mainPanel7);
panel_2.add(mainPanel8);
mainPanel.setPreferredSize(MAIN_SIZE);
back.addActionListener(this);
done.addActionListener(this);
/*This action listener defines the
* action of the exit button
* that closes the screen on being used
*/
setDefaultCloseOperation(EXIT_ON_CLOSE);
getContentPane().add(mainPanel);
setSize(500,230);
setVisible(true);
setLocation(200,200);
}
//Function describing the various action events related to the different buttons
public void actionPerformed(ActionEvent evt){
/*The back button direts the user
* back to the edit panel where
* they can enter a new schedule id
* or a set of details
* in order to edit
* or view a schedule
*/
if(evt.getSource()==back){
try {
editSchedule es= new editSchedule(null);
es.setVisible(true);
this.setVisible(false);
} catch (SQLException ex) {
Logger.getLogger(displayScreen.class.getName()).log(Level.SEVERE, null, ex);
}
}
/*The done button re directs
* the end user to the option panel
* and is an indication that the
* user has viewed the scheule in
* a satifactory manner
*/
if(evt.getSource()==done){
try {
optionPanel op= new optionPanel(null);
op.setVisible(true);
this.setVisible(false);
} catch (SQLException ex) {
Logger.getLogger(displayScreen.class.getName()).log(Level.SEVERE, null, ex);
}
}
}}