PÃá&Textáô&OEM Text 
Mob.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
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Mob extends JPanel implements ActionListener{
  GridBagConstraints gbc = 
new GridBagConstraints(  );
  String [] type = {
"Airway Emergency","Abdominal Distress","Cardiac Arrest","Cardiac Emergency","Chimney Fire",
    
"Car Fire","Chemical","Diabetic Emergency","Domestic Fire","Drug/Alcohol","Explosion","Fire","Fire / Commerial",
    
"Fire / Docks","Fire / Dublin Airport","Fire / Industrial","Fire / Institutional","Fire / Oil","Fire Alarm",
    
"HAZ Substances","Maternity","Overdose","Poisoning","Rescue (General)","Resp Emergency","Resp Arrest","RTA",
    
"Seizure Disorder","Serious Illness","Serious Injury","Skip Fire","Small Fire","S/S (Flooding)","S/S (Lift)",
    
"Stroke/CVA","Unknown Illness","Unknown Injury"};
  JComboBox typeBox = 
new JComboBox(type);
  JLabel add1 = 
new JLabel("House Number");
  JTextField add1text = 
new JTextField(15);
  JLabel add2 = 
new JLabel("Road Name");
  JTextField add2text = 
new JTextField(15);
  JLabel add3 = 
new JLabel("Postal Area");
  String [] area = {
"artane","ashtown","baldoyle","ballymun","beaumont","blanchardstown","cabra","castleknock",
      
"chapelizod","city centre north","cloghran","clonee","clontarf","clonsilla","coolock","corduff","dollymount",
      
"drumcondra","dublin airport","east wall","fairview","finglas","glasnevin","hartstown","howth","islandbrigde",
      
"kinsaley","kilbarrack","killester","kilmore","lucan","malahide","marino","mulhuddart","north strand",
      
"phibsborough","phoenix park","portmarnock","raheny","santry","sutton","st. margarets","swords","ward",
      
"whitehall"};
  JComboBox add3text = 
new JComboBox(area);
  JButton turnout = 
new JButton("Turnout");
  JButton clearfields = 
new JButton("New");
  JTextArea result = 
new JTextArea();
  JTextArea unavailable = 
new JTextArea();
  JTextField mav = 
new JTextField(15);
  JButton available = 
new JButton("Mav");

  String strQuery = 
new String();
  String[] unavail = 
new String[50];
  String[] mobil = 
new String[50];
  
int arraysize = unavail.length;
  
int mobilsize = mobil.length;

  
int motorend = 40;
  
int amboend = 24;
  
int etend = 8;
  
int ftend = 4;
  
int wtend = 16;
  
int districtend = 16;
  
int ladderend = 8;
  
int hpend = 4;
  
int deconend = 4;

  
public Mob(  ) {
  gbc.fill = GridBagConstraints.HORIZONTAL;
  gbc.weightx = 
1.0;
  gbc.weighty = 
1.0;
  JPanel Row = 
new JPanel();
  Row.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
      
"Mobilization Details"));
  addGB(Row,typeBox, 
10);
  addGB(Row,add1, 
01);
  addGB(Row,add1text, 
11);
  addGB(Row,add2, 
02);
  addGB(Row,add2text, 
12);
  addGB(Row,add3, 
03);
  addGB(Row,add3text, 
13);
    addGB(this, Row, 
00);

  JPanel sRow = 
new JPanel();
  addGB(sRow,turnout, 
00);
  addGB(sRow,new JLabel(
""), 10);
  addGB(sRow,clearfields, 
20);
  turnout.addActionListener(
this);
  clearfields.addActionListener(
this);
    addGB(this, sRow, 
01);

  JPanel resRow = 
new JPanel();
  resRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
      
"Mobilization Result"));
  gbc.fill = GridBagConstraints.BOTH;
  JScrollPane resPane = 
new JScrollPane(result,
    JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
    JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  addGB(resRow,resPane, 
00);

  addGB(this, resRow, 
02);

  JPanel unavailRow = 
new JPanel();
  unavailRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
      
"Unavailable Vehicles"));
  gbc.fill = GridBagConstraints.BOTH;
  JScrollPane unavailPane = 
