Duty.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
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
import javax.swing.event.*;
import java.awt.event.*;
import javax.swing.*;
import java.awt.*;

public class Duty extends JPanel implements ActionListener{
  GridBagConstraints gbc = 
new GridBagConstraints(  );
  String strQuery = 
new String();
  String [] districts = {
"Alpha","Bravo","Charlie","Delta","Echo","Foxtrot"};
  JComboBox districtBox = 
new JComboBox(districts);
  JComboBox dateBox = 
new JComboBox();
  JComboBox monthBox = 
new JComboBox();
  JComboBox yearBox = 
new JComboBox();
  String [] days = {
"Mon","Tue","Wed","Thur","Fri","Sat","Sun"};
  JComboBox dayBox = 
new JComboBox(days);
  String [] stations = {
"1","2","3","4","5","6","7","8","9","10","11","12"};
  JComboBox stationBox = 
new JComboBox(stations);
  String [] watches = {
"A","B","C","D"};
  JComboBox watchBox = 
new JComboBox(watches);
  JTextField  duty = 
new JTextField();

  JTextField  appl_1 = 
new JTextField();
  JTextField  appl_2 = 
new JTextField();
  JTextField  appl_3 = 
new JTextField();
  JTextField  appl_4 = 
new JTextField();
  JTextField  appl_1_1 = 
new JTextField();
  JTextField  appl_1_2 = 
new JTextField();
  JTextField  appl_1_3 = 
new JTextField();
  JTextField  appl_1_4 = 
new JTextField();
  JTextField  appl_1_5 = 
new JTextField();
  JTextField  d_o_1 = 
new JTextField();
  JTextField  appl_2_1 = 
new JTextField();
  JTextField  appl_2_2 = 
new JTextField();
  JTextField  appl_2_3 = 
new JTextField();
  JTextField  appl_2_4 = 
new JTextField();
  JTextField  appl_2_5 = 
new JTextField();
  JTextField  appl_3_1 = 
new JTextField();
  JTextField  appl_3_2 = 
new JTextField();
  JTextField  appl_3_3 = 
new JTextField();
  JTextField  appl_3_4 = 
new JTextField();
  JTextField  appl_4_1 = 
new JTextField();
  JTextField  appl_4_2 = 
new JTextField();
  JTextField  appl_4_3 = 
new JTextField();
  JTextField  appl_4_4 = 
new JTextField();

  JTextField  ltr_1 = 
new JTextField();
  JTextField  ltr_2 = 
new JTextField();
  JTextField  ltr_3 = 
new JTextField();
  JTextField  ltr_4 = 
new JTextField();
  JTextField  ltr_5 = 
new JTextField();

  JTextField  kitchen_1 = 
new JTextField();
  JTextField  kitchen_2 = 
new JTextField();
  JTextField  kitchen_3 = 
new JTextField();
  JTextField  house_1 = 
new JTextField();
  JTextField  house_2 = 
new JTextField();
  JTextField  house_3 = 
new JTextField();
  JTextField  house_4 = 
new JTextField();
  JTextField  appliance_1 = 
new JTextField();
  JTextField  appliance_2 = 
new JTextField();
  JTextField  appliance_3 = 
new JTextField();
  JTextField  rec_room = 
new JTextField();
  JTextField  eng_room = 
new JTextField();
  JTextField  other = 
new JTextField();

  JTextField  annual_1 = 
new JTextField();
  JTextField  annual_2 = 
new JTextField();
  JTextField  annual_3 = 
new JTextField();
  JTextField  annual_4 = 
new JTextField();
  JTextField  annual_5 = 
new JTextField();

  JTextField  rotary_1 = 
new JTextField();
  JTextField  rotary_2 = 
new JTextField();
  JTextField  rotary_3 = 
new JTextField();
  JTextField  rotary_4 = 
new JTextField();
  JTextField  rotary_5 = 
new JTextField();

  JTextField  winter_1 = 
new JTextField();
  JTextField  winter_2 = 
new JTextField();
  JTextField  winter_3 = 
new JTextField();
  JTextField  winter_4 = 
new JTextField();
  JTextField  winter_5 = 
new JTextField();
  
