/**
  * Triggered when the link is pressed and then it requests the link (or goes to an anchor within
  * the page)
  */
 public void actionPerformed(ActionEvent evt) {
   if ((!HTMLComponent.PROCESS_HTML_MP1_ONLY)
       && (isMap)
       && (evt.getX()
           != -1)) { // process mp1 is checked in assigning ismap as well, but this check here
                     // should obfuscate out this method override
     processLink(
         htmlC, link + "?" + (evt.getX() - getAbsoluteX()) + "," + (evt.getY() - getAbsoluteY()));
   } else {
     processLink(htmlC, link);
   }
 }
 public void actionPerformed(ActionEvent evt) {
   Command cmd = evt.getCommand();
   switch (cmd.getId()) {
     case EXIT_COMMAND:
       exitMIDlet();
       break;
     case NEXT_COMMAND:
       if (pageFlowIndex < (PAGES.length - 3)) {
         pageFlowIndex += 1;
         previous = PAGES[pageFlowIndex].run(new Command[] {backCommand, nextCommand}, this);
       } else if (pageFlowIndex == (PAGES.length - 3)) {
         pageFlowIndex += 1;
         previous =
             PAGES[pageFlowIndex].run(
                 new Command[] {backCommand, settingsCommand, sendCommand}, this);
       }
       break;
     case BACK_COMMAND:
       if (Display.getInstance().getCurrent().getTitle().equals("Settings")) {
         previous.show();
       } else if (pageFlowIndex > 1) {
         pageFlowIndex -= 1;
         previous = PAGES[pageFlowIndex].run(new Command[] {backCommand, nextCommand}, this);
       } else if (pageFlowIndex == 1) {
         pageFlowIndex -= 1;
         previous = PAGES[pageFlowIndex].run(new Command[] {exitCommand, settingsCommand}, this);
       }
       break;
     case SETTINGS_COMMAND:
       showSettingsPage();
       break;
     case SAVE_COMMAND:
       break;
   }
 }
示例#3
0
  public void actionPerformed(ActionEvent e) {
    Command cmd = e.getCommand();
    if (cmd != null) {
      // Free some memory
      freeThumbnails();
    }

    /* Handle different commands */
    if (cmd == aboutCommand) {
      midlet.showAboutView();
    } else if (cmd == helpCommand) {
      midlet.showHelpView();
    } else if (cmd == guidesCommand) {
      midlet.showGuideView();
    } else if (cmd == mapCommand) {
      GeoCoordinate loc = Self.getCurrentPosition();
      if (loc != null) {
        midlet.showMapView(guide, null, loc.getLatitude(), loc.getLongitude(), "My location");
      } else {
        Util.showAlert("Location error", "Could not get your location.");
      }
    } else if (cmd == selectCommand) {
      attractionList.actionPerformed(new ActionEvent(attractionList));
    } else if (cmd == backCommand) {
      Display.getInstance().exitApplication();
    }
  }
示例#4
0
 public void actionPerformed(ActionEvent evt) {
   int newSelected = ((List) evt.getSource()).getSelectedIndex();
   list.setListCellRenderer(renderers[newSelected]);
   list.requestFocus();
   list.getParent().revalidate();
 }
 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();
   }
 }