Пример #1
0
  /** This method handles all of the mouse events first */
  public boolean handleAnyMouseEvent(ShrimpMouseEvent e) {
    if (tool == null) {
      return false;
    }
    // tool.clearOutputText();

    try {
      selectorBean = (SelectorBean) tool.getBean(ShrimpTool.SELECTOR_BEAN);
    } catch (BeanNotFoundException bnfe) {
      bnfe.printStackTrace();
      return false;
    }

    // in case the system didn't throw all the events, this clears the modifiers for us
    if (e.getModifiers() == 0) {
      isCtrlPressed = false;
      isShiftPressed = false;
      isAltPressed = false;
    }

    // set the current target
    Object targetObj = e.getTarget();
    if (targetObj != null) {
      selectorBean.setSelected(SelectorBeanConstants.TARGET_OBJECT, targetObj);
    } else {
      selectorBean.clearSelected(SelectorBeanConstants.TARGET_OBJECT);
    }

    // set the current mouse coordinates
    Vector coords = new Vector();
    coords.addElement(new Double(e.getX()));
    coords.addElement(new Double(e.getY()));
    selectorBean.setSelected(SelectorBeanConstants.MOUSE_COORDINATES, coords);

    return true;
  }