javax.swing.JComponent.addMouseWheelListener()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(123)

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

JComponent.addMouseWheelListener介绍

暂无

代码示例

代码示例来源:origin: klamonte/jexer

/**
 * Adds the specified mouse wheel listener to receive mouse wheel events
 * from this component. Containers also receive mouse wheel events from
 * sub-components.
 *
 * @param l the mouse wheel listener
 */
public void addMouseWheelListener(MouseWheelListener l) {
  if (frame != null) {
    frame.addMouseWheelListener(l);
  } else {
    component.addMouseWheelListener(l);
  }
}

代码示例来源:origin: it.tidalwave.netbeans/it-tidalwave-netbeans-visual

/*******************************************************************************************************************
 *
 * Creates a new instance of {@code LayeredSceneView}.
 *
 * @param   scene                 the {@link ObjectScene}
 * @param   locationProvider      the provider of {@link Widget} positions
 * @param   backgroundComponent   the component to be rendered in background
 *
 ******************************************************************************************************************/
public LayeredSceneView (final @Nonnull ObjectScene scene,
             final @Nonnull LocationProvider locationProvider,
             final @Nonnull Component backgroundComponent)
 {
  this(scene, locationProvider, new MouseEventForwarder(scene, backgroundComponent));
  add(backgroundComponent, Integer.valueOf(100)); // autoboxing won't work here!
  sceneComponent.addMouseMotionListener(WeakListeners.create(MouseMotionListener.class, mouseEventForwarder, sceneComponent));
  sceneComponent.addMouseWheelListener(WeakListeners.create(MouseWheelListener.class, mouseEventForwarder, sceneComponent));
  sceneComponent.addMouseListener(WeakListeners.create(MouseListener.class, mouseEventForwarder, sceneComponent));
 }

代码示例来源:origin: com.synaptix/SynaptixSwing

rightScrollPane.getVerticalScrollBar().addAdjustmentListener(leftRightScrollBarAdjustementListener);
rightScrollPane.setWheelScrollingEnabled(false);
rightComponent.addMouseWheelListener(new MyMouseWheelListener());

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

component.addMouseWheelListener(new MouseWheelListener() {

代码示例来源:origin: Audiveris/audiveris

/**
 * Actually register the rubber as the mouse listener for the provided component.
 *
 * @param component the related component
 */
public final void connectComponent (JComponent component)
{
  // Clean up if needed
  disconnectComponent(this.component);
  // Remember the related component (to get visible rect, etc ...)
  this.component = component;
  if (component != null) {
    // To be notified of mouse clicks
    component.removeMouseListener(this); // No multiple notifications
    component.addMouseListener(this);
    // To be notified of mouse mouvements
    component.removeMouseMotionListener(this); // No multiple notifs
    component.addMouseMotionListener(this);
    // To be notified of mouse  wheel mouvements
    component.removeMouseWheelListener(this); // No multiple notifs
    component.addMouseWheelListener(this);
  }
}

代码示例来源:origin: RPTools/maptool

protected void addListeners(JComponent comp) {
  if (comp == null) {
    return;
  }
  if (this instanceof MouseListener) {
    comp.addMouseListener((MouseListener) this);
  }
  if (this instanceof MouseMotionListener) {
    comp.addMouseMotionListener((MouseMotionListener) this);
  }
  if (this instanceof MouseWheelListener) {
    comp.addMouseWheelListener((MouseWheelListener) this);
  }
  // Keystrokes
  comp.addKeyListener(this);
  comp.setActionMap(createActionMap(keyActionMap));
  comp.setInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, createInputMap(keyActionMap));
}

代码示例来源:origin: org.geotools/gt2-widgets-swing

super.addMouseListener(listeners);
if ((type & (SCALE_X | SCALE_Y)) != 0) {
  super.addMouseWheelListener(listeners);

代码示例来源:origin: nl.cloudfarming.client/cloudfarming-client-geoviewer-jxmap

this.view.addMouseListener(this.mouseEventForwarder);
this.view.addMouseMotionListener(this.mouseEventForwarder);
this.view.addMouseWheelListener(this.mouseEventForwarder);

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-terminal-nb

term.getScreen().addMouseWheelListener(new MouseWheelListener() {

代码示例来源:origin: uk.co.caprica/vlcj

private void initInputEvents(InputEvents inputEvents) {
  if (inputEvents == null) {
    inputEvents = RuntimeUtil.isNix() || RuntimeUtil.isMac() ? InputEvents.DEFAULT : InputEvents.DISABLE_NATIVE;
  }
  switch (inputEvents) {
    case NONE:
      break;
    case DISABLE_NATIVE:
      mediaPlayer.input().enableKeyInputHandling(false);
      mediaPlayer.input().enableMouseInputHandling(false);
      // Case fall-through is by design
    case DEFAULT:
      videoSurfaceComponent.addMouseListener(this);
      videoSurfaceComponent.addMouseMotionListener(this);
      videoSurfaceComponent.addMouseWheelListener(this);
      videoSurfaceComponent.addKeyListener(this);
      break;
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-mobility-svgcore

smgr.restoreSelection();
JComponent topComponent = smgr.getComposerGUI();
topComponent.addMouseWheelListener(new MouseWheelListener() {
  public void mouseWheelMoved(MouseWheelEvent e) {
    if (e.getWheelRotation() < 0) {

相关文章

JComponent类方法