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 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994
|
import javax.swing.event.*; import java.awt.event.*; import javax.swing.*; import java.awt.*;
public class Fire_Incident extends JPanel implements ActionListener { GridBagConstraints gbc = new GridBagConstraints(); String strQuery = new String(); JLabel typeLabel = new JLabel (" Incident Type:"); JComboBox typeBox = new JComboBox(); JLabel incidentnumberLabel = new JLabel ("Number:"); JTextField incidentnumber = new JTextField(6); JLabel stationLabel = new JLabel ("Station:"); String [] stations = {"1","2","3","4","5","6","7","8","9","10","11","12"}; JComboBox stationBox = new JComboBox(stations); JLabel dateLabel = new JLabel ("Date:"); JComboBox dayBox = new JComboBox(); JComboBox monthBox = new JComboBox(); JComboBox yearBox = new JComboBox(); JLabel callerLabel = new JLabel ("Caller Details:"); JTextField caller = new JTextField (10); JLabel ownerLabel = new JLabel ("Owner Details:"); JTextField owner = new JTextField (10); JLabel incidentLabel = new JLabel ("Incident Details:"); JTextField incident = new JTextField (15); JLabel contactLabel = new JLabel ("Contact Name:"); JTextField contact = new JTextField (5); JLabel statusLabel = new JLabel ("Status:"); JRadioButton[] status = new JRadioButton[6]; ButtonGroup group = new ButtonGroup(); JLabel alarmLabel = new JLabel ("False Alarm:"); JRadioButton[] alarm = new JRadioButton[5]; ButtonGroup gr = new ButtonGroup(); JLabel officerLabel = new JLabel ("Officers(1st Attend) / Senior:"); JTextField officer = new JTextField (10); JTextField senior = new JTextField (10); JLabel gardaLabel = new JLabel ("Gardai / Time:"); JTextField garda = new JTextField (); JTextField l = new JTextField (); JLabel esbLabel = new JLabel ("ESB / Time:"); JTextField esb = new JTextField (); JTextField st = new JTextField ();
JLabel attendLabel = new JLabel ("Attendance - Ambulance / Time:"); JTextField attend = new JTextField (); JTextField time = new JTextField (); JLabel localLabel = new JLabel ("Local Authority / Time:"); JTextField local = new JTextField (); JTextField t = new JTextField (); JLabel otherLabel = new JLabel ("Other / Time:"); JTextField other = new JTextField (); JTextField m = new JTextField ();
JLabel chimneyLabel = new JLabel ("Chimney Fire Only:"); JRadioButton[] chimney = new JRadioButton[4]; ButtonGroup g = new ButtonGroup(); JLabel sortLabel = new JLabel ("Premises Sort:"); JRadioButton[] sort = new JRadioButton[6]; JLabel dimensionLabel = new JLabel ("Premises Dimensions:"); JRadioButton[] dimension = new JRadioButton[7]; JLabel premtypeLabel = new JLabel ("Premises Type:"); JComboBox premtypeBox = new JComboBox(); JLabel sourceLabel = new JLabel ("Ignition Source:"); JComboBox sourceBox = new JComboBox(); JLabel originLabel = new JLabel ("Origin:"); JComboBox originBox = new JComboBox();
JLabel smokeLabel = new JLabel ("Smoke Alarm:"); JList smokelist; private String smokes [] = {"Domestic","FDA","Operating"}; JLabel extingLabel = new JLabel ("Extinguishers:"); JList extinglist; private String extings [] = {"Installed","Used","Effects - None","Partial Control","Control"}; JLabel blanketLabel = new JLabel ("Fire Blankets:"); JList blanketlist; private String blankets [] = {"Installed","Used","Effects - None","Partial Control","Control"}; JLabel sprinklerLabel = new JLabel ("Sprinklers:"); JList sprinklerlist; private String sprinklers [] = {"Installed","Used","Effects - None","Partial Control","Control"}; JLabel specialLabel = new JLabel ("Special Services(S/S):"); JList speciallist; private String specs [] = {"Pumping/Flooding","Rescue/Removal","Entrapment","Machinery","Non-Fire Rescue", "RTA","Gas/Chemicals","HazSub Transit","Non Transit",}; JLabel specLabel = new JLabel ("S/S contd..:"); JList speclist; private String specials[] = {"Road","Field","Building","River","Lake","Sea","Above Ground","Below Ground", "Ground Level","Car","Van","Pedestrian","Truck","Artic","Bicycle","Trailer","Tractor","Motorcycle", "Decontamination","Standard Suits","Splash Suits","Gas Suits"}; JList weatherlist; private String weathers[] = {"Dusky","Sunny","Overcast","Night-time","Wet","Dry","Frost","Snow","Windy","Calm"}; JList methodlist; private String methods[] = {"Extinguishers","Hose - Reel","RTA Equipment","B.A.","Hydrant","Open Source", "Jets","Tanker","Other"}; JList injurylist; private String injuries[] = {"Personnel","Public"}; JLabel weatherLabel = new JLabel ("Weather:"); JLabel methodLabel = new JLabel ("Method Used:"); JLabel injuryLabel = new JLabel ("Injuries or Fatalities:");
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 Fire_Incident() {
////////////////////// //make the first row// //////////////////////
JPanel firstRow = new JPanel(); firstRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),"Incident Details"));
gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1.0; gbc.weighty = 1.0; gbc.gridwidth = 1;
addGB(firstRow, dateLabel, 0, 0); dayBox.setMaximumRowCount(2); monthBox.setMaximumRowCount(2); yearBox.setMaximumRowCount(2); addGB(firstRow, dayBox, 1, 0); dayBox.addItem("Day"); for (int j=1; j<32; j++) dayBox.addItem("" + j); addGB(firstRow, monthBox, 2, 0); monthBox.addItem("Month"); for (int k=1; k<13; k++) monthBox.addItem("" + k); addGB(firstRow, yearBox, 3, 0); yearBox.addItem("Year"); for (int l=2001; l<2011; l++) yearBox.addItem("" + l); addGB(firstRow, stationLabel, 4, 0); addGB(firstRow, stationBox, 5, 0);
addGB(firstRow, typeLabel, 0, 1); typeBox.setMaximumRowCount(2); typeBox.addItem("Incident Type"); typeBox.addItem("Chimney"); typeBox.addItem("Other Fire"); typeBox.addItem("Special Service"); typeBox.addItem("Injuries/Fatalities"); addGB(firstRow, typeBox, 1, 1); addGB(firstRow, incidentnumberLabel, 2, 1); addGB(firstRow, incidentnumber, 3, 1); addGB(firstRow, callerLabel, 4, 1); addGB(firstRow, caller, 5, 1);
addGB(firstRow, ownerLabel, 0, 2); addGB(firstRow, owner, 1, 2); addGB(firstRow, incidentLabel, 2, 2); addGB(firstRow, incident, 3, 2); addGB(firstRow, contactLabel, 4, 2); addGB(firstRow, contact, 5, 2);
addGB(firstRow, statusLabel, 0, 3); status[0] = new JRadioButton ("Caller"); addGB(firstRow, status[0], 1, 3); status[1] = new JRadioButton ("Owner"); addGB(firstRow, status[1], 2, 3); status[2] = new JRadioButton ("Occupier"); addGB(firstRow, status[2], 3, 3); status[3] = new JRadioButton ("Management"); addGB(firstRow, status[3], 4, 3); status[4] = new JRadioButton ("Security"); addGB(firstRow, status[4], 5, 3); status[5] = new JRadioButton ("Passer"); addGB(firstRow, status[5], 6, 3); for (int i=0; i<status.length; i++){ group.add(status[i]); }
addGB(firstRow, alarmLabel, 0, 4); alarm[0] = new JRadioButton ("Good Intent Call"); addGB(firstRow, alarm[0], 1, 4); alarm[1] = new JRadioButton ("Malicious Call"); addGB(firstRow, alarm[1], 2, 4); alarm[2] = new JRadioButton ("FDA Error"); addGB(firstRow, alarm[2], 3, 4); alarm[3] = new JRadioButton ("Equipment Failure"); addGB(firstRow, alarm[3], 4, 4); alarm[4] = new JRadioButton ("Operator Error"); addGB(firstRow, alarm[4], 5, 4); for (int i=0; i<alarm.length; i++){ gr.add(alarm[i]); }
addGB(this, firstRow, 0, 0);
/////////////////////// //make the second row// ///////////////////////
JPanel secondRow = new JPanel(); secondRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "In Attendance"));
addGB(secondRow, officerLabel, 0, 0); addGB(secondRow, officer, 1, 0); addGB(secondRow, senior, 2, 0);
addGB(secondRow, gardaLabel, 0, 2); addGB(secondRow, garda, 1, 2); addGB(secondRow, l, 2, 2);
addGB(secondRow, esbLabel, 0, 3); addGB(secondRow, esb, 1, 3); addGB(secondRow, st, 2, 3);
addGB(secondRow, attendLabel, 0, 4); addGB(secondRow, attend, 1, 4); addGB(secondRow, time, 2, 4);
addGB(secondRow, localLabel, 0, 5); addGB(secondRow, local, 1, 5); addGB(secondRow, t, 2, 5);
addGB(secondRow, otherLabel, 0, 6); addGB(secondRow, other, 1, 6); addGB(secondRow, m, 2, 6);
addGB(secondRow, chimneyLabel, 0, 7); chimney[0] = new JRadioButton ("Open Hearth."); addGB(secondRow, chimney[0], 1, 7); chimney[1] = new JRadioButton ("Back Boiler."); addGB(secondRow, chimney[1], 2, 7); chimney[2] = new JRadioButton ("Cooker."); addGB(secondRow, chimney[2], 3, 7); chimney[3] = new JRadioButton ("Spread."); addGB(secondRow, chimney[3], 4, 7); for (int i=0; i<chimney.length; i++){ g.add(chimney[i]); }
addGB(this, secondRow, 0, 1);
////////////////////// //make the third row// //////////////////////
JPanel thirdRow = new JPanel(); thirdRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Premises Type - Ignition Source - Origin of Fire"));
addGB(thirdRow, sortLabel, 0, 0); sort[0] = new JRadioButton ("Local Authority"); addGB(thirdRow, sort[0], 1, 0); sort[1] = new JRadioButton ("Private"); addGB(thirdRow, sort[1], 2, 0); sort[2] = new JRadioButton ("Urban Centre"); addGB(thirdRow, sort[2], 3, 0); sort[3] = new JRadioButton ("Urban Surrounds"); addGB(thirdRow, sort[3], 4, 0); sort[4] = new JRadioButton ("Village"); addGB(thirdRow, sort[4], 5, 0); sort[5] = new JRadioButton ("Rural"); addGB(thirdRow, sort[5], 6, 0); for (int i=0; i<sort.length; i++){ g.add(sort[i]); }
addGB(thirdRow, premtypeLabel, 0, 1); premtypeBox.setMaximumRowCount(2); premtypeBox.addItem("Premises Type"); premtypeBox.addItem("House"); premtypeBox.addItem("Multiple Occupancy"); premtypeBox.addItem("Mobile Home"); premtypeBox.addItem("Caravan"); premtypeBox.addItem("Flat"); premtypeBox.addItem("School"); premtypeBox.addItem("Hospital"); premtypeBox.addItem("Nursing Home"); premtypeBox.addItem("Convent"); premtypeBox.addItem("Hotel"); premtypeBox.addItem("GuestHouse / B&B"); premtypeBox.addItem("Hostel"); premtypeBox.addItem("Care"); premtypeBox.addItem("Warehouse"); premtypeBox.addItem("Factory"); premtypeBox.addItem("Chemical Plant"); premtypeBox.addItem("Shop"); premtypeBox.addItem("Venue / Hall"); premtypeBox.addItem("Petrol Station"); premtypeBox.addItem("Fuel Depot"); premtypeBox.addItem("Office"); premtypeBox.addItem("Dance"); premtypeBox.addItem("Restaurant"); premtypeBox.addItem("Public House"); premtypeBox.addItem("Threatre"); premtypeBox.addItem("Cinema"); premtypeBox.addItem("Prison"); premtypeBox.addItem("Reception Centre"); premtypeBox.addItem("Detention Centre"); premtypeBox.addItem("Forest"); premtypeBox.addItem("Agricultural"); premtypeBox.addItem("Grass"); premtypeBox.addItem("Box"); premtypeBox.addItem("Vehicle"); premtypeBox.addItem("Indoor Store"); premtypeBox.addItem("Outdoor Store"); premtypeBox.addItem("Rubbish"); premtypeBox.addItem("Ships"); premtypeBox.addItem("Aircraft"); premtypeBox.addItem("Derelict"); premtypeBox.addItem("Skip"); addGB(thirdRow, premtypeBox, 1, 1);
addGB(thirdRow, sourceLabel, 2, 1); sourceBox.setMaximumRowCount(2); sourceBox.addItem("Ignition Source"); sourceBox.addItem("Matches"); sourceBox.addItem("Lighter"); sourceBox.addItem("Cigarettes"); sourceBox.addItem("Smouldering Materials"); sourceBox.addItem("Chip Pan"); sourceBox.addItem("Fuel"); sourceBox.addItem("Electrical Wiring"); sourceBox.addItem("Electrical Blanket"); sourceBox.addItem("Electrical Cooking"); sourceBox.addItem("Electrical Heating"); sourceBox.addItem("Electrical Other"); sourceBox.addItem("Rubbish"); sourceBox.addItem("Grass"); sourceBox.addItem("Oil Appliance"); sourceBox.addItem("Solid Fuel Appliance"); sourceBox.addItem("Gas Cooking"); sourceBox.addItem("Gas Heating"); sourceBox.addItem("Malicious"); sourceBox.addItem("Other"); addGB(thirdRow, sourceBox, 3, 1);
addGB(thirdRow, originLabel, 4, 1); originBox.setMaximumRowCount(2); originBox.addItem("Origin"); originBox.addItem("Kitchen"); originBox.addItem("Utility Room"); originBox.addItem("Bathroom"); originBox.addItem("Bedroom"); originBox.addItem("Dining Room"); originBox.addItem("Living Room"); originBox.addItem("Hall"); originBox.addItem("Garage"); originBox.addItem("Basement"); originBox.addItem("Attic"); originBox.addItem("Office"); originBox.addItem("Hot Press"); originBox.addItem("Shed"); originBox.addItem("Boilerhouse"); originBox.addItem("Other"); addGB(thirdRow, originBox, 5, 1);
addGB(thirdRow, dimensionLabel, 0, 2); dimension[0] = new JRadioButton ("1 Storey"); addGB(thirdRow, dimension[0], 1, 2); dimension[1] = new JRadioButton ("2 Storey"); addGB(thirdRow, dimension[1], 2, 2); dimension[2] = new JRadioButton ("3 Storey"); addGB(thirdRow, dimension[2], 3, 2); dimension[3] = new JRadioButton ("3+ Storey"); addGB(thirdRow, dimension[3], 4, 2); dimension[4] = new JRadioButton ("Terraced"); addGB(thirdRow, dimension[4], 1, 3); dimension[5] = new JRadioButton ("Detached"); addGB(thirdRow, dimension[5], 2, 3); dimension[6] = new JRadioButton ("Semi-Detached"); addGB(thirdRow, dimension[6], 3, 3); for (int i=0; i<dimension.length; i++){ group.add(dimension[i]); }
addGB(this, thirdRow, 0, 2); ////////////////////// //add the fourth row// ////////////////////// JPanel fourthRow = new JPanel(); fourthRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),"Specials Used"));
smokelist = new JList(smokes); smokelist.setVisibleRowCount(3); smokelist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); JScrollPane smokePane = new JScrollPane(smokelist, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); addGB(fourthRow, smokeLabel, 0, 0); addGB(fourthRow, smokePane, 1, 0);
extinglist = new JList(extings); extinglist.setVisibleRowCount(3); extinglist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); JScrollPane extingPane = new JScrollPane(extinglist, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); addGB(fourthRow, extingLabel, 2, 0); addGB(fourthRow, extingPane, 3, 0);
blanketlist = new JList(blankets); blanketlist.setVisibleRowCount(3); blanketlist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); JScrollPane blanketPane = new JScrollPane(blanketlist, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); addGB(fourthRow, blanketLabel, 4, 0); addGB(fourthRow, blanketPane, 5, 0);
sprinklerlist = new JList(sprinklers); sprinklerlist.setVisibleRowCount(3); sprinklerlist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); JScrollPane sprinklerPane = new JScrollPane(sprinklerlist, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); addGB(fourthRow, sprinklerLabel, 0, 1); addGB(fourthRow, sprinklerPane, 1, 1);
speciallist = new JList(specs); speciallist.setVisibleRowCount(3); speciallist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); JScrollPane specialPane = new JScrollPane(speciallist, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); addGB(fourthRow, specialLabel, 2, 1); addGB(fourthRow, specialPane, 3, 1);
speclist = new JList(specials); speclist.setVisibleRowCount(3); speclist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); JScrollPane specPane = new JScrollPane(speclist, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); addGB(fourthRow, specLabel, 4, 1); addGB(fourthRow, specPane, 5, 1);
methodlist = new JList(methods); methodlist.setVisibleRowCount(3); methodlist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); JScrollPane methodPane = new JScrollPane(methodlist, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); addGB(fourthRow, methodLabel, 0, 2); addGB(fourthRow, methodPane, 1, 2);
weatherlist = new JList(weathers); weatherlist.setVisibleRowCount(3); weatherlist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); JScrollPane weatherPane = new JScrollPane(weatherlist, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER ); addGB(fourthRow, weatherLabel, 2, 2); addGB(fourthRow, weatherPane, 3, 2);
addGB(fourthRow, injuryLabel, 4, 2); injurylist = new JList (injuries); injurylist.setVisibleRowCount(3); injurylist.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION ); JScrollPane injuryPane = new JScrollPane(injurylist, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); addGB(fourthRow, injuryPane, 5, 2);
addGB(this, fourthRow, 0, 3);
///////////////////// //add the fifth row// ///////////////////// JPanel fifthRow = new JPanel();
gbc.fill = GridBagConstraints.HORIZONTAL; addGB(fifthRow, quit, 0, 0); quit.addActionListener(this); addGB(fifthRow, new JLabel(""), 3, 0); addGB(fifthRow, submit, 4, 0); submit.addActionListener(this); addGB(fifthRow, new JLabel(""), 5, 0); addGB(fifthRow, clearfields, 6, 0); clearfields.addActionListener(this);
addGB(this, fifthRow, 0, 4); }
public void actionPerformed(ActionEvent event) { try { String myEvent = event.getActionCommand(); int sid = 0, ftid = 0, stid = 0, fid = 0,chid = 0; int srtid = 0,tyid = 0,srcid = 0,oid = 0,did = 0; int said = 0,exid = 0,fbid = 0,spid = 0,ssid = 0,locid = 0,mid = 0,wid = 0,iid = 0; 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 fire_incident(fire_number,fire_date,caller_det,owner_det,incident_det,contact_name,sid,ftid,stid,fid)"; strQuery += "values (" + incidentnumber.getText() + ",'" + dayBox.getSelectedItem() + "/"+ monthBox.getSelectedItem() + "/" + yearBox.getSelectedItem(); strQuery += "','" + caller.getText() + "','" + owner.getText() + "','" + incident.getText(); strQuery += "','" + contact.getText() + "',";
if (stationBox.getSelectedItem() == "1") sid = 1; else if (stationBox.getSelectedItem() == "2") sid =2; else if (stationBox.getSelectedItem() == "3") sid =3; else if (stationBox.getSelectedItem() == "4") sid =4; else if (stationBox.getSelectedItem() == "5") sid =5; else if (stationBox.getSelectedItem() == "6") sid =6; else if (stationBox.getSelectedItem() == "7") sid =7; else if (stationBox.getSelectedItem() == "8") sid =8; else if (stationBox.getSelectedItem() == "9") sid =9; else if (stationBox.getSelectedItem() == "10") sid =10; else if (stationBox.getSelectedItem() == "11") sid =11; else if (stationBox.getSelectedItem() == "11") sid =11; strQuery += sid + ","; if (typeBox.getSelectedItem() == "Incident Type") ftid = 1; else if (typeBox.getSelectedItem() == "Chimney") ftid =2; else if (typeBox.getSelectedItem() == "Other Fire") ftid = 3; else if (typeBox.getSelectedItem() == "Special Service") ftid =4; else if (typeBox.getSelectedItem() == "Injuries/Fatalities") ftid = 5; strQuery += ftid + ",";
if (status[0].isSelected()) stid = 1; else if (status[1].isSelected()) stid =2; else if (status[2].isSelected()) stid =3; else if (status[3].isSelected()) stid =4; else if (status[4].isSelected()) stid =5; else if (status[5].isSelected()) stid =6; strQuery += stid + ",";
if (alarm[0].isSelected()) fid = 1; else if (alarm[1].isSelected()) fid =2; else if (alarm[2].isSelected()) fid =3; else if (alarm[3].isSelected()) fid =4; else if (alarm[4].isSelected()) fid =5; strQuery += fid + ")"; System.out.println(strQuery); s.Select(strQuery);
strQuery = "INSERT INTO fire_ia(fire_number,first_officer,senior_officer,gardai,esb,ambulance,local,other,chid)"; strQuery += "values (" + incidentnumber.getText() + ",'" + officer.getText() + "','" + senior.getText() + "','" + garda.getText(); strQuery += " - " + l.getText() + "','" + esb.getText() + " - " + st.getText() + "','"; strQuery += attend.getText() + " - " + time.getText() + "','" + local.getText() + " - " + t.getText(); strQuery += "','" + other.getText() + " - " + m.getText() + "',"; if (chimney[0].isSelected()) chid = 1; else if (chimney[1].isSelected()) chid =2; else if (chimney[2].isSelected()) chid =3; else if (chimney[3].isSelected()) chid =4; strQuery += chid + ")"; System.out.println(strQuery); s.Select(strQuery); strQuery = "INSERT INTO premises(fire_number,srtid,tyid,scrid,oid,did)"; strQuery += "values (" + incidentnumber.getText() + ",";
if (sort[0].isSelected()) srtid = 1; else if (sort[1].isSelected()) srtid =2; else if (sort[2].isSelected()) srtid =3; else if (sort[3].isSelected()) srtid =4; else if (sort[4].isSelected()) srtid =5; else if (sort[5].isSelected()) srtid =6; strQuery += srtid + ",";
if (premtypeBox.getSelectedItem() == "House") tyid = 1; else if (premtypeBox.getSelectedItem() == "Multiple Occupancy") tyid =2; else if (premtypeBox.getSelectedItem() == "Mobile Home") tyid =3; else if (premtypeBox.getSelectedItem() == "Caravan") tyid =4; else if (premtypeBox.getSelectedItem() == "Flat") tyid =5; else if (premtypeBox.getSelectedItem() == "School") tyid =6; else if (premtypeBox.getSelectedItem() == "Hospital") tyid =7; else if (premtypeBox.getSelectedItem() == "Nursing Home") tyid =8; else if (premtypeBox.getSelectedItem() == "Convent") tyid =9; else if (premtypeBox.getSelectedItem() == "Hotel") tyid =10; else if (premtypeBox.getSelectedItem() == "Guesthouse/B&B") tyid =11; else if (premtypeBox.getSelectedItem() == "Hostel") tyid =12; else if (premtypeBox.getSelectedItem() == "Care") tyid =13; else if (premtypeBox.getSelectedItem() == "Warehouse") tyid =14; else if (premtypeBox.getSelectedItem() == "Factory") tyid =15; else if (premtypeBox.getSelectedItem() == "Chemical Plant") tyid =16; else if (premtypeBox.getSelectedItem() == "Shop") tyid =17; else if (premtypeBox.getSelectedItem() == "Venue/Hall") tyid =18; else if (premtypeBox.getSelectedItem() == "Petrol Station") tyid =19; else if (premtypeBox.getSelectedItem() == "Fuel Depot") tyid =20; else if (premtypeBox.getSelectedItem() == "Office") tyid =21; else if (premtypeBox.getSelectedItem() == "Dance") tyid =22; else if (premtypeBox.getSelectedItem() == "Restaurant") tyid =23; else if (premtypeBox.getSelectedItem() == "Public House") tyid =24; else if (premtypeBox.getSelectedItem() == "Theatre") tyid =25; else if (premtypeBox.getSelectedItem() == "Cinema") tyid =26; else if (premtypeBox.getSelectedItem() == "Prison") tyid =27; else if (premtypeBox.getSelectedItem() == "Reception Centre") tyid =28; else if (premtypeBox.getSelectedItem() == "Detention Centre") tyid =29; else if (premtypeBox.getSelectedItem() == "Forest") tyid =30; else if (premtypeBox.getSelectedItem() == "Agricultural") tyid =31; else if (premtypeBox.getSelectedItem() == "Grass") tyid =32; else if (premtypeBox.getSelectedItem() == "Box") tyid =33; else if (premtypeBox.getSelectedItem() == "Vehicle") tyid =34; else if (premtypeBox.getSelectedItem() == "Indoor Store") tyid =35; else if (premtypeBox.getSelectedItem() == "Outdoor Store") tyid =36; else if (premtypeBox.getSelectedItem() == "Rubbish") tyid =37; else if (premtypeBox.getSelectedItem() == "Ships") tyid =38; else if (premtypeBox.getSelectedItem() == "Aircraft") tyid =39; else if (premtypeBox.getSelectedItem() == "Derelict") tyid =40; else if (premtypeBox.getSelectedItem() == "Skip") tyid =41; strQuery += tyid + ","; if (sourceBox.getSelectedItem() == "Matches") srcid = 1; else if (sourceBox.getSelectedItem() == "Lighter") srcid =2; else if (sourceBox.getSelectedItem() == "Cigarettes") srcid =3; else if (sourceBox.getSelectedItem() == "Smouldering Materials") srcid =4; else if (sourceBox.getSelectedItem() == "Chip Pan") srcid =5; else if (sourceBox.getSelectedItem() == "Fuel") srcid =6; else if (sourceBox.getSelectedItem() == "Electrical Wiring") srcid =7; else if (sourceBox.getSelectedItem() == "Electrical Blanket") srcid =8; else if (sourceBox.getSelectedItem() == "Electrical Cooking") srcid =9; else if (sourceBox.getSelectedItem() == "Electrical Heating") srcid =10; else if (sourceBox.getSelectedItem() == "Electrical Other") srcid =11; else if (sourceBox.getSelectedItem() == "Rubbish") srcid =12; else if (sourceBox.getSelectedItem() == "Grass") srcid =13; else if (sourceBox.getSelectedItem() == "Oil Appliance") srcid =14; else if (sourceBox.getSelectedItem() == "Solid Fuel Appliance") srcid =15; else if (sourceBox.getSelectedItem() == "Gas Cooking") srcid =16; else if (sourceBox.getSelectedItem() == "Gas Heating") srcid =17; else if (sourceBox.getSelectedItem() == "Malicious") srcid =18; else if (sourceBox.getSelectedItem() == "Other") srcid =19; strQuery += srcid + ","; if (originBox.getSelectedItem() == "Kitchen") oid = 1; else if (originBox.getSelectedItem() == "Utility Room") oid =2; else if (originBox.getSelectedItem() == "Bathroom") oid =3; else if (originBox.getSelectedItem() == "Bedroom") oid =4; else if (originBox.getSelectedItem() == "Dining Room") oid =5; else if (originBox.getSelectedItem() == "Living Room") oid =6; else if (originBox.getSelectedItem() == "Hall") oid =7; else if (originBox.getSelectedItem() == "Garage") oid =8; else if (originBox.getSelectedItem() == "Basement") oid =9; else if (originBox.getSelectedItem() == "Attic") oid =10; else if (originBox.getSelectedItem() == "Office") oid =11; else if (originBox.getSelectedItem() == "Hot Press") oid =12; else if (originBox.getSelectedItem() == "Shed") oid =13; else if (originBox.getSelectedItem() == "Boiler House") oid =14; else if (originBox.getSelectedItem() == "Other") oid =15; strQuery += oid + ","; if (dimension[0].isSelected()) did = 1; else if (dimension[1].isSelected()) did =2; else if (dimension[2].isSelected()) did =3; else if (dimension[3].isSelected()) did =4; else if (dimension[4].isSelected()) did =5; else if (dimension[5].isSelected()) did =6; else if (dimension[6].isSelected()) did =7; strQuery += did + ")";
System.out.println(strQuery); s.Select(strQuery); strQuery = "INSERT INTO specials(fire_number,said,exid,fbid,spid,ssid,locid,mid,wid,iid)"; strQuery += "values (" + incidentnumber.getText() + ",'";
if (smokelist.getSelectedValue() == "Domestic") said = 1; else if (smokelist.getSelectedValue() == "FDA") said =2; else if (smokelist.getSelectedValue() == "Operating") said =3; strQuery += said + "','";
if (extinglist.getSelectedValue() == "Installed") exid = 1; else if (extinglist.getSelectedValue() == "Used") exid =2; else if (extinglist.getSelectedValue() == "Effects - None") exid =3; else if (extinglist.getSelectedValue() == "Partial Control") exid =4; else if (extinglist.getSelectedValue() == "Control") exid =5; strQuery += exid + "','";
if (blanketlist.getSelectedValue() == "Installed") fbid = 1; else if (blanketlist.getSelectedValue() == "Used") fbid =2; else if (blanketlist.getSelectedValue() == "Effects - None") fbid =3; else if (blanketlist.getSelectedValue() == "Partial Control") fbid =4; else if (blanketlist.getSelectedValue() == "Control") fbid =5; strQuery += fbid + "','";
if (sprinklerlist.getSelectedValue() == "Installed") spid = 1; else if (sprinklerlist.getSelectedValue() == "Used") spid =2; else if (sprinklerlist.getSelectedValue() == "Effects - None") spid =3; else if (sprinklerlist.getSelectedValue() == "Partial Control") spid =4; else if (sprinklerlist.getSelectedValue() == "Control") spid =5; strQuery += spid + "','";
if (speciallist.getSelectedValue() == "Pumping/Flooding") ssid = 1; else if (speciallist.getSelectedValue() == "Rescue/Removal") ssid =2; else if (speciallist.getSelectedValue() == "Entrapment") ssid =3; else if (speciallist.getSelectedValue() == "Machinery") ssid =4; else if (speciallist.getSelectedValue() == "Non Fire Rescue") ssid =5; else if (speciallist.getSelectedValue() == "RTA") ssid =6; else if (speciallist.getSelectedValue() == "Gas Chemical") ssid =7; else if (speciallist.getSelectedValue() == "Hazsub Transit") ssid =8; else if (speciallist.getSelectedValue() == "Transit") ssid =9; strQuery += ssid + "','"; if (speclist.getSelectedValue() == "Road") locid = 1; else if (speclist.getSelectedValue() == "Field") locid =2; else if (speclist.getSelectedValue() == "Building") locid =3; else if (speclist.getSelectedValue() == "River") locid =4; else if (speclist.getSelectedValue() == "Lake") locid =5; else if (speclist.getSelectedValue() == "Sea") locid =6; else if (speclist.getSelectedValue() == "Above Ground") locid =7; else if (speclist.getSelectedValue() == "Below Ground") locid =8; else if (speclist.getSelectedValue() == "Ground Level") locid =9; else if (speclist.getSelectedValue() == "Car") locid =10; else if (speclist.getSelectedValue() == "Van") locid =11; else if (speclist.getSelectedValue() == "Pedestrian") locid =12; else if (speclist.getSelectedValue() == "Truck") locid =13; else if (speclist.getSelectedValue() == "Artic") locid =14; else if (speclist.getSelectedValue() == "Bicycle") locid =15; else if (speclist.getSelectedValue() == "Trailer") locid =16; else if (speclist.getSelectedValue() == "Tractor") locid =17; else if (speclist.getSelectedValue() == "Motorcycle") locid =18; else if (speclist.getSelectedValue() == "Decontamination") locid =19; else if (speclist.getSelectedValue() == "Standard Suit") locid =20; else if (speclist.getSelectedValue() == "Splash Suit") locid =21; else if (speclist.getSelectedValue() == "Gas Suit") locid =22; strQuery += locid + "','";
if (methodlist.getSelectedValue() == "Extinguishers") mid = 1; else if (methodlist.getSelectedValue() == "Hose Reel") mid =2; else if (methodlist.getSelectedValue() == "RTA Equipment") mid =3; else if (methodlist.getSelectedValue() == "B.A.") mid =4; else if (methodlist.getSelectedValue() == "Hydrant") mid =5; else if (methodlist.getSelectedValue() == "Open Source") mid =6; else if (methodlist.getSelectedValue() == "Jets") mid =7; else if (methodlist.getSelectedValue() == "Tanker") mid =8; else if (methodlist.getSelectedValue() == "Other") mid =9; strQuery += mid + "','";
if (weatherlist.getSelectedValue() == "Dusky") wid = 1; else if (weatherlist.getSelectedValue() == "Sunny") wid =2; else if (weatherlist.getSelectedValue() == "Overcast") wid =3; else if (weatherlist.getSelectedValue() == "Night Time") wid =4; else if (weatherlist.getSelectedValue() == "Wet") wid =5; else if (weatherlist.getSelectedValue() == "Dry") wid =6; else if (weatherlist.getSelectedValue() == "Frost") wid =7; else if (weatherlist.getSelectedValue() == "Snow") wid =8; else if (weatherlist.getSelectedValue() == "Windy") wid =9; else if (weatherlist.getSelectedValue() == "Calm") wid =10; strQuery += wid + "','";
if (injurylist.getSelectedValue() == "Personnel") iid = 1; else if (injurylist.getSelectedValue() == "Public") iid =2; strQuery += iid + "')";
System.out.println(strQuery); s.Select(strQuery);
s.Close(); } if ("ClearFields".equals(myEvent)) { incidentnumber.setText(""); caller.setText(""); owner.setText(""); incident.setText(""); contact.setText(""); officer.setText(""); senior.setText(""); garda.setText(""); l.setText(""); esb.setText(""); st.setText(""); attend.setText(""); time.setText(""); local.setText(""); t.setText(""); other.setText(""); m.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("Fire Incident Report Form"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); f.setSize(1024, 768); f.setLocation(0, 0); f.setContentPane(new Fire_Incident()); f.setVisible(true); } } |