new JScrollPane(unavailable,
    JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
    JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  addGB(unavailRow,unavailPane, 
00);

  addGB(this, unavailRow, 
03);

  JPanel availRow = 
new JPanel();
  gbc.fill = GridBagConstraints.HORIZONTAL;
  addGB(availRow,new JLabel(
"Vehicle"), 00);
  addGB(availRow,mav, 
10);
    addGB(availRow,new JLabel(
""), 20);
  addGB(availRow,new JLabel(
""), 30);
  addGB(availRow,available, 
40);
  available.addActionListener(
this);

  addGB(this, availRow, 
04);
  }

  
public void actionPerformed(ActionEvent event) {
    
try{
      String myEvent = event.getActionCommand();
    
int mobilsize = mobil.length;
    
for (int index=0; index < mobilsize; index++){
    mobil[index] = 
null;            
    }
      
if (event.getSource() instanceof JButton){
      
if ("New".equals(myEvent)) { 
      add1text.setText(
"");
      add2text.setText(
"");
      result.setText(
"");
      unavailable.setText(
"");
      mav.setText(
"");
    }

      
if ("Mav".equals(myEvent)) { 

      
for (int index=0; index < arraysize; index++){
        
if ((unavail[index] != null) && (mav.getText().equals(unavail[index]))){
          unavail[index] = 
null;
          }
      }
    }    

    
if "Turnout".equals(myEvent)) 
    { 
        Object incident = typeBox.getSelectedItem();
        Object address1 = add1text.getText();
            Object address2 = add2text.getText();
            Object address3 = add3text.getSelectedItem();
        Object address = 
new Object();
        String v = 
new String("");
        String roadname = 
new String("");

        Submit s = 
new Submit();
        s.Open();

        strQuery = 
"select area from roadnames where name ='" + address2 + "'";
        roadname = s.Find(strQuery);

        
if ( roadname.equals("")){
          address = address3;
        }
        
else
            
address = roadname;

        
if (incident.equals("Airway Emergency")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Abdominal Distress")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Cardiac Arrest")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Cardiac Emergency")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Car Fire")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        }

        
if (incident.equals("Chemical")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ft";
        turnOut(s,v,address,ftend);
        v = 
"decon";
        turnOut(s,v,address,deconend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Chimney Fire")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        }

        
if (incident.equals("Domestic Fire")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("Drug/Alcohol")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Explosion")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"et";
        turnOut(s,v,address,etend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Fire")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        }

        
if (incident.equals("Fire / Commerial")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ladder";
        turnOut(s,v,address,ladderend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("Fire / Docks")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ft";
        turnOut(s,v,address,ftend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("Fire / Dublin Airport")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("Fire / Industrial")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ladder";
        turnOut(s,v,address,ladderend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("Fire / Institutional")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ladder";
        turnOut(s,v,address,ladderend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("Fire Alarm")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ladder";
        turnOut(s,v,address,ladderend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("Fire / Oil")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ft";
        turnOut(s,v,address,ftend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("HAZ Substances")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"wt";
        turnOut(s,v,address,wtend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Maternity")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Overdose")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Poisoning")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Rescue (General)")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        v = 
"et";
        turnOut(s,v,address,etend);
        }

        
if (incident.equals("Resp Emergency")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Resp Arrest")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("RTA")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        v = 
"et";
        turnOut(s,v,address,etend);
        }

        
if (incident.equals("Seizure Disorder")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Serious Illness")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Serious Injury")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Skip Fire")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        }

        
if (incident.equals("Small Fire")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        }

        
if (incident.equals("S/S (Flooding)")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        }

        
if (incident.equals("S/S (Lift)")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        v = 
"et";
        turnOut(s,v,address,etend);
        }

        
if (incident.equals("Stroke/CVA")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Unknown Illness")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Unknown Injury")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }
          s.Close();
    } 
    } 
  } 
  
catch (Exception e) { 
    System.out.println(
"An Error has occured at ListenForButtonPress :"+e.toString()); 
  } 
  }

  
public void turnOut(Submit s, String vehicle, Object address,int endmax){

    
int start=0,end=3,index=0,counter;
  String bestresult = 
"\nTurnout:- ";
  String unavailresult = 
new String();
  String found = 
new String();
  String appliance = 
new String();

  strQuery = 
"select " + vehicle + " from postalareas where area = '" + address + "'";
  found = s.Find(strQuery);

  
while (start < 40)
  {
    counter = 
0;

    appliance = found.substring(start,end);

    
if (end >= endmax)
    {
      bestresult += vehicle + 
" unavailable - Queue incident.";
      start = 
40;
    }
    
else
    
{
      
for (index=0; index < arraysize; index++){
        
if (appliance.equals(unavail[index])){
          counter++;
        }            
      }

      
if (counter == 0){
        start = 
40;

      
for (index=0; index < mobilsize; index++){
          
if (mobil[index] == null){
          mobil[index] = appliance;
          index = mobilsize;
          }
      }

      
for (index=0; index < mobilsize; index++){
        
if (mobil[index] != null){
          bestresult += mobil[index] + 
" ";
          }
      }

        unavailresult += 
"\nUnavailable:- ";

      
for (index=0; index < arraysize; index++){
          
if (unavail[index] == null){
          unavail[index] = appliance;
          index = arraysize;
          }
      }

      
for (index=0; index < arraysize; index++){
        
if (unavail[index] != null){
          unavailresult += unavail[index] + 
" ";
          }
      }
      }
      
else{
      start = start+
4;
      end = end+
4;
      }
    }
  }
    result.setText(bestresult);
  unavailable.setText(unavailresult);
  }
  
  
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("Mobilization Form");
    f.addWindowListener(
new WindowAdapter() {
      
public void windowClosing(WindowEvent e) { System.exit(0); }
    });
    f.setSize(
400,500);
    f.setLocation(
400,200);
    f.setContentPane(
new Mob());
    f.setVisible(
true);
  }
}
Java2html
Mob.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
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Mob extends JPanel implements ActionListener{
  GridBagConstraints gbc = 
new GridBagConstraints(  );
  String [] type = {
"Airway Emergency","Abdominal Distress","Cardiac Arrest","Cardiac Emergency","Chimney Fire",
    
"Car Fire","Chemical","Diabetic Emergency","Domestic Fire","Drug/Alcohol","Explosion","Fire","Fire / Commerial",
    
"Fire / Docks","Fire / Dublin Airport","Fire / Industrial","Fire / Institutional","Fire / Oil","Fire Alarm",
    
"HAZ Substances","Maternity","Overdose","Poisoning","Rescue (General)","Resp Emergency","Resp Arrest","RTA",
    
"Seizure Disorder","Serious Illness","Serious Injury","Skip Fire","Small Fire","S/S (Flooding)","S/S (Lift)",
    
"Stroke/CVA","Unknown Illness","Unknown Injury"};
  JComboBox typeBox = 
new JComboBox(type);
  JLabel add1 = 
new JLabel("House Number");
  JTextField add1text = 
new JTextField(15);
  JLabel add2 = 
new JLabel("Road Name");
  JTextField add2text = 
new JTextField(15);
  JLabel add3 = 
new JLabel("Postal Area");
  String [] area = {
"artane","ashtown","baldoyle","ballymun","beaumont","blanchardstown","cabra","castleknock",
      
"chapelizod","city centre north","cloghran","clonee","clontarf","clonsilla","coolock","corduff","dollymount",
      
"drumcondra","dublin airport","east wall","fairview","finglas","glasnevin","hartstown","howth","islandbrigde",
      
"kinsaley","kilbarrack","killester","kilmore","lucan","malahide","marino","mulhuddart","north strand",
      
"phibsborough","phoenix park","portmarnock","raheny","santry","sutton","st. margarets","swords","ward",
      
"whitehall"};
  JComboBox add3text = 
new JComboBox(area);
  JButton turnout = 
new JButton("Turnout");
  JButton clearfields = 
new JButton("New");
  JTextArea result = 
new JTextArea();
  JTextArea unavailable = 
new JTextArea();
  JTextField mav = 
new JTextField(15);
  JButton available = 
new JButton("Mav");

  String strQuery = 
new String();
  String[] unavail = 
new String[50];
  String[] mobil = 
new String[50];
  
int arraysize = unavail.length;
  
int mobilsize = mobil.length;

  
int motorend = 40;
  
int amboend = 24;
  
int etend = 8;
  
int ftend = 4;
  
int wtend = 16;
  
int districtend = 16;
  
int ladderend = 8;
  
int hpend = 4;
  
int deconend = 4;

  
public Mob(  ) {
  gbc.fill = GridBagConstraints.HORIZONTAL;
  gbc.weightx = 
1.0;
  gbc.weighty = 
1.0;
  JPanel Row = 
new JPanel();
  Row.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
      
"Mobilization Details"));
  addGB(Row,typeBox, 
10);
  addGB(Row,add1, 
01);
  addGB(Row,add1text, 
11);
  addGB(Row,add2, 
02);
  addGB(Row,add2text, 
12);
  addGB(Row,add3, 
03);
  addGB(Row,add3text, 
13);
    addGB(this, Row, 
00);

  JPanel sRow = 
new JPanel();
  addGB(sRow,turnout, 
00);
  addGB(sRow,new JLabel(
""), 10);
  addGB(sRow,clearfields, 
20);
  turnout.addActionListener(
this);
  clearfields.addActionListener(
this);
    addGB(this, sRow, 
01);

  JPanel resRow = 
new JPanel();
  resRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
      
"Mobilization Result"));
  gbc.fill = GridBagConstraints.BOTH;
  JScrollPane resPane = 
new JScrollPane(result,
    JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
    JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  addGB(resRow,resPane, 
00);

  addGB(this, resRow, 
02);

  JPanel unavailRow = 
new JPanel();
  unavailRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
      
"Unavailable Vehicles"));
  gbc.fill = GridBagConstraints.BOTH;
  JScrollPane unavailPane = 
