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


Java MouseWheelListener.mouseWheelMoved方法代碼示例

本文整理匯總了Java中java.awt.event.MouseWheelListener.mouseWheelMoved方法的典型用法代碼示例。如果您正苦於以下問題:Java MouseWheelListener.mouseWheelMoved方法的具體用法?Java MouseWheelListener.mouseWheelMoved怎麽用?Java MouseWheelListener.mouseWheelMoved使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.event.MouseWheelListener的用法示例。


在下文中一共展示了MouseWheelListener.mouseWheelMoved方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mouseWheelMoved

import java.awt.event.MouseWheelListener; //導入方法依賴的package包/類
@Override
public void mouseWheelMoved(MouseWheelEvent originalEvent) {
	MouseWheelEvent event = new MouseWheelEvent( originalEvent.getComponent(),
			                                     originalEvent.getID(),
			                                     originalEvent.getWhen(),
			                                     originalEvent.getModifiers(),
			                                     originalEvent.getX(),
			                                     originalEvent.getY(),
			                                     originalEvent.getXOnScreen(),
			                                     originalEvent.getYOnScreen(),
			                                     originalEvent.getClickCount(),
			                                     originalEvent.isPopupTrigger(),
			                                     originalEvent.getScrollType(),
			                                     scrollAmount,
			                                     originalEvent.getWheelRotation());
	for (MouseWheelListener listener : originalListeners) listener.mouseWheelMoved(event);
}
 
開發者ID:chms,項目名稱:jdotxt,代碼行數:18,代碼來源:JdotxtGUI.java

示例2: mouseWheelMoved

import java.awt.event.MouseWheelListener; //導入方法依賴的package包/類
/**
 * Called when the mouse wheel is moved.
 * If CTRL key is down, modify current zoom ratio accordingly, otherwise
 * forward the wheel event to proper container (JScrollPane usually).
 *
 * @param e the mouse wheel event
 */
@Override
public void mouseWheelMoved (MouseWheelEvent e)
{
    // CTRL is down?
    if (e.isControlDown()) {
        double ratio = zoom.getRatio();

        if (e.getWheelRotation() > 0) {
            ratio /= factor;
        } else {
            ratio *= factor;
        }

        zoom.setRatio(ratio);
    } else {
        // Forward event to some container of the component?
        Container container = component.getParent();

        while (container != null) {
            if (container instanceof JComponent) {
                JComponent comp = (JComponent) container;
                MouseWheelListener[] listeners = comp.getMouseWheelListeners();

                if (listeners.length > 0) {
                    for (MouseWheelListener listener : listeners) {
                        listener.mouseWheelMoved(e);
                    }

                    return;
                }
            }

            container = container.getParent();
        }
    }
}
 
開發者ID:Audiveris,項目名稱:audiveris,代碼行數:44,代碼來源:Rubber.java

示例3: dispatchTo

import java.awt.event.MouseWheelListener; //導入方法依賴的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 MouseWheelListener mouseWheelListener = (MouseWheelListener) listener;
    switch (getID()) {
        case MouseEvent.MOUSE_WHEEL:
            mouseWheelListener.mouseWheelMoved(this);
            break;
        default:
            throw new RuntimeException("PMouseWheelEvent with bad ID");
    }
}
 
開發者ID:mleoking,項目名稱:PhET,代碼行數:16,代碼來源:PSwingMouseWheelEvent.java

示例4: deliverEvent

import java.awt.event.MouseWheelListener; //導入方法依賴的package包/類
/**
 * Deliver the given mouse wheel event to the window.
 *
 * @param event The mouse wheel event to deliver.
 */
protected void deliverEvent(MouseWheelEvent event) {
    if (mouseWheelListeners == null) {
        return;
    }

    for (MouseWheelListener listener : mouseWheelListeners) {
        listener.mouseWheelMoved(event);
    }
}
 
開發者ID:josmas,項目名稱:openwonderland,代碼行數:15,代碼來源:Window2D.java

示例5: mouseWheelMoved

import java.awt.event.MouseWheelListener; //導入方法依賴的package包/類
@Override
public void mouseWheelMoved(MouseWheelEvent evt) {
    if(!canDispatch(evt)) {return;}
    MouseWheelEvent e = new MouseWheelEvent(evt.getComponent(), evt.getID(), evt.getWhen(), evt.getModifiers(), evt.getX(), evt.getY(), evt.getClickCount(), false, evt.getScrollType(), evt.getScrollAmount(), evt.getWheelRotation());
    MouseWheelListener[] listeners = getListenersAndAdaptEvent(e, MouseWheelListener.class);
    for(MouseWheelListener l : listeners) {l.mouseWheelMoved(e);}
}
 
