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
|
import java.awt.*; import java.awt.event.*; import javax.swing.*;
public class Vehicle extends JPanel implements ActionListener{ GridBagConstraints gbc = new GridBagConstraints(); String strQuery = new String(); Icon quitbug = new ImageIcon("door.gif"); Icon submitbug = new ImageIcon("satelite.gif");
JTextField date = new JTextField (20); JLabel dateLabel = new JLabel("Date"); JButton quit = new JButton ("Quit",quitbug); JButton submit = new JButton ("Submit",submitbug); JCheckBox coolant = new JCheckBox("Radiator Coolant Level"); JCheckBox oil = new JCheckBox("Oil Level"); JCheckBox brake = new JCheckBox("Hand Brake"); JCheckBox side = new JCheckBox("Side Lights F/R"); JCheckBox plate = new JCheckBox("No. Plate Lights"); JCheckBox head = new JCheckBox("Head Lights H/D"); JCheckBox fog = new JCheckBox("Fog Lights"); JCheckBox indicators = new JCheckBox("Indicators F/R"); JCheckBox hazard = new JCheckBox("Hazard Lights F/R"); JCheckBox brakelight = new JCheckBox("Brake Lights"); JCheckBox reverse = new JCheckBox("Reversing Lights"); JCheckBox cab = new JCheckBox("Cab Lights"); JCheckBox locker = new JCheckBox("Locker Lights"); JCheckBox search = new JCheckBox("Search Lights"); JCheckBox step = new JCheckBox("Step Lights"); JCheckBox stem = new JCheckBox("Stem Lights"); JCheckBox handspot = new JCheckBox("Cab Mounted Hand Spot"); JCheckBox pumpbay = new JCheckBox("Pump Bay Lights"); JCheckBox waterlevel = new JCheckBox("Water Level Indicator Lights"); JCheckBox speedo = new JCheckBox("Speedometer"); JCheckBox wipers = new JCheckBox("Wipers/Washers"); JCheckBox drylock = new JCheckBox("Door Locks"); JCheckBox windowreg = new JCheckBox("Window Regulators"); JCheckBox seatbelt = new JCheckBox("Seat Belts/Mountings"); JCheckBox glass = new JCheckBox("All Cab Glass"); JCheckBox mounting = new JCheckBox("Ladder Mounting/Release Mechanism"); JCheckBox tyrecheck = new JCheckBox("Visual Tyre Check"); JCheckBox gauge = new JCheckBox("P.T.O. Pump Gauges"); JCheckBox coolantlevel = new JCheckBox("Coolant Level"); JCheckBox waterindicator = new JCheckBox("Water Level Indicator"); JCheckBox test = new JCheckBox("Test Main Pump & F/A"); JCheckBox mirror = new JCheckBox("Mirror"); JCheckBox radio = new JCheckBox("Radio"); JCheckBox resus = new JCheckBox("Resuscitation Box - Sealed (1)"); JCheckBox maternity = new JCheckBox("Maternity Box - Sealed (1)"); JCheckBox burns = new JCheckBox("Burns Box - Sealed (1)"); JCheckBox dressings = new JCheckBox("Dressings Box - Sealed (1)"); JCheckBox doctor = new JCheckBox("Doctors Kit - Sealed (1)"); JCheckBox infection = new JCheckBox("Infection Control - Sealed (1)"); JCheckBox als = new JCheckBox("A.L.S. Solutions - Sealed (1)"); JCheckBox defib = new JCheckBox("De - Fibrillator (1)"); JCheckBox mains = new JCheckBox("Mains Charger (1)"); JCheckBox trickle = new JCheckBox("Trickle Charger (1)"); JCheckBox spo2 = new JCheckBox("SPO2 (1)"); JCheckBox resusbag = new JCheckBox("Resusitation Bag (1)"); JCheckBox argo = new JCheckBox("Argo Bag (1)"); JCheckBox suction = new JCheckBox("Suction (1)"); JCheckBox spinal = new JCheckBox("Spinal Board (1)"); JCheckBox ked = new JCheckBox("K.E.D. (1)"); JCheckBox collars = new JCheckBox("Set of Collars (1)"); JCheckBox traction = new JCheckBox("Traction Splint (1)"); JCheckBox vacuum = new JCheckBox("Vacuum Splint (1)"); JCheckBox ortho = new JCheckBox("Orthpedic Stretcher (1)"); JCheckBox frac = new JCheckBox("Frac Straps (1)"); JCheckBox chair = new JCheckBox("Chair (1)"); JCheckBox carrying = new JCheckBox("Carrying Sheet (1)"); JCheckBox blankets = new JCheckBox("Blankets (8 min)"); JCheckBox o2l = new JCheckBox("O2 D Size (2)"); JCheckBox o2s = new JCheckBox("O2 F Size (1)"); JCheckBox entonox = new JCheckBox("Entonox (2)");
public Vehicle(){
JPanel dateRow = new JPanel(); gbc.fill = GridBagConstraints.NONE; gbc.weightx = 1.0; gbc.weighty = 1.0; addGB(dateRow,dateLabel,0,0); addGB(dateRow,date,1,0); addGB(this,dateRow,0,0);
JPanel titleRow = new JPanel(); titleRow.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),"Driver")); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.weightx = 1.0; gbc.weighty = 1.0; addGB(titleRow,coolant, 0, 0); addGB(titleRow,oil, 0, 1); addGB(titleRow,brake, 0, 2); addGB(titleRow,side, 0, 3); addGB(titleRow,plate, 0, 4); addGB(titleRow,head, 0, 5); addGB(titleRow,fog, 0, 6); addGB(titleRow,indicators, 0, 7); addGB(titleRow,hazard, 0, 8); addGB(titleRow,brakelight, 0, 9); addGB(titleRow,reverse, 0, 10);
addGB(titleRow,cab, 1, 0); addGB(titleRow,locker, 1, 1); addGB(titleRow,search, 1, 2); addGB(titleRow,step, 1, 3); addGB(titleRow,stem, 1, 4); addGB(titleRow,handspot, 1, 5); addGB(titleRow,pumpbay, 1, 6); addGB(titleRow,waterlevel, 1, 7); addGB(titleRow,speedo, 1, 8); addGB(titleRow,wipers, 1, 9); addGB(titleRow,drylock, 1, 10);
addGB(titleRow,windowreg, 2, 0); addGB(titleRow,seatbelt, 2, 1); addGB(titleRow,glass, 2, 2); addGB(titleRow,mounting, 2, 3); addGB(titleRow,tyrecheck, 2, 4); addGB(titleRow,gauge, 2, 5); addGB(titleRow,coolantlevel, 2, 6); addGB(titleRow,waterindicator, 2, 7); addGB(titleRow,test, 2, 8); addGB(titleRow,mirror, 2, 9); addGB(titleRow,radio, 2, 10);
addGB(this, titleRow, 0, 1);
JPanel title1Row = new JPanel(); title1Row.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),"Attendant")); addGB(title1Row,resus, 0, 0); addGB(title1Row,maternity, 0, 1); addGB(title1Row,burns, 0, 2); addGB(title1Row,dressings, 0, 3); addGB(title1Row,doctor, 0, 4); addGB(title1Row,infection, 0, 5); addGB(title1Row,als, 0, 6); addGB(title1Row,defib, 0, 7); addGB(title1Row,mains, 0, 8);
addGB(title1Row,trickle, 1, 0); addGB(title1Row,spo2, 1, 1); addGB(title1Row,resusbag, 1, 2); addGB(title1Row,argo, 1, 3); addGB(title1Row,suction, 1, 4); addGB(title1Row,spinal, 1, 5); addGB(title1Row,ked, 1, 6); addGB(title1Row,collars, 1, 7); addGB(title1Row,traction, 1, 8);
addGB(title1Row,vacuum, 2, 0); addGB(title1Row,ortho, 2, 1); addGB(title1Row,frac, 2, 2); addGB(title1Row,chair, 2, 3); addGB(title1Row,carrying, 2, 4); addGB(title1Row,blankets, 2, 5); addGB(title1Row,o2l, 2, 6); addGB(title1Row,o2s, 2, 7); addGB(title1Row,entonox, 2, 8);
addGB(this, title1Row, 0, 2); 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(this, fifthRow, 0, 3); }
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 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 driver(ddate,fault)"; strQuery += "values (" + date.getText() + ",'"; if (coolant.isSelected()) strQuery += coolant.getText(); if (oil.isSelected()) strQuery += "," + oil.getText(); if (brake.isSelected()) strQuery += "," + brake.getText(); if (side.isSelected()) strQuery += "," + side.getText(); if (plate.isSelected()) strQuery += "," + plate.getText(); if (head.isSelected()) strQuery += "," + head.getText(); if (fog.isSelected()) strQuery += "," + fog.getText(); if (indicators.isSelected()) strQuery += "," + indicators.getText(); if (hazard.isSelected()) strQuery += "," + hazard.getText(); if (brakelight.isSelected()) strQuery += "," + brakelight.getText(); if (reverse.isSelected()) strQuery += "," + reverse.getText(); if (cab.isSelected()) strQuery += "," + cab.getText(); if (locker.isSelected()) strQuery += "," + locker.getText(); if (search.isSelected()) strQuery += "," + search.getText(); if (step.isSelected()) strQuery += "," + step.getText(); if (stem.isSelected()) strQuery += "," + stem.getText(); if (handspot.isSelected()) strQuery += "," + handspot.getText(); if (pumpbay.isSelected()) strQuery += "," + pumpbay.getText(); if (waterlevel.isSelected()) strQuery += "," + waterlevel.getText(); if (speedo.isSelected()) strQuery += "," + speedo.getText(); if (wipers.isSelected()) strQuery += "," + wipers.getText(); if (drylock.isSelected()) strQuery += "," + drylock.getText(); if (windowreg.isSelected()) strQuery += "," + windowreg.getText(); if (seatbelt.isSelected()) strQuery += "," + seatbelt.getText(); if (glass.isSelected()) strQuery += "," + glass.getText(); if (mounting.isSelected()) strQuery += "," + mounting.getText(); if (tyrecheck.isSelected()) strQuery += "," + tyrecheck.getText(); if (gauge.isSelected()) strQuery += "," + gauge.getText(); if (coolantlevel.isSelected()) strQuery += "," + coolantlevel.getText(); if (waterindicator.isSelected()) strQuery += "," + waterindicator.getText(); if (test.isSelected()) strQuery += "," + test.getText(); if (mirror.isSelected()) strQuery += "," + mirror.getText(); if (radio.isSelected()) strQuery += "," + radio.getText(); strQuery += "')"; System.out.println(strQuery); s.Select(strQuery);
strQuery = "INSERT INTO attendant(adate,fault)"; strQuery += "values (" + date.getText() + ",'";
if (resus.isSelected()) strQuery += resus.getText(); if (maternity.isSelected()) strQuery += "," + maternity.getText(); if (burns.isSelected()) strQuery += "," + burns.getText(); if (dressings.isSelected()) strQuery += "," + dressings.getText(); if (doctor.isSelected()) strQuery += "," + doctor.getText(); if (infection.isSelected()) strQuery += "," + infection.getText(); if (als.isSelected()) strQuery += "," + als.getText(); if (defib.isSelected()) strQuery += "," + defib.getText(); if (mains.isSelected()) strQuery += "," + mains.getText(); if (trickle.isSelected()) strQuery += "," + trickle.getText(); if (spo2.isSelected()) strQuery += "," + spo2.getText(); if (resusbag.isSelected()) strQuery += "," + resusbag.getText(); if (argo.isSelected()) strQuery += "," + argo.getText(); if (suction.isSelected()) strQuery += "," + suction.getText(); if (spinal.isSelected()) strQuery += "," + spinal.getText(); if (ked.isSelected()) strQuery += "," + ked.getText(); if (collars.isSelected()) strQuery += "," + collars.getText(); if (traction.isSelected()) strQuery += "," + traction.getText(); if (vacuum.isSelected()) strQuery += "," + vacuum.getText(); if (ortho.isSelected()) strQuery += "," + ortho.getText(); if (frac.isSelected()) strQuery += "," + frac.getText(); if (chair.isSelected()) strQuery += "," + chair.getText(); if (carrying.isSelected()) strQuery += "," + carrying.getText(); if (blankets.isSelected()) strQuery += "," + blankets.getText(); if (o2l.isSelected()) strQuery += "," + o2l.getText(); if (o2s.isSelected()) strQuery += "," + o2s.getText(); if (entonox.isSelected()) strQuery += "," + entonox.getText(); strQuery += "')";
System.out.println(strQuery); s.Select(strQuery);
s.Close(); } } } catch (Exception e) { System.out.println("An Error has occured at ListenForButtonPress :"+e.toString()); } }
public static void main(String[] args) { JFrame f = new JFrame("Ambulance Asset Maintenance Form"); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); f.setSize(1024,768); f.setLocation(0,0); f.setContentPane(new Vehicle()); f.setVisible(true); } } |