new JScrollPane(unavailable,
    JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
    JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  addGB(unavailRow,unavailPane, 
00);

  addGB(this, unavailRow, 
03);

  JPanel availRow = 
new JPanel();
  gbc.fill = GridBagConstraints.HORIZONTAL;
  addGB(availRow,new JLabel(
"Vehicle"), 00);
  addGB(availRow,mav, 
10);
    addGB(availRow,new JLabel(
""), 20);
  addGB(availRow,new JLabel(
""), 30);
  addGB(availRow,available, 
40);
  available.addActionListener(
this);

  addGB(this, availRow, 
04);
  }

  
public void actionPerformed(ActionEvent event) {
    
try{
      String myEvent = event.getActionCommand();
    
int mobilsize = mobil.length;
    
for (int index=0; index < mobilsize; index++){
    mobil[index] = 
null;            
    }
      
if (event.getSource() instanceof JButton){
      
if ("New".equals(myEvent)) { 
      add1text.setText(
"");
      add2text.setText(
"");
      result.setText(
"");
      unavailable.setText(
"");
      mav.setText(
"");
    }

      
if ("Mav".equals(myEvent)) { 

      
for (int index=0; index < arraysize; index++){
        
if ((unavail[index] != null) && (mav.getText().equals(unavail[index]))){
          unavail[index] = 
null;
          }
      }
    }    

    
if "Turnout".equals(myEvent)) 
    { 
        Object incident = typeBox.getSelectedItem();
        Object address1 = add1text.getText();
            Object address2 = add2text.getText();
            Object address3 = add3text.getSelectedItem();
        Object address = 
new Object();
        String v = 
new String("");
        String roadname = 
new String("");

        Submit s = 
new Submit();
        s.Open();

        strQuery = 
"select area from roadnames where name ='" + address2 + "'";
        roadname = s.Find(strQuery);

        
if ( roadname.equals("")){
          address = address3;
        }
        
else
            
address = roadname;

        
if (incident.equals("Airway Emergency")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Abdominal Distress")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Cardiac Arrest")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Cardiac Emergency")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Car Fire")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        }

        
if (incident.equals("Chemical")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ft";
        turnOut(s,v,address,ftend);
        v = 
"decon";
        turnOut(s,v,address,deconend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Chimney Fire")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        }

        
if (incident.equals("Domestic Fire")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("Drug/Alcohol")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Explosion")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"et";
        turnOut(s,v,address,etend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Fire")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        }

        
if (incident.equals("Fire / Commerial")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ladder";
        turnOut(s,v,address,ladderend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("Fire / Docks")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ft";
        turnOut(s,v,address,ftend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("Fire / Dublin Airport")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("Fire / Industrial")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ladder";
        turnOut(s,v,address,ladderend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("Fire / Institutional")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ladder";
        turnOut(s,v,address,ladderend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("Fire Alarm")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ladder";
        turnOut(s,v,address,ladderend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("Fire / Oil")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"ft";
        turnOut(s,v,address,ftend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        }

        
if (incident.equals("HAZ Substances")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        turnOut(s,v,address,motorend);
        v = 
"wt";
        turnOut(s,v,address,wtend);
        v = 
"district";
        turnOut(s,v,address,districtend);
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Maternity")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Overdose")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Poisoning")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Rescue (General)")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        v = 
"et";
        turnOut(s,v,address,etend);
        }

        
if (incident.equals("Resp Emergency")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Resp Arrest")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("RTA")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        v = 
"et";
        turnOut(s,v,address,etend);
        }

        
if (incident.equals("Seizure Disorder")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Serious Illness")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Serious Injury")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Skip Fire")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        }

        
if (incident.equals("Small Fire")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        }

        
if (incident.equals("S/S (Flooding)")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        }

        
if (incident.equals("S/S (Lift)")){
        v = 
"motor";
        turnOut(s,v,address,motorend);
        v = 
"et";
        turnOut(s,v,address,etend);
        }

        
if (incident.equals("Stroke/CVA")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Unknown Illness")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }

        
if (incident.equals("Unknown Injury")){
        v = 
"ambo";
        turnOut(s,v,address,amboend);
        }
          s.Close();
    } 
    } 
  } 
  
catch (Exception e) { 
    System.out.println(
"An Error has occured at ListenForButtonPress :"+e.toString()); 
  } 
  }

  
public void turnOut(Submit s, String vehicle, Object address,int endmax){

    
int start=0,end=3,index=0,counter;
  String bestresult = 
"\nTurnout:- ";
  String unavailresult = 
new String();
  String found = 
new String();
  String appliance = 
new String();

  strQuery = 
"select " + vehicle + " from postalareas where area = '" + address + "'";
  found = s.Find(strQuery);

  
while (start < 40)
  {
    counter = 
0;

    appliance = found.substring(start,end);

    
if (end >= endmax)
    {
      bestresult += vehicle + 
" unavailable - Queue incident.";
      start = 
40;
    }
    
else
    
{
      
for (index=0; index < arraysize; index++){
        
if (appliance.equals(unavail[index])){
          counter++;
        }            
      }

      
if (counter == 0){
        start = 
40;

      
for (index=0; index < mobilsize; index++){
          
if (mobil[index] == null){
          mobil[index] = appliance;
          index = mobilsize;
          }
      }

      
for (index=0; index < mobilsize; index++){
        
if (mobil[index] != null){
          bestresult += mobil[index] + 
" ";
          }
      }

        unavailresult += 
"\nUnavailable:- ";

      
for (index=0; index < arraysize; index++){
          
if (unavail[index] == null){
          unavail[index] = appliance;
          index = arraysize;
          }
      }

      
for (index=0; index < arraysize; index++){
        
if (unavail[index] != null){
          unavailresult += unavail[index] + 
" ";
          }
      }
      }
      
else{
      start = start+
4;
      end = end+
4;
      }
    }
  }
    result.setText(bestresult);
  unavailable.setText(unavailresult);
  }
  
  
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("Mobilization Form");
    f.addWindowListener(
new WindowAdapter() {
      
public void windowClosing(WindowEvent e) { System.exit(0); }
    });
    f.setSize(
400,500);
    f.setLocation(
400,200);
    f.setContentPane(
new Mob());
    f.setVisible(
true);
  }
}
Java2html