java.awt.event.MouseMotionListener.mouseDragged()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(92)

本文整理了Java中java.awt.event.MouseMotionListener.mouseDragged()方法的一些代码示例,展示了MouseMotionListener.mouseDragged()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MouseMotionListener.mouseDragged()方法的具体详情如下:
包路径:java.awt.event.MouseMotionListener
类名称:MouseMotionListener
方法名:mouseDragged

MouseMotionListener.mouseDragged介绍

[英]Invoked when a mouse button is pressed on a component and then dragged. MOUSE_DRAGGED events will continue to be delivered to the component where the drag originated until the mouse button is released (regardless of whether the mouse position is within the bounds of the component).

Due to platform-dependent Drag&Drop implementations, MOUSE_DRAGGED events may not be delivered during a native Drag&Drop operation.
[中]当在组件上按下鼠标按钮并拖动时调用。MOUSE_DRAGGED事件将继续传递到产生拖动的组件,直到释放鼠标按钮(无论鼠标位置是否在组件的边界内)。
由于依赖于平台的拖放实现,MOUSE_DRAGGED事件可能不会在本机拖放操作期间传递。

代码示例

代码示例来源:origin: com.jidesoft/jide-oss

public void mouseDragged(MouseEvent e) {
  if (_listener != null) {
    _listener.mouseDragged(e);
  }
}

代码示例来源:origin: girtel/Net2Plan

@Override
public void mouseDragged(MouseEvent e) {
  if (plugin instanceof MouseMotionListener)
    ((MouseMotionListener) plugin).mouseDragged(e);
}

代码示例来源:origin: xyz.cofe/docking-frames-core

public void mouseDragged( MouseEvent e ) {
  for( MouseMotionListener m : mouseMotionListeners.toArray( new MouseMotionListener[ mouseMotionListeners.size() ] ))
    m.mouseDragged( e );
}

代码示例来源:origin: sc.fiji/fiji-lib

@Override
public final void mouseDragged(MouseEvent e) {
  if (isThisTool())
    listener.mouseDragged(e);
}

代码示例来源:origin: eu.mihosoft.vrl/vrl

@Override
public void mouseDragged(MouseEvent e) {
  location = e.getLocationOnScreen();
  resizeTarget();
  
  for (MouseMotionListener eL : externalListeners) {
    eL.mouseDragged(e);
  }
}

代码示例来源:origin: jzy3d/jzy3d-api

@Override
public void mouseDragged(com.jogamp.newt.event.MouseEvent me) {
  if (mouseMotionListener != null) {
    mouseMotionListener.mouseDragged(convertEvent(me, MouseEvent.MOUSE_DRAGGED));
  }
}

代码示例来源:origin: sc.fiji/fiji-lib

@Override
public final void mouseDragged(MouseEvent e) {
  if (!e.isConsumed())
    listener.mouseDragged(e);
}

代码示例来源:origin: sdedit/sdedit

public void mouseDragged(MouseEvent e) {
  for (MouseMotionListener ml : mouseMotionListeners) {
    ml.mouseDragged(translate(e));
  }
}

代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf

public void mouseDragged(MouseEvent e) {
  for (MouseMotionListener listener : eventListenerList.getListeners(MouseMotionListener.class))
    listener.mouseDragged(e);
}

代码示例来源:origin: stackoverflow.com

protected void processMouseMotionEvent(MouseEvent e) {
  MouseMotionListener listener = mouseMotionListener;
  if (listener != null) {
    int id = e.getID();
    switch(id) {
     case MouseEvent.MOUSE_MOVED:
       listener.mouseMoved(e);
       break;
     case MouseEvent.MOUSE_DRAGGED:
       listener.mouseDragged(e);
       break;
    }
  }
}

代码示例来源:origin: gurkenlabs/litiengine

