Пример #1
0
 @Override
 public void mouseClicked(MouseEvent me) {
   // forward to standard listeners
   for (MouseListener ml : mouseListeners) {
     ml.mouseClicked(me);
   }
 }
Пример #2
0
  public boolean dispatchKeyEvent(KeyEvent e) {
    if (e.getID() == KeyEvent.KEY_PRESSED) {
      pressed.add(e.getKeyCode());
      MouseListener mlis;

      if ((mlis = mListeners.get(e.getKeyCode())) != null) {
        mlis.mouseClicked(null);
      }
      if (buttons.containsKey(e.getKeyCode())) {
        ArrayList<JButton> list = buttons.get(e.getKeyCode());
        if (bid.containsKey(e.getKeyCode())) {
          for (int i = 0; i < list.size(); ++i) {
            int k = isPressed(KeyEvent.VK_SHIFT) ? -1 : 1;
            int a = (bid.get(e.getKeyCode()) + k + list.size()) % list.size();
            bid.put(e.getKeyCode(), a);
            if (list.get(a).isVisible()) {
              list.get(a).doClick();
              break;
            }
          }
        } else {
          for (JButton button : buttons.get(e.getKeyCode())) {
            if (button != null && button.isVisible()) {
              button.doClick();
              break;
            }
          }
        }
      }
    }
    if (e.getID() == KeyEvent.KEY_RELEASED) {
      pressed.remove(e.getKeyCode());
    }
    return false;
  }
Пример #3
0
  /**
   * If the user double clicks on any part of this FigNode, pass it down to one of the internal
   * Figs. This allows the user to initiate direct text editing.
   *
   * <p>{@inheritDoc}
   */
  @Override
  public void mouseClicked(MouseEvent me) {
    if (!readyToEdit) {
      Object owner = getOwner();
      if (Model.getFacade().isAModelElement(owner)
          && !Model.getModelManagementHelper().isReadOnly(owner)) {
        readyToEdit = true;
      } else {

        return;
      }
    }
    if (me.isConsumed()) {
      return;
    }
    if (me.getClickCount() >= 2
        && !(me.isPopupTrigger() || me.getModifiers() == InputEvent.BUTTON3_MASK)) {
      if (getOwner() == null) {
        return;
      }
      Fig f = hitFig(new Rectangle(me.getX() - 2, me.getY() - 2, 4, 4));
      if (f instanceof MouseListener) {
        ((MouseListener) f).mouseClicked(me);
      }
    }
    me.consume();
  }
 private void dispatchMouseEvent(MouseEvent event) {
   MouseListener[] mouseListeners = event.getComponent().getMouseListeners();
   for (MouseListener listener : mouseListeners) {
     // skip all ToolTipManager's related listeners
     if (!listener.getClass().getName().startsWith("javax.swing.ToolTipManager")) {
       switch (event.getID()) {
         case MouseEvent.MOUSE_PRESSED:
           listener.mousePressed(event);
           break;
         case MouseEvent.MOUSE_RELEASED:
           listener.mouseReleased(event);
           break;
         case MouseEvent.MOUSE_CLICKED:
           listener.mouseClicked(event);
           break;
         case MouseEvent.MOUSE_EXITED:
           listener.mouseExited(event);
           break;
         case MouseEvent.MOUSE_ENTERED:
           listener.mouseEntered(event);
           break;
         default:
           throw new AssertionError();
       }
     }
   }
 }
 /**
  * If the user double clicks on anu part of this FigNode, pass it down to one of the internal
  * Figs. This allows the user to initiate direct text editing.
  *
  * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
  */
 public void mouseClicked(MouseEvent me) {
   if (me.isConsumed()) return;
   if (me.getClickCount() >= 2) {
     Fig f = hitFig(new Rectangle(me.getX() - 2, me.getY() - 2, 4, 4));
     if (f instanceof MouseListener && canEdit(f)) ((MouseListener) f).mouseClicked(me);
   }
   me.consume();
 }
Пример #6
0
 @Override
 public void mouseClicked(MouseEvent e) {
   if (mouseEnabled || e instanceof BotEvent) {
     for (MouseListener l : defaultMouseListeners) {
       l.mouseClicked(e);
     }
     mouseOnCanvas = true;
   }
 }
Пример #7
0
 @Override
 public void mouseClicked(MouseEvent e) {
   MouseEvent te = transformMouseEvent(e);
   MouseListener[] mouseListenersBuf =
       _mouseListeners.toArray(new MouseListener[_mouseListeners.size()]);
   for (MouseListener mouseListener : mouseListenersBuf) {
     mouseListener.mouseClicked(te);
   }
 }
 public void mouseClicked(MouseEvent e) {
   MouseEvent transfer =
       new MouseEvent(
           this,
           e.getID(),
           e.getWhen(),
           e.getModifiers(),
           e.getX(),
           e.getY(),
           e.getXOnScreen(),
           e.getYOnScreen(),
           e.getClickCount(),
           e.isPopupTrigger(),
           e.getButton());
   for (MouseListener l : getMouseListeners()) {
     l.mouseClicked(transfer);
   }
 }
Пример #9
0
 public void mouseReleased(MouseListener listener, MouseEvent e) {
   Point p = e.getPoint();
   boolean generateClick = false;
   if (!m_clickConsumed) {
     if (!m_pressedLocation.equals(p)) {
       Component c = e.getComponent();
       if (c == null || c.getBounds().contains(p)) {
         if (c instanceof JTree || c instanceof JTable) {
           // only allow 8 pixel in order not to interfere with drag and drop
           if (Math.max(Math.abs(m_pressedLocation.x - p.x), Math.abs(m_pressedLocation.y - p.y))
               <= 8) {
             generateClick = true;
           }
         } else {
           generateClick = true;
         }
       }
     }
   }
   if (generateClick) {
     listener.mouseClicked(e);
   }
 }
Пример #10
0
 public void mouseClicked(LayerEvent e) {
   if (_filter.accept(e)) {
     _ml.mouseClicked(e);
   }
 }
 @Override
 public void mouseClicked(MouseEvent e) {
   mouseDelegate.mouseClicked(e);
 }
Пример #12
0
 public void mouseDragged(MouseEvent e) {
   mouseListener.mouseClicked(e);
   mouseMoved(e);
 }
Пример #13
0
  public void mouseClicked(MouseEvent e) {

    for (MouseListener ml : mouseListeners) {
      ml.mouseClicked(translate(e));
    }
  }
 /**
  * Handles the mouseClicked event by invoking the mouseClicked methods on listener-a and
  * listener-b.
  *
  * @param e the mouse event
  */
 public void mouseClicked(MouseEvent e) {
   ((MouseListener) a).mouseClicked(e);
   ((MouseListener) b).mouseClicked(e);
 }