  JTextField  comp_1 = 
new JTextField();
  JTextField  comp_2 = 
new JTextField();
  JTextField  comp_3 = 
new JTextField();
  JTextField  comp_4 = 
new JTextField();
  JTextField  comp_5 = 
new JTextField();
  
  JTextField  force_1 = 
new JTextField();
  JTextField  force_2 = 
new JTextField();
  JTextField  force_3 = 
new JTextField();
  JTextField  force_4 = 
new JTextField();
  JTextField  force_5 = 
new JTextField();
  
  JTextField  other_1 = 
new JTextField();
  JTextField  other_2 = 
new JTextField();
  JTextField  other_3 = 
new JTextField();
  JTextField  other_4 = 
new JTextField();
  JTextField  other_5 = 
new JTextField();
  
  JTextField  notes = 
new JTextField();

  JTextField  medical = 
new JTextField();
  JTextField  uncert = 
new JTextField();
  JTextField  accident = 
new JTextField();

  JTextField  training1 = 
new JTextField();
  JTextField  training2 = 
new JTextField();
  JTextField  training3 = 
new JTextField();

  JTextField  overtime_1 = 
new JTextField();
  JTextField  overtime_2 = 
new JTextField();
  JTextField  overtime_3 = 
new JTextField();

  JTextField  transfer_1 = 
new JTextField();
  JTextField  transfer_2 = 
new JTextField();
  JTextField  transfer_3 = 
new JTextField();
  JTextField  transfer_4 = 
new JTextField();

  JTextField  signed = 
new JTextField();

  Icon quitbug =  
new ImageIcon("door.gif");
  Icon submitbug =  
new ImageIcon("satelite.gif");
  Icon clearfieldsbug =  
new ImageIcon("trash.gif");
  Icon menubug =  
new ImageIcon("inventory.gif");

  JButton quit = 
new JButton ("Quit",quitbug);
  JButton submit = 
new JButton ("Submit",submitbug);
  JButton clearfields = 
new JButton ("ClearFields",clearfieldsbug);
  JFrame f = 
new JFrame("Fire and Emergency Medical Services, Logistics, Administration and Mobilization.");

  
public Duty(  ) {

  
/////////////////////
  // make the top row//
    /////////////////////

  
JPanel detailRow = new JPanel();
  detailRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
    
"General Details"));

  gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 
0.08;
    gbc.gridwidth = 
1;
    addGB(detailRow, 
new JLabel("District:"), 00);
  addGB(detailRow, 
new JLabel("Date:"), 20);
  addGB(detailRow, 
new JLabel("Day:"), 6,0);
  addGB(detailRow, 
new JLabel("Station:"), 01);
  addGB(detailRow, 
new JLabel("Watch:"), 21);
  addGB(detailRow, 
new JLabel("Duty No:"), 61);

    addGB(detailRow, districtBox, 
10);

  addGB(detailRow, dateBox, 
30);
    dateBox.addItem(
"Day");
    
for (int j=1; j<32; j++)
      dateBox.addItem(
"" + j);

  addGB(detailRow, monthBox, 
40);
    monthBox.addItem(
"Month");
    
for (int k=1; k<13; k++)
      monthBox.addItem(
"" + k);

  addGB(detailRow, yearBox, 
50);
    yearBox.addItem(
"Year");
    
for (int l=2001; l<2011; l++)
      yearBox.addItem(
"" + l);

  addGB(detailRow, dayBox, 
70);
  addGB(detailRow, stationBox, 
11);
  addGB(detailRow, watchBox, 
31);
  addGB(detailRow, duty, 
71);
  
    addGB(this, detailRow, 
00);

    
///////////////////////////////////////
    //make the appliance crew manning row//
  ///////////////////////////////////////

  
JPanel manningRow = new JPanel();
  manningRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
    
"Manning / Fuel Details"));

    JPanel manningtypeRow = 
new JPanel();

  gbc.weightx = 
0.9;
  gbc.weighty = 