開發者ID:Sharcoux,項目名稱:MathEOS,代碼行數:8,代碼來源:GlobalDispatcher.java

示例6: processMouseWheelEventImpl

import java.awt.event.MouseWheelListener; //導入方法依賴的package包/類
private void processMouseWheelEventImpl(MouseWheelEvent e, Collection<MouseWheelListener> c) {
    for (MouseWheelListener listener : c) {
        switch (e.getID()) {
            case MouseEvent.MOUSE_WHEEL:
                listener.mouseWheelMoved(e);
                break;
        }
    }
}
 
開發者ID:shannah,項目名稱:cn1,代碼行數:10,代碼來源:Component.java

示例7: fireMouseWheelEvent

import java.awt.event.MouseWheelListener; //導入方法依賴的package包/類
private void fireMouseWheelEvent(MouseWheelEvent e) {
    for (MouseWheelListener l : mMouseWheelListeners) {
        if (e.getID() == MouseEvent.MOUSE_WHEEL) {
            l.mouseWheelMoved(e);
        }
    }
}
 
開發者ID:StarMade,項目名稱:SMEdit,代碼行數:8,代碼來源:JGLCanvas.java

示例8: callMouseWheelMovedListeners

import java.awt.event.MouseWheelListener; //導入方法依賴的package包/類
protected void callMouseWheelMovedListeners(MouseWheelEvent event)
  {
      for (MouseWheelListener listener : this.eventListeners.getListeners(MouseWheelListener.class))
      {
          listener.mouseWheelMoved(event);
}
  }
 
開發者ID:vcucek,項目名稱:WildPlot,代碼行數:8,代碼來源:AWTInputHandler.java

示例9: setUI

import java.awt.event.MouseWheelListener; //導入方法依賴的package包/類
@Override
public void setUI(ScrollPaneUI ui) {
  super.setUI(ui);
  updateViewportBorder();
  if (ui instanceof BasicScrollPaneUI) {
    try {
      Field field = BasicScrollPaneUI.class.getDeclaredField("mouseScrollListener");
      field.setAccessible(true);
      Object value = field.get(ui);
      if (value instanceof MouseWheelListener) {
        MouseWheelListener oldListener = (MouseWheelListener)value;
        MouseWheelListener newListener = event -> {
          if (isScrollEvent(event)) {
            Object source = event.getSource();
            if (source instanceof JScrollPane) {
              JScrollPane pane = (JScrollPane)source;
              if (pane.isWheelScrollingEnabled()) {
                JScrollBar bar = event.isShiftDown() ? pane.getHorizontalScrollBar() : pane.getVerticalScrollBar();
                if (bar != null && bar.isVisible()) oldListener.mouseWheelMoved(event);
              }
            }
          }
        };
        field.set(ui, newListener);
        // replace listener if field updated successfully
        removeMouseWheelListener(oldListener);
        addMouseWheelListener(newListener);
      }
    }
    catch (Exception exception) {
      LOG.warn(exception);
    }
  }
}
 
開發者ID:JetBrains,項目名稱:jediterm,代碼行數:35,代碼來源:JBScrollPane.java

示例10: fireMouseWheelEvent

import java.awt.event.MouseWheelListener; //導入方法依賴的package包/類
private void fireMouseWheelEvent(MouseWheelEvent e)
{
	for (MouseWheelListener l : mMouseWheelListeners)
		if (e.getID() == MouseEvent.MOUSE_WHEEL)
			l.mouseWheelMoved(e);
}
 
開發者ID:StarMade,項目名稱:SMEditClassic,代碼行數:7,代碼來源:JGLCanvas.java

示例11: mouseWheelMoved

import java.awt.event.MouseWheelListener; //導入方法依賴的package包/類
public void mouseWheelMoved(MouseWheelEvent e) {
    MouseWheelListener[] listeners = getListenerAncestor(e, MouseWheelListener.class);
    if(listeners!=null) for(MouseWheelListener l : listeners) l.mouseWheelMoved(e);
}
 
開發者ID:Sharcoux,項目名稱:MathEOS,代碼行數:5,代碼來源:DispatchMouseToParent.java


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