Java Code Examples for java.awt.event.MouseListener#mousePressed()

The following examples show how to use java.awt.event.MouseListener#mousePressed() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IdeGlassPaneImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void fireMouseEvent(final MouseListener listener, final MouseEvent event) {
  switch (event.getID()) {
    case MouseEvent.MOUSE_PRESSED:
      listener.mousePressed(event);
      break;
    case MouseEvent.MOUSE_RELEASED:
      listener.mouseReleased(event);
      break;
    case MouseEvent.MOUSE_ENTERED:
      listener.mouseEntered(event);
      break;
    case MouseEvent.MOUSE_EXITED:
      listener.mouseExited(event);
      break;
    case MouseEvent.MOUSE_CLICKED:
      listener.mouseClicked(event);
      break;
  }
}
 
Example 2
Source File: SwingWrapperClickConsumer.java    From CrossMobile with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void mousePressed(MouseEvent e) {
    SwingGraphicsBridge.component.mousePressed(e);
    if (active)
        for (MouseListener mouse1 : mouse)
            mouse1.mousePressed(e);
}
 
Example 3
Source File: RocLinePanel.java    From rtg-tools with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public void mousePressed(MouseEvent e) {
  if (isRetained(e)) {
    for (final MouseListener u : mListeners) {
      u.mousePressed(e);
    }
  }
}
 
Example 4
Source File: Awt.java    From pdfxtk with Apache License 2.0 5 votes vote down vote up
public void handle(AsyncInvocation.Invocation i, AsyncInvocation.Result result) {
  if(i.object instanceof MouseListener) {
    MouseListener ml = (MouseListener)i.object;
    if(     check(i.method, "mouseClicked",  MouseEvent.class))	ml.mouseClicked( (MouseEvent)i.args[0]);
    else if(check(i.method, "mouseEntered",  MouseEvent.class))	ml.mouseEntered( (MouseEvent)i.args[0]);
    else if(check(i.method, "mouseExited",   MouseEvent.class))	ml.mouseExited(  (MouseEvent)i.args[0]);
    else if(check(i.method, "mousePressed",  MouseEvent.class))	ml.mousePressed( (MouseEvent)i.args[0]);
    else if(check(i.method, "mouseReleased", MouseEvent.class)) ml.mouseReleased((MouseEvent)i.args[0]);
    else throw new IllegalArgumentException("Unknown MouseListener method:" + i.method);
    result.set(null);
  } 
}