1.0;
  addGB(manningtypeRow, 
new JLabel("D."), 01);
    addGB(manningtypeRow, appl_1, 
11);
  addGB(manningtypeRow, 
new JLabel("D."), 02);
  addGB(manningtypeRow, appl_2, 
12);
  addGB(manningtypeRow, 
new JLabel("D."), 03);
  addGB(manningtypeRow, appl_3, 
13);
  addGB(manningtypeRow, 
new JLabel("D."), 04);
  addGB(manningtypeRow, appl_4, 
14);
  addGB(manningtypeRow, 
new JLabel("D/O."), 05);
  addGB(manningtypeRow, 
new JButton("1"), 20);
  addGB(manningtypeRow, appl_1_1, 
21);
  addGB(manningtypeRow, appl_2_1, 
22);
  addGB(manningtypeRow, appl_3_1, 
23);
  addGB(manningtypeRow, appl_4_1, 
24);
  addGB(manningtypeRow, d_o_1, 
25);
  addGB(manningtypeRow, 
new JButton("2"), 30);
  addGB(manningtypeRow, appl_1_2, 
31);
  addGB(manningtypeRow, appl_2_2, 
32);
  addGB(manningtypeRow, appl_3_2, 
33);
  addGB(manningtypeRow, appl_4_2, 
34);
  addGB(manningtypeRow, 
new JButton("3"), 40);
  addGB(manningtypeRow, appl_1_3, 
41);
  addGB(manningtypeRow, appl_2_3, 
42);
  addGB(manningtypeRow, appl_3_3, 
43);
  addGB(manningtypeRow, appl_4_3, 
44);
  addGB(manningtypeRow, 
new JButton("4"), 50);
  addGB(manningtypeRow, appl_1_4, 
51);
  addGB(manningtypeRow, appl_2_4, 
52);
  addGB(manningtypeRow, appl_3_4, 
53);
  addGB(manningtypeRow, appl_4_4, 
54);
  addGB(manningtypeRow, 
new JButton("5"), 60);
  addGB(manningtypeRow, appl_1_5, 
61);
  addGB(manningtypeRow, appl_2_5, 
62);
  addGB(manningRow, manningtypeRow, 
00);

  JPanel manningfuelRow = 
new JPanel();
  manningfuelRow.setBorder(BorderFactory.createEtchedBorder());

  gbc.weightx = 
0.1;
  addGB(manningfuelRow, 
new JButton("Appliance Fuel Issue"), 00);
    addGB(manningfuelRow, ltr_1, 
01);
  addGB(manningfuelRow, 
new JLabel("Ltrs."), 11);
  addGB(manningfuelRow, ltr_2, 
02);
  addGB(manningfuelRow, 
new JLabel("Ltrs."), 12);
  addGB(manningfuelRow, ltr_3, 
03);
  addGB(manningfuelRow, 
new JLabel("Ltrs."), 13);
  addGB(manningfuelRow, ltr_4, 
04);
  addGB(manningfuelRow, 
new JLabel("Ltrs."), 14);
  addGB(manningfuelRow, ltr_5, 
05);
  addGB(manningfuelRow, 
new JLabel("Ltrs."), 15);
  addGB(manningRow, manningfuelRow, 
10);
  
    addGB(this, manningRow, 
01);

    
////////////////////////////////
    // make the station duties row//
    ////////////////////////////////

  
JPanel stationRow = new JPanel();
  stationRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
    
"Station Duty Details"));
  
    JPanel stationtypeRow = 
new JPanel();

  gbc.weightx = 
1.0;
  gbc.weighty = 
1.0;
  gbc.gridheight = 
1;
    addGB(stationtypeRow, 
new JLabel("Kitchen:"), 00);
  addGB(stationtypeRow, kitchen_1, 
10);
  addGB(stationtypeRow, 
new JLabel("Other:"), 02);
  addGB(stationtypeRow, 
new JLabel("Rec.Room:"), 01);
  addGB(stationtypeRow, rec_room, 
11);
  addGB(stationtypeRow, other, 
12);
    addGB(stationtypeRow, kitchen_2, 
20);
  addGB(stationtypeRow, kitchen_3, 
30);
  addGB(stationtypeRow, 
new JLabel("House:"), 40);
  addGB(stationtypeRow, 
new JLabel("Appliances:"), 41);
  addGB(stationtypeRow, 
new JLabel("Engine Rm."), 42);
  addGB(stationtypeRow, house_1, 
50);
  addGB(stationtypeRow, appliance_1, 
51);
  addGB(stationtypeRow, eng_room, 
52);
  addGB(stationtypeRow, house_2, 
60);
  addGB(stationtypeRow, house_3, 
70);
  addGB(stationtypeRow, house_4, 
80);
  addGB(stationtypeRow, appliance_2, 
61);
  addGB(stationtypeRow, appliance_3, 
71);

  addGB(stationRow, stationtypeRow, 
00);

  addGB(this, stationRow, 
02);
  
  
///////////////////////
    // make the leave row//
  ///////////////////////

  