@Override
public void mouseDragged(final MouseEvent e) {
 this.setLocation(e);
 final MouseEvent wrappedEvent = this.createEvent(e);
 this.mouseMotionListeners.forEach(listener -> listener.mouseDragged(wrappedEvent));
 for (final Consumer<MouseEvent> cons : this.mouseDraggedConsumer) {
  cons.accept(wrappedEvent);
 }
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@Override
public void mouseDragged(MouseEvent e) {
  if (e.getSource() instanceof Component) {
    e = SwingUtilities.convertMouseEvent((Component) e.getSource(), e, ModelGrid.this);
    for (MouseMotionListener l : ModelGrid.this.getMouseMotionListeners()) {
      l.mouseDragged(e);
    }
  }
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@Override
public void mouseDragged(MouseEvent e) {
  MouseMotionListener[] mls = getMouseMotionListeners();
  if (mls != null && e.getSource() instanceof Component) {
    e = SwingUtilities.convertMouseEvent((Component) e.getSource(), e, ModelComponentDecorator.this);
    for (MouseMotionListener mml : mls) {
      mml.mouseDragged(e);
    }
  }
}

代码示例来源:origin: com.jtattoo/JTattoo

public void mouseDragged(MouseEvent e) {
  if (scrollableTabLayoutEnabled()) {
    MouseMotionListener[] mml = tabPane.getMouseMotionListeners();
    for (int i = 0; i < mml.length; i++) {
      mml[i].mouseDragged(e);
    }
  }
}

代码示例来源:origin: net.sf.jung/jung-visualization

public void mouseDragged(MouseEvent e) {
  checkMouseMotionListeners();
  for(int i=0; i<mouseMotionListeners.length; i++) {
    mouseMotionListeners[i].mouseDragged(e);
    if(e.isConsumed()) break;
  }
}

代码示例来源:origin: jrtom/jung

public void mouseDragged(MouseEvent e) {
 checkMouseMotionListeners();
 for (int i = 0; i < mouseMotionListeners.length; i++) {
  mouseMotionListeners[i].mouseDragged(e);
  if (e.isConsumed()) {
   break;
  }
 }
}

代码示例来源:origin: edu.stanford.protege/org.coode.owlviz

mouseMotionListeners[i].mouseDragged(e);

代码示例来源:origin: com.googlecode.blaisemath/blaise-graphics

@Override
public void mouseDragged(MouseEvent e) {
  if (mouseGraphic != null) {
    GMouseEvent gme = graphicMouseEvent(e);
    gme.setGraphicSource(mouseGraphic);
    for (MouseMotionListener l : mouseGraphic.getMouseMotionListeners()) {
      l.mouseDragged(gme);
      if (gme.isConsumed()) {
        return;
      }
    }
  }
}

代码示例来源:origin: mikaelhg/openblocks

@Override
public void mouseDragged(MouseEvent e) {
  if (widget.getParent() != null && widget.getParent() instanceof MouseMotionListener) {
    ((MouseMotionListener) widget.getParent()).mouseDragged(SwingUtilities.convertMouseEvent(widget, e, widget.getParent()));
  }
}

代码示例来源:origin: sarahtattersall/PIPE

/**
 * Translates the event to a zoomed event point
 * @param e mouse event
 * @param l component 
 */
@Override
protected void processMouseMotionEvent(MouseEvent e, JLayer<? extends JComponent> l) {
  MouseEvent localEvent = translateToLayerCoordinates(e, l);
  if (clickNotOutOfBounds(localEvent, l)) {
    Component component = getComponentClickedOn(l, localEvent);
    if (localEvent.getID() == MouseEvent.MOUSE_MOVED) {
      for (MouseMotionListener listener : component.getListeners(MouseMotionListener.class)) {
        listener.mouseMoved(getNewMouseClickEvent(component, localEvent));
      }
    } else if (localEvent.getID() == MouseEvent.MOUSE_DRAGGED) {
      for (MouseMotionListener listener : component.getListeners(MouseMotionListener.class)) {
        listener.mouseDragged(getNewMouseClickEvent(component, localEvent));
      }
    }
  }
  e.consume();
}

相关文章