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 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 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 void actionPerformed(ActionEvent ae) {
   if (ae.getSource() == btnSurveysFrm) {
     frmSurveys.setTransitionInAnimator(Transition3D.createCube(300, false));
     frmSurveys.setTransitionOutAnimator(Transition3D.createCube(300, true));
     frmSurveys.show();
   } else if (ae.getSource() == btnChallengesFrm) {
     frmChallenges.show();
   } else if (ae.getSource() == btnCalendarFrm) {
     frmCalendar.show();
   } else if (ae.getSource() == btnContactsFrm) {
     frmContacts.show();
   } else if (ae.getSource() == btnToDoFrm) {
     frmToDoList.show();
   } else if (ae.getSource() == btnTorch) {
     frmTorch.show();
   } else if (ae.getSource() == btnResourceFrm) {
     frmResources.setTransitionInAnimator(Transition3D.createCube(300, false));
     frmResources.setTransitionOutAnimator(Transition3D.createCube(300, true));
     frmResources.show();
   } else if (ae.getSource() == mCubeButton) {
     frmMessages.setTransitionInAnimator(Transition3D.createCube(300, false));
     frmMessages.setTransitionOutAnimator(Transition3D.createCube(300, true));
     frmMessages.show();
   } else if (ae.getSource() == btnSupportFrm) {
     frmSupportMe.setTransitionInAnimator(Transition3D.createCube(300, false));
     frmSupportMe.setTransitionOutAnimator(Transition3D.createCube(300, true));
     frmSupportMe.show();
   } else if (ae.getSource() == btnAboutUs) {
     frmAboutUs.setTransitionInAnimator(Transition3D.createCube(300, false));
     frmAboutUs.setTransitionOutAnimator(Transition3D.createCube(300, true));
     frmAboutUs.show();
   } else if (ae.getSource() == btnAboutYou) {
     frmAboutYou.setTransitionInAnimator(Transition3D.createCube(300, false));
     frmAboutYou.setTransitionOutAnimator(Transition3D.createCube(300, true));
     frmAboutYou.show();
   } else if (ae.getSource() == mFilesButton) {
     mAwayForm.setTransitionInAnimator(Transition3D.createCube(300, false));
     mAwayForm.setTransitionOutAnimator(Transition3D.createCube(300, true));
     mAwayForm.show();
   } else if (ae.getSource() == mRotateButton) {
     mAwayForm.setTransitionInAnimator(Transition3D.createRotation(300, true));
     mAwayForm.setTransitionOutAnimator(Transition3D.createRotation(300, false));
     mAwayForm.show();
   } else if (ae.getSource() == mBackCommand) {
     mHomeForm.show();
   } else if (ae.getCommand() == mExitCommand) {
     notifyDestroyed();
   }
 }
  public Form getChallenges() {
    Form f = new Form("Top Challenges");

    if (frmChallenges == null) {
      f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

      class Node {
        Object[] children;
        String value;

        public Node(String value, Object[] children) {
          this.children = children;
          this.value = value;
        }

        public String toString() {
          return value;
        }
      }
      TreeModel model =
          new TreeModel() {
            Node[] sillyTree = {
              new Node(
                  "Energy Banner: 23 completed: 77 Rewards available",
                  new Node[] {
                    new Node(
                        "CHALLENGE: Get together a minimum of 5 friends or family, create a Banner with energy-saving awareness message, display in your community",
                        new Node[] {}),
                    new Node("REWARD: R15 Airtime (only 77 Rewards remaining)", new Node[] {}),
                    new Node(
                        "TO WIN: Send in a photo of you and your friends holding the banner in your community",
                        new Node[] {}),
                    new Node("CLOSES: 21 June 2013", new Node[] {}),
                  }),
              new Node("Well Watch", new Node[] {new Node("A", new Node[] {})}),
              new Node(
                  "Hear Me, My Friend",
                  new Node[] {
                    new Node("A", new Node[] {}),
                  }),
            };

            public Vector getChildren(Object parent) {
              Node n = (Node) parent;
              Object[] nodes;
              if (parent == null) {
                nodes = sillyTree;
              } else {
                nodes = n.children;
              }
              Vector v = new Vector();
              for (int iter = 0; iter < nodes.length; iter++) {
                v.addElement(nodes[iter]);
              }
              return v;
            }

            public boolean isLeaf(Object node) {
              Node n = (Node) node;
              return n.children == null || n.children.length == 0;
            }
          };

      f.setLayout(new BorderLayout());
      f.addComponent(BorderLayout.CENTER, new Tree(model));

      /*
      f.addComponent(area);

      TextArea big = new TextArea("Keep your community clean and win lots of STUFF");
      big.setGrowByContent(true);
      big.setEditable(false);
      f.addComponent(big);


      List list = new List();
        list.addItem("Street Clean Up");
        list.addItem("Drinking Water Clean-Up");
        list.addItem("Deadland Tidy");
        list.addItem("Tree Rescue");
        f.addComponent(list);

      f.addComponent(new Tree(list));
       */

      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;
  }