JPanel leaveRow = new JPanel();
  leaveRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
    
"Leave Details"));

    JPanel leavetypeRow = 
new JPanel();

  gbc.weightx = 
0.1;
  gbc.weighty = 
1.0;
    addGB(leavetypeRow, 
new JLabel("Annual:"), 00);
  addGB(leavetypeRow, 
new JLabel("Rotary:"), 01);
  addGB(leavetypeRow, 
new JLabel("Winter:"), 02);
  addGB(leavetypeRow, 
new JLabel("Compassion:"), 03);
  addGB(leavetypeRow, 
new JLabel("Force Majeure:"), 04);
  addGB(leavetypeRow, 
new JLabel("Other:"), 05);
  addGB(leaveRow, leavetypeRow, 
00);
  
  JPanel leavedetailsRow = 
new JPanel();
  leavedetailsRow.setBorder(BorderFactory.createEtchedBorder());

  gbc.weightx = 
0.7;
  gbc.weighty = 
1.0;
    addGB(leavedetailsRow, annual_1, 
00);
  addGB(leavedetailsRow, annual_2, 
10);
  addGB(leavedetailsRow, annual_3, 
20);
  addGB(leavedetailsRow, annual_4, 
30);
  addGB(leavedetailsRow, annual_5, 
40);
  addGB(leavedetailsRow, rotary_1, 
01);
  addGB(leavedetailsRow, rotary_2, 
11);
  addGB(leavedetailsRow, rotary_3, 
21);
  addGB(leavedetailsRow, rotary_4, 
31);
  addGB(leavedetailsRow, rotary_5, 
41);
  addGB(leavedetailsRow, winter_1, 
02);
  addGB(leavedetailsRow, winter_2, 
12);
  addGB(leavedetailsRow, winter_3, 
22);
  addGB(leavedetailsRow, winter_4, 
32);
  addGB(leavedetailsRow, winter_5, 
42);
    addGB(leavedetailsRow, comp_1, 
03);
  addGB(leavedetailsRow, comp_2, 
13);
  addGB(leavedetailsRow, comp_3, 
23);
  addGB(leavedetailsRow, comp_4, 
33);
  addGB(leavedetailsRow, comp_5, 
43);
  addGB(leavedetailsRow, force_1, 
04);
  addGB(leavedetailsRow, force_2, 
14);
  addGB(leavedetailsRow, force_3, 
24);
  addGB(leavedetailsRow, force_4, 
34);
  addGB(leavedetailsRow, force_5, 
44);
  addGB(leavedetailsRow, other_1, 
05);
  addGB(leavedetailsRow, other_2, 
15);
  addGB(leavedetailsRow, other_3, 
25);
  addGB(leavedetailsRow, other_4, 
35);
  addGB(leavedetailsRow, other_5, 
45);
  addGB(leaveRow, leavedetailsRow, 
10);

  JPanel leavenotesRow = 
new JPanel();
  leavenotesRow.setBorder(BorderFactory.createEtchedBorder());

  gbc.weightx = 
0.2;
  gbc.weighty = 
0.1;
  addGB(leavenotesRow, 
new JButton("Notes"), 00);
  gbc.weighty = 
0.9;
    addGB(leavenotesRow, notes, 
01);
  addGB(leaveRow, leavenotesRow, 
20);
  
    addGB(this, leaveRow, 
03);

    
////////////////////////////
    // make the sick leave row//
    ////////////////////////////

  
JPanel sickRow = new JPanel();
  sickRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
    
"Sick Details"));

    gbc.weightx = 
0.0;
    gbc.gridwidth = 
1;

    JPanel sicktypeRow = 
new JPanel();

  gbc.weightx = 
0.1;
  gbc.weighty = 
