protected void beforeGUI1(Form f) { try { HttpCon con12 = new HttpCon(null, PropertyClass.ServerUrl + "Allfrends"); con12.SetContype(false, true, true); Thread t = new Thread(con12); synchronized (t) { t.start(); t.wait(); } final String bf[] = Splitter.Split(con12.getValue().toString(), "-"); System.out.println(bf); final List l = (List) findByName("studentlist", f); for (int i = 0; i < bf.length - 1; i++) { l.addItem(Splitter.Split(bf[i], "/")[0]); } l.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent ae) { frndid = Splitter.Split(bf[l.getSelectedIndex()], "/")[1]; showForm("Userprofile", null); } }); } catch (Exception e) { System.out.println(e); } super.beforeGUI1(f); }
private void populateToDoList(String searchTerm) { toDoList.setModel(new DefaultListModel()); try { String[] pimListNames = pim.listPIMLists(PIM.TODO_LIST); for (int i = 0; i < pimListNames.length; ++i) { ContactList cl = (ContactList) pim.openPIMList(PIM.TODO_LIST, PIM.READ_ONLY, pimListNames[i]); Enumeration items = cl.items(searchTerm); while (items.hasMoreElements()) { Contact c = (Contact) items.nextElement(); toDoList.addItem(c.getString(Contact.FORMATTED_NAME, 0)); } } } catch (PIMException ex) { ex.printStackTrace(); } if (toDoList.getModel().getSize() == 0) { toDoList.addItem("No matches"); } }
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; }