-
Notifications
You must be signed in to change notification settings - Fork 0
/
winday1.java
354 lines (297 loc) · 9.88 KB
/
winday1.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
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
package mainvite2;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
public class winday1 {
private JFrame frame;
private JTable table;
private JTextField numWeek;
private JTextField textDay;
private JTextField typeFood;
private dayjCenweek122 numinFormation;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
winday1 window = new winday1();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public winday1() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 320, 360);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JLabel lblNewLabel = new JLabel("Semana del curso:");
lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER);
lblNewLabel.setFont(new Font("Sitka Text", Font.PLAIN, 12));
lblNewLabel.setBounds(21, 125, 113, 21);
frame.getContentPane().add(lblNewLabel);
JLabel lblDa = new JLabel("Día:");
lblDa.setHorizontalAlignment(SwingConstants.CENTER);
lblDa.setFont(new Font("Sitka Text", Font.PLAIN, 12));
lblDa.setBounds(21, 173, 113, 21);
frame.getContentPane().add(lblDa);
JLabel lblNewLabel_2 = new JLabel("¿Qué día es hoy?");
lblNewLabel_2.setFont(new Font("Sitka Heading", Font.BOLD, 20));
lblNewLabel_2.setHorizontalAlignment(SwingConstants.CENTER);
lblNewLabel_2.setBounds(32, 50, 248, 59);
frame.getContentPane().add(lblNewLabel_2);
JLabel lblTipoDeComida = new JLabel("Comida del día:");
lblTipoDeComida.setHorizontalAlignment(SwingConstants.CENTER);
lblTipoDeComida.setFont(new Font("Sitka Text", Font.PLAIN, 12));
lblTipoDeComida.setBounds(21, 234, 113, 21);
frame.getContentPane().add(lblTipoDeComida);
table = new JTable();
table.setBackground(new Color(255, 228, 181));
table.setBounds(0, 50, 314, 53);
frame.getContentPane().add(table);
JButton btnNewButton = new JButton("Main");
btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
frame.dispose();
}
});
btnNewButton.setBackground(new Color(240, 240, 240));
btnNewButton.setBounds(9, 287, 89, 23);
frame.getContentPane().add(btnNewButton);
JButton btnNewButton_1 = new JButton("Siguiente");
btnNewButton_1.setBounds(166, 287, 91, 23);
frame.getContentPane().add(btnNewButton_1);
btnNewButton_1.addMouseListener(new MouseAdapter() {
@SuppressWarnings("unlikely-arg-type")
@Override
public void mouseClicked(MouseEvent e) {
frame.dispose();
String weekNum;
weekNum = numWeek.getText();
String today;
today= textDay.getText();
String foodToday;
foodToday= typeFood.getText();
int numinformation = 0;
boolean fi;
fi=false;
if (weekNum.equals("1") && today.equals("lunes") || today.equals("Lunes")) {
fi=true;
switch (foodToday) {
case "desayuno":
case "Desayuno":
numinformation= 1;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
fi=true;
break;
case "comida":
case "Comida":
numinformation= 2;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
fi=true;
break;
case "cena":
case "Cena":
numinformation= 3;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
fi=true;
break;
}
}
if (weekNum.equals("1") && today.equals("martes")|| today.equals("Martes")) {
switch (foodToday) {
case "desayuno":
case "Desayuno":
numinformation= 4;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
break;
case "comida":
case "Comida":
numinformation= 5;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
break;
case "cena":
case "Cena":
numinformation= 6;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
break;
}
}
if (weekNum.equals("1") && today.equals("miércoles")|| today.equals("miercoles")|| today.equals("Miércoles")|| today.equals("Miercoles")) {
switch (foodToday) {
case "desayuno":
case "Desayuno":
numinformation= 7;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
break;
case "comida":
case "Comida":
numinformation= 8;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
break;
case "cena":
case "Cena":
numinformation= 9;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
break;
}
}
if (weekNum.equals("1") && today.equals("jueves")|| today.equals("Jueves")) {
switch (foodToday) {
case "desayuno":
case "Desayuno":
numinformation= 10;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
break;
case "comida":
case "Comida":
numinformation= 11;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
break;
case "cena":
case "Cena":
numinformation= 12;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
break;
}
}
if (weekNum.equals("3") && today.equals("viernes")|| today.equals("Viernes")) {
switch (foodToday) {
case "desayuno":
case "Desayuno":
numinformation= 13;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
fi=true;
break;
case "comida":
case "Comida":
numinformation= 14;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
fi=true;
break;
case "cena":
case "Cena":
numinformation= 15;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
fi=true;
break;
}
}
if (weekNum.equals("2") && today.equals("lunes") || today.equals("Lunes")) {
fi=true;
switch (foodToday) {
case "desayuno":
case "Desayuno":
numinformation= 16;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
fi=true;
break;
case "comida":
case "Comida":
numinformation= 17;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
fi=true;
break;
case "cena":
case "Cena":
numinformation= 18;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
fi=true;
break;
}
if (weekNum.equals("2") && today.equals("martes") || today.equals("Martes")) {
fi=true;
switch (foodToday) {
case "desayuno":
case "Desayuno":
numinformation= 19;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
fi=true;
break;
case "comida":
case "Comida":
numinformation= 20;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
fi=true;
break;
case "cena":
case "Cena":
numinformation= 21;
numinFormation = new dayjCenweek122 ( numinformation);
numinFormation.setVisibility(true);
fi=true;
break;
}
}
if(fi==false) {
JOptionPane.showMessageDialog(null, "Parece que el día es incorrecto", "title", JOptionPane.ERROR_MESSAGE);
}
}
}
});
numWeek = new JTextField();
numWeek.setBounds(157, 122, 101, 23);
frame.getContentPane().add(numWeek);
numWeek.setColumns(10);
textDay = new JTextField();
textDay.setColumns(10);
textDay.setBounds(157, 170, 101, 23);
frame.getContentPane().add(textDay);
typeFood = new JTextField();
typeFood.setColumns(10);
typeFood.setBounds(156, 232, 101, 23);
frame.getContentPane().add(typeFood);
JLabel lblNewLabel_1 = new JLabel("New label");
lblNewLabel_1.setIcon(new ImageIcon("C:\\Users\\Fiorella\\Documents\\fiorella\\PREPA tec\\SEMESTRE 5\\INFORMATICA 5\\mainhome1.jpg"));
lblNewLabel_1.setBounds(0, 0, 423, 321);
frame.getContentPane().add(lblNewLabel_1);
}
public void setVisibility (boolean visible) {
frame.setVisible(visible);
}
}