1.0;
    addGB(sicktypeRow, 
new JLabel("Medical Cert:"), 00);
  addGB(sicktypeRow, 
new JLabel("U/Sick:"), 01);
  addGB(sicktypeRow, 
new JLabel("Accident:"), 02);
  addGB(sickRow, sicktypeRow, 
00);

  JPanel sickdetailsRow = 
new JPanel();
  sickdetailsRow.setBorder(BorderFactory.createEtchedBorder());

  gbc.weightx = 
0.9;
  gbc.weighty = 
1.0;
    addGB(sickdetailsRow, medical, 
00);
  addGB(sickdetailsRow, uncert, 
01);
  addGB(sickdetailsRow, accident, 
02);
  addGB(sickRow, sickdetailsRow, 
10);
  
    addGB(this, sickRow, 
04);

    
////////////////////////////////////
    // make the overtime/transfers row//
  ////////////////////////////////////

  
JPanel over_transRow = new JPanel();
    gbc.gridwidth = 
1;

    JPanel trainingRow = 
new JPanel();
  trainingRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
    
"Training"));
  addGB(trainingRow, training1, 
00);
  addGB(trainingRow, training2, 
01);
  addGB(trainingRow, training3, 
02);
    addGB(over_transRow, trainingRow, 
00);


    JPanel overtimeRow = 
new JPanel(); 
  overtimeRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
    
"Overtime"));
  gbc.weightx = 
0.2;
  gbc.weighty = 
1.0;
  addGB(overtimeRow, overtime_1, 
10);
  addGB(overtimeRow, overtime_2, 
11);
  addGB(overtimeRow, overtime_3, 
12);
  addGB(over_transRow, overtimeRow, 
10);


  JPanel transfersRow = 
new JPanel();
  transfersRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
    
"Transfers"));
  gbc.weightx = 
0.8;
  gbc.weighty = 
1.0;
  addGB(transfersRow, 
new JLabel("Transfers:"), 00);
  addGB(transfersRow, 
new JLabel("Signed(O/I/C):"), 02);
    addGB(transfersRow, transfer_1, 
10);
  addGB(transfersRow, transfer_2, 
11);
  addGB(transfersRow, signed, 
12);
  addGB(transfersRow, transfer_3, 
20);
  addGB(transfersRow, transfer_4, 
21);
  addGB(over_transRow, transfersRow, 
20);


    addGB(this, over_transRow, 
05);

    
/////////////////////
  //add the fifth row//
  /////////////////////
  
  
JPanel fifthRow = new JPanel();

  gbc.fill = GridBagConstraints.HORIZONTAL;
  addGB(fifthRow, quit, 
00);
  quit.addActionListener(
this);
  addGB(fifthRow, 
new JLabel(""), 30);
    addGB(fifthRow, submit, 
40);
  submit.addActionListener(
this);
  addGB(fifthRow, 
new JLabel(""), 50);
    addGB(fifthRow, clearfields, 
60);
  clearfields.addActionListener(
this);

  addGB(this, fifthRow, 
06);
  }

  
