本文整理汇总了Java中java.awt.event.MouseMotionListener.mouseMoved方法的典型用法代码示例。如果您正苦于以下问题:Java MouseMotionListener.mouseMoved方法的具体用法?Java MouseMotionListener.mouseMoved怎么用?Java MouseMotionListener.mouseMoved使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.MouseMotionListener
的用法示例。
在下文中一共展示了MouseMotionListener.mouseMoved方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: notifyMouseMotionListeners
import java.awt.event.MouseMotionListener; //导入方法依赖的package包/类
public void notifyMouseMotionListeners(final MouseEvent e) {
SwingWorker worker = new SwingWorker<String, Object>() {
@Override
public String doInBackground() {
if (mouseMotionListeners != null) {
e.setSource(this);
ListIterator<MouseMotionListener> iter = mouseMotionListeners.listIterator();
while (iter.hasNext()) {
MouseMotionListener listener = iter.next();
switch (e.getID()) {
case MouseEvent.MOUSE_MOVED:
listener.mouseMoved(e);
break;
case MouseEvent.MOUSE_DRAGGED:
listener.mouseDragged(e);
break;
default:
break;
}
}
iter = null;
}
return null;
}
};
worker.execute();
try {
worker.get();
} catch (Exception ie) {
}
}
示例2: notifyMouseMotionListeners
import java.awt.event.MouseMotionListener; //导入方法依赖的package包/类
public void notifyMouseMotionListeners(MouseEvent e) {
if (mouseMotionListeners != null) {
e.setSource(this);
ListIterator<MouseMotionListener> iter = mouseMotionListeners.listIterator();
while (iter.hasNext()) {
MouseMotionListener listener = iter.next();
switch (e.getID()) {
case MouseEvent.MOUSE_MOVED:
listener.mouseMoved(e);
break;
case MouseEvent.MOUSE_DRAGGED:
listener.mouseDragged(e);
break;
default:
break;
}
}
iter = null;
}
}
示例3: deliverMouseMotionEvent
import java.awt.event.MouseMotionListener; //导入方法依赖的package包/类
/**
* Deliver the given mouse motion event to the window.
*
* @param event The mouse motion event to deliver.
*/
private void deliverMouseMotionEvent(MouseEvent event) {
if (mouseMotionListeners == null) {
return;
}
for (MouseMotionListener listener : mouseMotionListeners) {
switch (event.getID()) {
case MouseEvent.MOUSE_MOVED:
listener.mouseMoved(event);
break;
case MouseEvent.MOUSE_DRAGGED:
listener.mouseDragged(event);
break;
}
}
}
示例4: dispatchTo
import java.awt.event.MouseMotionListener; //导入方法依赖的package包/类
/**
* Calls appropriate method on the listener based on this events ID.
*
* @param listener the target for dispatch.
*/
public void dispatchTo(final Object listener) {
final MouseMotionListener mouseMotionListener = (MouseMotionListener) listener;
switch (getID()) {
case MouseEvent.MOUSE_DRAGGED:
mouseMotionListener.mouseDragged(this);
break;
case MouseEvent.MOUSE_MOVED:
mouseMotionListener.mouseMoved(this);
break;
default:
throw new RuntimeException("PMouseMotionEvent with bad ID");
}
}
示例5: fireMouseMotion
import java.awt.event.MouseMotionListener; //导入方法依赖的package包/类
private static void fireMouseMotion(MouseMotionListener listener, final MouseEvent event) {
switch (event.getID()) {
case MouseEvent.MOUSE_DRAGGED:
listener.mouseDragged(event);
case MouseEvent.MOUSE_MOVED:
listener.mouseMoved(event);
}
}
示例6: fireMouseMoveEvent
import java.awt.event.MouseMotionListener; //导入方法依赖的package包/类
private void fireMouseMoveEvent(MouseEvent e)
{
for (MouseMotionListener l : mMouseMotionListeners)
if (e.getID() == MouseEvent.MOUSE_MOVED)
l.mouseMoved(e);
else if (e.getID() == MouseEvent.MOUSE_DRAGGED)
l.mouseDragged(e);
}
示例7: mouseMoved
import java.awt.event.MouseMotionListener; //导入方法依赖的package包/类
@Override
public void mouseMoved(MouseEvent evt) {
if(!canDispatch(evt)) {return;}
MouseEvent e = new MouseEvent(evt.getComponent(), evt.getID(), evt.getWhen(), evt.getModifiers(), evt.getX(), evt.getY(), evt.getClickCount(), false, evt.getButton());
MouseMotionListener[] listeners = getListenersAndAdaptEvent(e, MouseMotionListener.class);
for(MouseMotionListener l : listeners) {l.mouseMoved(e);}
}
示例8: processMouseMotionEventImpl
import java.awt.event.MouseMotionListener; //导入方法依赖的package包/类
private void processMouseMotionEventImpl(MouseEvent e, Collection<MouseMotionListener> c) {
for (MouseMotionListener listener : c) {
switch (e.getID()) {
case MouseEvent.MOUSE_DRAGGED:
listener.mouseDragged(e);
break;
case MouseEvent.MOUSE_MOVED:
listener.mouseMoved(e);
break;
}
}
}
示例9: fireMouseMoveEvent
import java.awt.event.MouseMotionListener; //导入方法依赖的package包/类
private void fireMouseMoveEvent(MouseEvent e) {
for (MouseMotionListener l : mMouseMotionListeners) {
if (e.getID() == MouseEvent.MOUSE_MOVED) {
l.mouseMoved(e);
} else if (e.getID() == MouseEvent.MOUSE_DRAGGED) {
l.mouseDragged(e);
}
}
}
示例10: mouseMoved
import java.awt.event.MouseMotionListener; //导入方法依赖的package包/类
@Override
public void mouseMoved(MouseEvent e) {
MouseMotionListener[] listeners = getListenerAncestor(e, MouseMotionListener.class);
if(listeners!=null) for(MouseMotionListener l : listeners) l.mouseMoved(e);
}