public void commandAction(Command c, Displayable d) { if (c == startCmd) { form.deleteAll(); form.removeCommand(startCmd); form.addCommand(byeCmd); Thread t = new Thread() { public void run() { startSession(); } }; t.start(); // startSession(); return; } else if (c == exitCmd) { destroyApp(true); return; } else if (c == byeCmd) { form.removeCommand(byeCmd); form.addCommand(restartCmd); sendBYE(); return; } else if (c == restartCmd) { stopListener(); form.removeCommand(restartCmd); form.addCommand(startCmd); form.deleteAll(); form.append(address); return; } }
public Form getForm() { if (form == null) { form = new Form("form"); form.addCommand(getC_tovars()); form.addCommand(getC_history()); form.setCommandListener(this); } return form; }
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); }
/** * Returns an initialized instance of inputForm component. * * @return the initialized component instance */ public Form getInputForm() { if (inputForm == null) { // GEN-END:|14-getter|0|14-preInit // write pre-init user code here inputForm = new Form( "Guess the number!", new Item[] {getStringItem(), getInputNumber()}); // GEN-BEGIN:|14-getter|1|14-postInit inputForm.addCommand(getOkCommand()); inputForm.addCommand(getExitCommand()); inputForm.setCommandListener(this); // GEN-END:|14-getter|1|14-postInit // write post-init user code here } // GEN-BEGIN:|14-getter|2| return inputForm; }
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 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 Form getSupportMe() { if (frmSupportMe == null) { // --------------------------------------------- // Form f = ... frmSupportMe = new Form("Support Me"); frmSupportMe.setLayout(new BorderLayout()); Image bimage = null; try { bimage = Image.createImage("/images/metaLabSmall.png"); } catch (IOException ex) { ex.printStackTrace(); } Label bottomText = new Label(bimage); bottomText.setAlignment(Component.CENTER); bottomText.setText("Our Logo"); bottomText.setTextPosition(Component.BOTTOM); Container buttonBar = new Container(new BoxLayout(BoxLayout.X_AXIS)); buttonBar.addComponent(new Button("Add")); buttonBar.addComponent(new Button("Remove")); buttonBar.addComponent(new Button("Edit")); buttonBar.addComponent(new Button("Send")); buttonBar.addComponent(new Button("Exit")); frmSupportMe.addComponent(BorderLayout.CENTER, bottomText); frmSupportMe.addComponent(BorderLayout.SOUTH, buttonBar); frmSupportMe.addCommand(mBackCommand); frmSupportMe.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier. } return frmSupportMe; }
public Form getAboutUs() { final Form f = new Form("Event counting"); if (frmAboutUs == null) { f.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); final Button pushButton = new Button("Tap me!"); final Label countLabel = new Label(" "); pushButton.addActionListener( new ActionListener() { private int c = 0; public void actionPerformed(ActionEvent ae) { c++; countLabel.setText(Integer.toString(c)); f.layoutContainer(); pushButton.setText("Tapped " + Integer.toString(c) + " times"); // System.out.println(Integer.toString(c)); } }); f.addComponent(pushButton); f.addCommand(mBackCommand); f.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier. } return f; }
public Form getF_welcome() { if (f_welcome == null) { f_welcome = new Form("NGCalc 2.4.3 \u00A9 Revzin", new Item[] {getImageItem()}); f_welcome.addCommand(getC_canvas()); f_welcome.setCommandListener(this); } return f_welcome; }
/** * Returns an initialized instance of resultForm component. * * @return the initialized component instance */ public Form getResultForm() { if (resultForm == null) { // GEN-END:|26-getter|0|26-preInit // write pre-init user code here resultForm = new Form( "Result", new Item[] { getResultText(), getAttemptsText() }); // GEN-BEGIN:|26-getter|1|26-postInit resultForm.addCommand(getBackCommand()); resultForm.addCommand(getExitCommand1()); resultForm.setCommandListener(this); // GEN-END:|26-getter|1|26-postInit // write post-init user code here } // GEN-BEGIN:|26-getter|2| return resultForm; }
/** Handle incoming response here */ public void notifyResponse(SipClientConnection scc) { int statusCode = 0; boolean received = false; try { scc.receive(0); // <i><b>fetch resent response</b></i> statusCode = scc.getStatusCode(); str = new StringItem("Response: ", statusCode + " " + scc.getReasonPhrase()); form.append(str); if (statusCode < 200) { dialog = scc.getDialog(); form.append("Early-Dialog state: " + dialog.getState()); } if (statusCode == 200) { String contentType = scc.getHeader("Content-Type"); String contentLength = scc.getHeader("Content-Length"); int length = Integer.parseInt(contentLength); if (contentType.equals("application/sdp")) { // // <i><b>handle SDP here</b></i> // } dialog = scc.getDialog(); // <i><b>save dialog info</b></i> form.append("Dialog state: " + dialog.getState()); scc.initAck(); // <i><b>initialize and send ACK</b></i> scc.send(); str = new StringItem("Session established: ", scc.getHeader("Call-ID")); form.append(str); scc.close(); } else if (statusCode >= 300) { str = new StringItem("Session failed: ", scc.getHeader("Call-ID")); form.append(str); form.removeCommand(byeCmd); form.addCommand(restartCmd); scc.close(); } } catch (IOException ioe) { // <i><b>handle e.g. transaction timeout here</b></i> str = new StringItem("No answer: ", ioe.getMessage()); form.append(str); form.removeCommand(byeCmd); form.addCommand(restartCmd); } }
/** * This method returns instance for PrevNotClosedForm component and should be called instead of * accessing PrevNotClosedForm field directly.//GEN-BEGIN:MVDGetBegin46 * * @return Instance for PrevNotClosedForm component */ public Form get_PrevNotClosedForm() { if (PrevNotClosedForm == null) { // GEN-END:MVDGetBegin46 // Insert pre-init code here PrevNotClosedForm = new Form(null, new Item[] {get_stringItem5()}); // GEN-BEGIN:MVDGetInit46 PrevNotClosedForm.addCommand(get_okCommand2()); PrevNotClosedForm.setCommandListener(this); // GEN-END:MVDGetInit46 // Insert post-init code here } // GEN-BEGIN:MVDGetEnd46 return PrevNotClosedForm; } // GEN-END:MVDGetEnd46
/** * This method returns instance for helpForm component and should be called instead of accessing * helpForm field directly.//GEN-BEGIN:MVDGetBegin25 * * @return Instance for helpForm component */ public Form get_helpForm() { if (helpForm == null) { // GEN-END:MVDGetBegin25 // Insert pre-init code here helpForm = new Form(null, new Item[] {get_stringItem4()}); // GEN-BEGIN:MVDGetInit25 helpForm.addCommand(get_okCommand2()); helpForm.setCommandListener(this); // GEN-END:MVDGetInit25 // Insert post-init code here } // GEN-BEGIN:MVDGetEnd25 return helpForm; } // GEN-END:MVDGetEnd25
/** * This method returns instance for BTOffForm component and should be called instead of accessing * BTOffForm field directly.//GEN-BEGIN:MVDGetBegin16 * * @return Instance for BTOffForm component */ public Form get_BTOffForm() { if (BTOffForm == null) { // GEN-END:MVDGetBegin16 // Insert pre-init code here BTOffForm = new Form(null, new Item[] {get_stringItem2()}); // GEN-BEGIN:MVDGetInit16 BTOffForm.addCommand(get_okCommand2()); BTOffForm.setCommandListener(this); // GEN-END:MVDGetInit16 // Insert post-init code here } // GEN-BEGIN:MVDGetEnd16 return BTOffForm; } // GEN-END:MVDGetEnd16
/** * This method returns instance for StartFailedForm component and should be called instead of * accessing StartFailedForm field directly.//GEN-BEGIN:MVDGetBegin19 * * @return Instance for StartFailedForm component */ public Form get_StartFailedForm() { if (StartFailedForm == null) { // GEN-END:MVDGetBegin19 // Insert pre-init code here StartFailedForm = new Form(null, new Item[] {get_stringItem3()}); // GEN-BEGIN:MVDGetInit19 StartFailedForm.addCommand(get_okCommand2()); StartFailedForm.setCommandListener(this); // GEN-END:MVDGetInit19 // Insert post-init code here } // GEN-BEGIN:MVDGetEnd19 return StartFailedForm; } // GEN-END:MVDGetEnd19
/** * Returns an initiliazed instance of LoginForm component. * * @return the initialized component instance */ public Form getLoginForm() { if (LoginForm == null) { // GEN-END:|14-getter|0|14-preInit // write pre-init user code here LoginForm = new Form( "Login Screen", new Item[] { getUserAgentNameTF(), getTextField() }); // GEN-BEGIN:|14-getter|1|14-postInit LoginForm.addCommand(getExitCommand()); LoginForm.addCommand(getOkCommand()); LoginForm.addCommand(getOfflineMode()); LoginForm.addCommand(getCreateContainer()); LoginForm.addCommand(getCreateAgentandJoin()); LoginForm.setCommandListener(this); // GEN-END:|14-getter|1|14-postInit // write post-init user code here } // GEN-BEGIN:|14-getter|2| return LoginForm; }
/** * This method returns instance for NoBTForm component and should be called instead of accessing * NoBTForm field directly.//GEN-BEGIN:MVDGetBegin11 * * @return Instance for NoBTForm component */ public Form get_NoBTForm() { if (NoBTForm == null) { // GEN-END:MVDGetBegin11 // Insert pre-init code here NoBTForm = new Form(null, new Item[] {get_stringItem1()}); // GEN-BEGIN:MVDGetInit11 NoBTForm.addCommand(get_okCommand2()); NoBTForm.setCommandListener(this); // GEN-END:MVDGetInit11 // Insert post-init code here } // GEN-BEGIN:MVDGetEnd11 return NoBTForm; } // GEN-END:MVDGetEnd11
/** * This method returns instance for NoBTAPIForm component and should be called instead of * accessing NoBTAPIForm field directly.//GEN-BEGIN:MVDGetBegin43 * * @return Instance for NoBTAPIForm component */ public Form get_NoBTAPIForm() { if (NoBTAPIForm == null) { // GEN-END:MVDGetBegin43 // Insert pre-init code here NoBTAPIForm = new Form(null, new Item[] {get_stringItem8()}); // GEN-BEGIN:MVDGetInit43 NoBTAPIForm.addCommand(get_exitCommand()); NoBTAPIForm.setCommandListener(this); // GEN-END:MVDGetInit43 // Insert post-init code here } // GEN-BEGIN:MVDGetEnd43 return NoBTAPIForm; } // GEN-END:MVDGetEnd43
public Form getAboutYou() { Form f = new Form("...placeholder ..."); if (frmAboutYou == null) { f.addComponent(new Label("Choose Back to return to the home screen.")); f.addCommand(mBackCommand); f.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier. } return f; }
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 Form getToDoList() { Form f = new Form("To Do List"); if (frmToDoList == null) { f.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); Label sLabel = new Label("To Do List appears here"); f.addComponent(sLabel); f.addCommand(mBackCommand); f.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier. f.setTransitionInAnimator(Transition3D.createCube(300, false)); f.setTransitionOutAnimator(Transition3D.createCube(300, true)); } return f; }
public Form getSurveys() { if (frmSurveys == null) { frmSurveys = new Form("Surveys"); Label sLabel = new Label("Surveys On Board"); frmSurveys.addComponent(sLabel); frmSurveys.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); RadioButton rb; ButtonGroup group = new ButtonGroup(); rb = new RadioButton("Grilled chicken"); group.add(rb); frmSurveys.addComponent(rb); rb = new RadioButton("Filet mignon"); group.add(rb); frmSurveys.addComponent(rb); rb = new RadioButton("Mahi mahi"); group.add(rb); frmSurveys.addComponent(rb); rb = new RadioButton("Chili"); group.add(rb); frmSurveys.addComponent(rb); CheckBox cb; cb = new CheckBox("Guacamole"); frmSurveys.addComponent(cb); cb = new CheckBox("Tabasco sauce"); frmSurveys.addComponent(cb); cb = new CheckBox("Mango salsa"); frmSurveys.addComponent(cb); cb = new CheckBox("Mayonnaise"); frmSurveys.addComponent(cb); cb = new CheckBox("Whipped cream"); frmSurveys.addComponent(cb); frmSurveys.addCommand(mBackCommand); frmSurveys.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier. } return frmSurveys; }
public Form getCalendar() { Form f = new Form("Calendar"); if (frmCalendar == null) { f.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); Calendar cal = new Calendar(); f.addComponent(cal); f.addCommand(mBackCommand); f.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier. f.setTransitionInAnimator(Transition3D.createCube(300, false)); f.setTransitionOutAnimator(Transition3D.createCube(300, true)); } return f; }
/* public PIMBrowser getPimToDo() { if (pimToDo == null) { // write pre-init user code here pimToDo = new PIMBrowser(getDisplay(), PIM.TODO_LIST); pimToDo.setTitle("To Do List"); pimToDo.addCommand(PIMBrowser.SELECT_PIM_ITEM); pimToDo.addCommand(getBackCommand5()); pimToDo.setCommandListener(this); // write post-init user code here } return pimToDo; } */ public Form fullgetToDoList() { Form f = new Form("To Do List"); if (frmToDoList == null) { f.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); toDoList = new List(); pim = PIM.getInstance(); f.addComponent(toDoList); final TextArea searchField = TextField.create(); f.addComponent(searchField); Button searchButton = new Button("Search"); searchButton.setPreferredW(f.getWidth() / 2 - 5); searchButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { populateToDoList(searchField.getText()); } }); Button clearButton = new Button("Clear"); clearButton.setPreferredW(f.getWidth() / 2 - 5); clearButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { searchField.setText(""); populateToDoList(""); } }); Container buttonContainer = new Container(); buttonContainer.setLayout(new BorderLayout()); buttonContainer.addComponent(BorderLayout.WEST, searchButton); buttonContainer.addComponent(BorderLayout.EAST, clearButton); f.addComponent(buttonContainer); populateToDoList(searchField.getText()); f.addCommand(mBackCommand); f.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier. f.setTransitionInAnimator(Transition3D.createCube(300, false)); f.setTransitionOutAnimator(Transition3D.createCube(300, true)); } return f; }
public void notifyRequest(SipConnectionNotifier sn) { try { ssc = scn.acceptAndOpen(); // <i><b>blocking</b></i> if (ssc.getMethod().equals("BYE")) { // <i><b>respond 200 OK to BYE</b></i> ssc.initResponse(200); ssc.send(); str = new StringItem("Other side hang-up!", ""); form.append(str); } form.append("Closing notifier..."); form.removeCommand(byeCmd); form.addCommand(restartCmd); scn.close(); } catch (IOException ex) { // <i><b>handle IOException</b></i> } }
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 Form getResources() { if (frmResources == null) { frmResources = new Form("Resources"); List list = new List(); list.addItem("uno"); list.addItem("due"); list.addItem("tre"); list.addItem("quattro"); list.addItem("cinque"); list.addItem("sei"); frmResources.addComponent(list); ComboBox comboBox = new ComboBox(list.getModel()); frmResources.addComponent(comboBox); frmResources.addCommand(mBackCommand); frmResources.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier. } return frmResources; }
public Form getTorch() { Form f = new Form("Torch"); if (frmTorch == null) { f.setLayout(new BoxLayout(BoxLayout.Y_AXIS)); Label sLabel = new Label("Torch"); f.addComponent(sLabel); /* UIManager uim = UIManager.getInstance(); Hashtable ht = new Hashtable(); ht.put("sel#" + Style.BG_COLOR, "d0d0ed"); ht.put(Style.BG_COLOR, "ffffff"); ht.put(Style.FG_COLOR, "000056"); uim.setThemeProps(ht); */ f.addCommand(mBackCommand); f.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier. f.setTransitionInAnimator(Transition3D.createCube(300, false)); f.setTransitionOutAnimator(Transition3D.createCube(300, true)); } return f; }
public Form getMessages() { if (frmMessages == null) { // --------------------------------------------------- frmMessages = new Form("Messages"); TextArea area = new TextArea("Peppino"); frmMessages.addComponent(area); TextArea big = new TextArea( "On February 24, 1815, the lookout at " + "Notre-Dame de la Garde signalled the arrival of the three-master " + "Pharaon, coming from Smyrna, Trieste and Naples.", 5, 20); frmMessages.addComponent(big); frmMessages.addCommand(mBackCommand); frmMessages.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier. // --------------------------------------- } return frmMessages; }
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); }