コード例 #1
0
 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");
   }
 }
コード例 #2
0
  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;
  }