當前位置: 首頁>>代碼示例>>Java>>正文


Java MouseMotionListener.mouseMoved方法代碼示例

本文整理匯總了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) {
    }
}
 
開發者ID:josmas,項目名稱:openwonderland,代碼行數:34,代碼來源:HUDFrameHeader2D.java

示例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;
    }
}
 
開發者ID:josmas,項目名稱:openwonderland,代碼行數:22,代碼來源:HUDView2D.java

示例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;
        }
    }
}
 
開發者ID:josmas,項目名稱:openwonderland,代碼行數:22,代碼來源:Window2D.java

示例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");
    }
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:19,代碼來源:PSwingMouseMotionEvent.java

示例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);
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:IdeGlassPaneImpl.java

示例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);
}
 
開發者ID:StarMade,項目名稱:SMEditClassic,代碼行數:9,代碼來源:JGLCanvas.java

示例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);}
}
 
開發者ID:Sharcoux,項目名稱:MathEOS,代碼行數:8,代碼來源:GlobalDispatcher.java

示例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;
        }
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:13,代碼來源:Component.java

示例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);
        }
    }
}
 
開發者ID:StarMade,項目名稱:SMEdit,代碼行數:10,代碼來源:JGLCanvas.java

示例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);
}
 
開發者ID:Sharcoux,項目名稱:MathEOS,代碼行數:6,代碼來源:DispatchMouseToParent.java


注:本文中的java.awt.event.MouseMotionListener.mouseMoved方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。