Ejemplo n.º 1
0
 public void removeUserAction(UserAction action) {
   Vector userEvents = action.getUserEvents();
   for (Iterator iterator = userEvents.iterator(); iterator.hasNext(); ) {
     UserEvent userEvent = (UserEvent) iterator.next();
     if (action.mustStartAndStop()) {
       if (userEvent.isMouseActivated()) {
         if (userEvent.isMouseWheelEvent()) {
           mouseWheelEvents.removeElement(userEvent);
         } else {
           mousePressedEvents.removeElement(userEvent);
           mouseReleasedEvents.removeElement(userEvent);
         }
       } else {
         keyPressedEvents.removeElement(userEvent);
         keyReleasedEvents.removeElement(userEvent);
       }
     } else {
       if (userEvent.isMouseActivated()) {
         if (userEvent.isMouseWheelEvent()) {
           mouseWheelEvents.removeElement(userEvent);
         } else {
           mousePressedEvents.removeElement(userEvent);
         }
       } else {
         keyPressedEvents.removeElement(userEvent);
       }
     }
   }
 }
Ejemplo n.º 2
0
  /** Starts the {@link UserAction} and updates the action label. */
  private void startAction(final UserAction action) {
    if (action.canStart()) {
      // System.out.println("Starting: " + action.getActionName());
      // show the action name
      String txt = "Action: " + action.getActionName() + " ";
      tool.setOutputText(txt);

      // run this later to let the above output be painted to the GUI first
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              // call actionPerformed() instead of startAction() to fire the events
              action.actionPerformed(new ActionEvent(action, 0, action.getActionName()));

              // clear the output after 1 second
              tool.clearOutputText(1000);
            }
          });
    }
  }
Ejemplo n.º 3
0
 /** Stops the {@link UserAction} and clears the action label. */
 private void stopAction(UserAction action) {
   // System.out.println("Stopping: " + action.getActionName());
   action.stopAction();
 }