public void actionPerformed(ActionEvent event) {
    
try 
    String myEvent = event.getActionCommand(); 
    
if ( event.getSource() instanceof JButton) { 
      
if "Quit".equals(myEvent)) { 
        System.exit(
0); 
      }  
      
if "Submit".equals(myEvent)) { 
              Submit s = 
new Submit();
        s.Open();

        strQuery = 
"INSERT INTO roster_details(district,rdate,day,station,watch,duty_no)";
        strQuery += 
"values ('" + districtBox.getSelectedItem() + "','" + dateBox.getSelectedItem();
        strQuery += 
"/" + monthBox.getSelectedItem() + "/" + yearBox.getSelectedItem() + "','";
        strQuery += dayBox.getSelectedItem() + 
"','" + stationBox.getSelectedItem() + "','";
        strQuery += watchBox.getSelectedItem() + 
"'," + duty.getText() + ")";
        System.out.println(strQuery);
        s.Select(strQuery);

              strQuery = 
"INSERT INTO roster_manning(duty_no,appl_1,appl_2,appl_3,appl_4,do)";
        strQuery += 
"values ('" + duty.getText() + "','D." + appl_1.getText() + " - " + appl_1_1.getText() + " ";
        strQuery += appl_1_2.getText() + 
" " + appl_1_3.getText() + " " + appl_1_4.getText() + " ";
        strQuery += appl_1_5.getText() + 
" " + ltr_1.getText() + "Ltrs','D.";
        strQuery += appl_2.getText() + 
" - " + appl_2_1.getText() + " " + appl_2_2.getText();
        strQuery += 
" " + appl_2_3.getText() + " ";
        strQuery += appl_2_4.getText() + 
" " + appl_2_5.getText() + " " + ltr_2.getText();
        strQuery += 
"Ltrs','D." + appl_3.getText() + " - " + appl_3_1.getText() + " ";
        strQuery += appl_3_2.getText() + 
" " + appl_3_3.getText() + " " + appl_3_4.getText() + " ";
        strQuery += ltr_3.getText() + 
"Ltrs','D." + appl_4.getText() + " - ";
        strQuery += appl_4_1.getText() + 
" " + appl_4_2.getText() + " " + appl_4_3.getText() + " "
          strQuery += appl_4_4.getText() + 
" " + ltr_4.getText() + "Ltrs','";
        strQuery += d_o_1.getText() + 
" " + ltr_5.getText() + "Ltrs')";
        System.out.println(strQuery);
        s.Select(strQuery);

        strQuery = 
"INSERT INTO roster_duties(duty_no,kitchen,rec_room,house,appliances,engine_rm,other)";
        strQuery += 
"values ('" + duty.getText() + "','" + kitchen_1.getText() + " " + kitchen_2.getText();
        strQuery += 
" " + kitchen_3.getText() + "','" + rec_room.getText() + "','" + house_1.getText();
        strQuery += 
" " + house_2.getText() + " " + house_3.getText() + " " + house_4.getText() + "','";
        strQuery += appliance_1.getText() + 
" " + appliance_2.getText() + " " + appliance_3.getText();
        strQuery += 
"','" + eng_room.getText() + "','" + other.getText() + "')";
        System.out.println(strQuery);
        s.Select(strQuery);

        strQuery = 
"INSERT INTO roster_leave(duty_no,annual,rotary,winter,compassion,forcemajeure,other,notes)";
        strQuery += 
"values ('" + duty.getText() + "','" + annual_1.getText() + " " + annual_2.getText() + " ";
        strQuery += annual_3.getText() + 
" " + annual_4.getText() + " " + annual_5.getText() + "','";
        strQuery += rotary_1.getText() + 
" " + rotary_2.getText() + " " + rotary_3.getText() + " ";
        strQuery += rotary_4.getText() + 
" " + rotary_5.getText() + "','" + winter_1.getText() + " ";
        strQuery += winter_2.getText() + 
" " + winter_3.getText() + " " + winter_4.getText() + " ";
        strQuery += winter_5.getText() + 
"','" + comp_1.getText() + " " + comp_2.getText() + " ";
        strQuery += comp_3.getText() + 
" " + comp_4.getText() + " " + comp_5.getText() + "','";
        strQuery += force_1.getText() + 
" " + force_2.getText() + " " + force_3.getText() + " ";
        strQuery += force_4.getText() + 
" " + force_5.getText() + "','" + other_1.getText() + " ";
        strQuery += other_2.getText() + 
" " + other_3.getText() + " " + other_4.getText() + " ";
        strQuery += other_5.getText() + 
"','" + notes.getText() + "')";
        System.out.println(strQuery);
        s.Select(strQuery);

        strQuery = 
"INSERT INTO roster_sick(duty_no,medical,uncert,accident)";
        strQuery += 
"values ('" + duty.getText() + "','" + medical.getText() + "','" + uncert.getText();
        strQuery += 
"','" + accident.getText() + "')";
        System.out.println(strQuery);
        s.Select(strQuery);

        strQuery = 
"INSERT INTO roster_extras(duty_no,training,overtime,transfers,oic)";
        strQuery += 
"values ('" + duty.getText() + "','" + training1.getText() + " " + training2.getText();
        strQuery += 
" " + training3.getText() + "','" + overtime_1.getText() + " " + overtime_2.getText();
        strQuery += 
" " + overtime_3.getText() + "','" + transfer_1.getText() + " " + transfer_2.getText();
        strQuery += 
" " + transfer_3.getText() + " " + transfer_4.getText() + "','" + signed.getText() + "')";
        System.out.println(strQuery);
        s.Select(strQuery);

        s.Close();
      }
      
