public void showAllRecordForm() { fmAllRecords = new Form("All records"); try { RecordEnumeration recEnum = rs.enumerateRecords(null, null, false); while (recEnum.hasNextElement()) { try { // System.out.println(new String(recEnum.nextRecord())); String name = "Nenacetl jsem"; int number = 0; try { byte[] record = recEnum.nextRecord(); ByteArrayInputStream buffer = new ByteArrayInputStream(record); DataInputStream dis = new DataInputStream(buffer); name = dis.readUTF(); number = dis.readInt(); dis.close(); } catch (Exception e) { } fmAllRecords.append(name + " " + String.valueOf(number) + "\n"); } catch (Exception e) { System.out.println(e.getMessage()); } // } } catch (Exception ex) { System.out.println(ex.getMessage()); } fmAllRecords.addCommand(cmdMenu); fmAllRecords.setCommandListener(this); dsp.setCurrent(fmAllRecords); }
public TrafficCams(Controller controller) { super("Traffic Status", Choice.EXCLUSIVE); this.controller = controller; traf = this; TrafOption = new Command("OK", Command.SCREEN, 1); bckMenu = new Command("back", Command.BACK, 2); VehicleOk = new Command("OK", Command.SCREEN, 1); Vehicleback = new Command("Back", Command.BACK, 2); this.addCommand(TrafOption); this.addCommand(bckMenu); setCommandListener(this); if (fmViewPng == null) { fmViewPng = new Form(""); cmBack = new Command("Back", Command.BACK, 1); RefreshImage = new Command("refresh", Command.OK, 2); fmViewPng.addCommand(cmBack); fmViewPng.addCommand(RefreshImage); fmViewPng.setCommandListener(this); } }
public void addRecordForm() { fmAddRecord = new Form("Add Record"); txfName = new TextField("Name", "", 10, TextField.ANY); txfNumber = new TextField("Number", "", 10, TextField.NUMERIC); fmAddRecord.append(txfName); fmAddRecord.append(txfNumber); fmAddRecord.addCommand(cmdAdd); fmAddRecord.addCommand(cmdMenu); fmAddRecord.setCommandListener(this); dsp.setCurrent(fmAddRecord); }
public void getNumberRecord() { fmNumbers = new Form("Number of Records"); int number = 0; try { number = rs.getNumRecords(); } catch (Exception e) { } fmNumbers.append("Numbers of Records: " + number); dsp.setCurrent(fmNumbers); fmNumbers.setCommandListener(this); fmNumbers.addCommand(cmdMenu); }
public OriginatingINVITE() { // <i><b>Initialize MIDlet display</b></i> display = Display.getDisplay(this); // <i><b>create a Form for progess info printings</b></i> form = new Form("Session example"); address = new TextField("INVITE:", "sip:[email protected]:5070", 40, TextField.LAYOUT_LEFT); form.append(address); byeCmd = new Command("Bye", Command.ITEM, 1); restartCmd = new Command("Restart", Command.ITEM, 1); startCmd = new Command("Start", Command.ITEM, 1); form.addCommand(startCmd); exitCmd = new Command("Exit", Command.EXIT, 1); form.addCommand(exitCmd); form.setCommandListener(this); }
public void showFirstRecord() { fmFirstRecord = new Form("First Record"); String name = "Nenacetl jsem"; int number = 0; try { byte[] record = rs.getRecord(1); ByteArrayInputStream buffer = new ByteArrayInputStream(record); DataInputStream dis = new DataInputStream(buffer); name = dis.readUTF(); number = dis.readInt(); dis.close(); } catch (Exception e) { } fmFirstRecord.append(name + " " + String.valueOf(number)); // fmFirstRecord.append(String.valueOf(number)); fmFirstRecord.setCommandListener(this); fmFirstRecord.addCommand(cmdMenu); dsp.setCurrent(fmFirstRecord); }
public void editRecord(int record_num) { fmEditRecord = new Form("Edit Record"); String name = "Nenacetl jsem"; int number = 0; try { byte[] record = rs.getRecord(record_num); ByteArrayInputStream buffer = new ByteArrayInputStream(record); DataInputStream dis = new DataInputStream(buffer); name = dis.readUTF(); number = dis.readInt(); dis.close(); } catch (Exception e) { } txfName = new TextField("Name", name, 10, TextField.ANY); txfNumber = new TextField("Number", String.valueOf(number), 10, TextField.NUMERIC); fmEditRecord.append(txfName); fmEditRecord.append(txfNumber); fmEditRecord.addCommand(cmdEdit); fmEditRecord.addCommand(cmdMenu); fmEditRecord.setCommandListener(this); dsp.setCurrent(fmEditRecord); }
public void commandAction(Command command, Displayable displayable) { if (command == camList) { controller.setCurrentScreen(this); controller.setCurrentScreen(this); } if (command == refreshList) { controller.showProgressBar(); refreshCamList(); } if (command == cmBack) { controller.getDisp().setCurrent(LiveCameras); } if (command == RefreshImage) { refreshImage(); } if (command == viewImage) { refreshImage(); } if (command == TrafOption) { if (this.getString(this.getSelectedIndex()).equals("Cameras")) { LiveCameras(); } else if (this.getString(this.getSelectedIndex()).equals("Traffic Fines")) { if (VehicleNoForm == null) { VehicleNoForm = new Form("Traffic Fines"); vehNo = new TextField("Vehicle Number", "", 100, TextField.ANY); VehicleNoForm.append(vehNo); VehicleNoForm.addCommand(Vehicleback); VehicleNoForm.addCommand(VehicleOk); VehicleNoForm.setCommandListener(this); } controller.setCurrentScreen(VehicleNoForm); } else { new Thread() { public void run() { getTrafficSpots(); } }.start(); } } if (command == bckMenu) { controller.MainMenu(); } if (command == Vehicleback) { controller.setCurrentScreen(this); } if (command == VehicleOk) { if (vehNo.getString().equals("")) { controller.showAlert("Enter the vehicle number", 0, AlertType.ERROR); } else { controller.showProgressBar(); new Thread() { public void run() { Downloader dwn = new Downloader(controller); String message = dwn.requestForData( "http://125.17.140.50/notices/vehiclefinedetails.aspx?veh_no=" + vehNo.getString()); vehNo.setString(""); controller.showAlert(message, 0, AlertType.INFO); } }.start(); new Thread() { public void run() { controller.setCurrentScreen(VehicleNoForm); } }.start(); } } }