コード例 #1
0
  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;
  }
コード例 #2
0
  /*
   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;
  }
コード例 #3
0
  private void createUI() {
    // Set up screen for transitions.
    mAwayForm = new Form("...placeholder ...");
    mAwayForm.addComponent(new Label("Choose Back to return to the home screen."));

    mBackCommand = new Command("Back");
    mAwayForm.addCommand(mBackCommand);
    mAwayForm.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.

    frmSurveys = getSurveys();
    frmChallenges = getChallenges();
    frmResources = getResources();
    frmMessages = getMessages();
    frmSupportMe = getSupportMe();
    frmAboutUs = getAboutUs();
    frmAboutYou = getAboutYou();
    frmCalendar = getCalendar();
    frmContacts = getContacts();
    frmToDoList = getToDoList();
    frmTorch = getTorch();

    // Set up main screen.
    mHomeForm = new Form("Today");
    mHomeForm.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

    btnChallengesFrm = new Button("Challenges");
    btnChallengesFrm.addActionListener(this);
    mHomeForm.addComponent(btnChallengesFrm);

    btnSurveysFrm = new Button("Surveys");
    btnSurveysFrm.addActionListener(this);
    mHomeForm.addComponent(btnSurveysFrm);

    btnResourceFrm = new Button("Resources");
    btnResourceFrm.addActionListener(this);
    mHomeForm.addComponent(btnResourceFrm);

    mCubeButton = new Button("Messages");
    mCubeButton.addActionListener(this);
    mHomeForm.addComponent(mCubeButton);

    btnSupportFrm = new Button("Support Me");
    btnSupportFrm.addActionListener(this);
    mHomeForm.addComponent(btnSupportFrm);

    btnContactsFrm = new Button("Contacts");
    btnContactsFrm.addActionListener(this);
    mHomeForm.addComponent(btnContactsFrm);

    btnCalendarFrm = new Button("Calendar");
    btnCalendarFrm.addActionListener(this);
    mHomeForm.addComponent(btnCalendarFrm);

    btnToDoFrm = new Button("To Do");
    btnToDoFrm.addActionListener(this);
    mHomeForm.addComponent(btnToDoFrm);

    mFilesButton = new Button("Files");
    mFilesButton.addActionListener(this);
    mHomeForm.addComponent(mFilesButton);

    btnAboutUs = new Button("About Us");
    btnAboutUs.addActionListener(this);
    mHomeForm.addComponent(btnAboutUs);

    btnAboutYou = new Button("About You");
    btnAboutYou.addActionListener(this);
    mHomeForm.addComponent(btnAboutYou);

    btnTorch = new Button("Torch");
    btnTorch.addActionListener(this);
    mHomeForm.addComponent(btnTorch);

    mExitCommand = new Command("Exit");
    mHomeForm.addCommand(mExitCommand);
    mHomeForm.addCommandListener(this); // Use setCommandListener() with LWUIT 1.3 or earlier.
  }