if ("ClearFields".equals(myEvent)) { 
        
//just clear any text fields - only one is the amount 
        
appl_1.setText("");
        appl_2.setText(
"");
        appl_3.setText(
"");
        appl_4.setText(
"");
        appl_1_1.setText(
"");
        appl_1_2.setText(
"");
        appl_1_3.setText(
"");
        appl_1_4.setText(
"");
        appl_1_5.setText(
"");
        d_o_1.setText(
"");
        appl_2_1.setText(
"");
        appl_2_2.setText(
"");
        appl_2_3.setText(
"");
        appl_2_4.setText(
"");
        appl_2_5.setText(
"");
        appl_3_1.setText(
"");
        appl_3_2.setText(
"");
        appl_3_3.setText(
"");
        appl_3_4.setText(
"");
        appl_4_1.setText(
"");
        appl_4_2.setText(
"");
        appl_4_3.setText(
"");
        appl_4_4.setText(
"");
        ltr_1.setText(
"");
        ltr_2.setText(
"");   
        ltr_3.setText(
""); 
        ltr_4.setText(
""); 
        ltr_5.setText(
"");   
        kitchen_1.setText(
""); 
        kitchen_2.setText(
""); 
        kitchen_3.setText(
"");  
        house_1.setText(
""); 
        house_2.setText(
""); 
        house_3.setText(
""); 
        house_4.setText(
"");  
        appliance_1.setText(
"");  
        appliance_2.setText(
"");  
        appliance_3.setText(
""); 
        rec_room.setText(
"");   
        eng_room.setText(
"");  
        other.setText(
""); 
        annual_1.setText(
""); 
        annual_2.setText(
""); 
        annual_3.setText(
""); 
        annual_4.setText(
""); 
        annual_5.setText(
"");  
        rotary_1.setText(
"");  
        rotary_2.setText(
"");  
        rotary_3.setText(
""); 
        rotary_4.setText(
""); 
        rotary_5.setText(
""); 
        winter_1.setText(
""); 
        winter_2.setText(
"");  
        winter_3.setText(
"");  
        winter_4.setText(
"");
        winter_5.setText(
""); 
        comp_1.setText(
"");  
        comp_2.setText(
"");  
        comp_3.setText(
""); 
        comp_4.setText(
"");  
        comp_5.setText(
"");  
        force_1.setText(
"");
        force_2.setText(
""); 
        force_3.setText(
""); 
        force_4.setText(
""); 
        force_5.setText(
""); 
        other_1.setText(
""); 
        other_2.setText(
""); 
        other_3.setText(
""); 
        other_4.setText(
""); 
        other_5.setText(
""); 
        notes.setText(
"");  
        medical.setText(
"");
        uncert.setText(
"");  
        accident.setText(
""); 
        training1.setText(
""); 
        training2.setText(
""); 
        training3.setText(
"");
        overtime_1.setText(
"");
        overtime_2.setText(
""); 
        overtime_3.setText(
"");
        transfer_1.setText(
""); 
        transfer_2.setText(
""); 
        transfer_3.setText(
""); 
        transfer_4.setText(
""); 
        signed.setText(
""); 
      } 
    } 
  } 
  
catch (Exception e) { 
    System.out.println(
"An Error has occured at ListenForButtonPress :"+e.toString()); 
  } 
  }

  
void addGB(Container cont, Component comp, int x, int y) {
    
if ((cont.getLayout(  ) instanceof GridBagLayout) == false)
      cont.setLayout(
new GridBagLayout(  ));
    gbc.gridx = x; gbc.gridy = y;
    cont.add(comp, gbc);
  }

  
public static void main(String[] args) {
    JFrame f = 
new JFrame("Duty Roster Form");
    f.addWindowListener(
new WindowAdapter() {
      
public void windowClosing(WindowEvent e) { System.exit(0); }
    });
    f.setSize(
1024768);
    f.setLocation(
0,0);
    f.setContentPane(
new Duty());
    f.setVisible(
true);
  }
}
Java2html