当前位置: 首页>>代码示例>>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;未经允许,请勿转载。