当前位置: 首页>>代码示例>>Java>>正文


Java MouseWheelEvent.getY方法代码示例

本文整理汇总了Java中java.awt.event.MouseWheelEvent.getY方法的典型用法代码示例。如果您正苦于以下问题:Java MouseWheelEvent.getY方法的具体用法?Java MouseWheelEvent.getY怎么用?Java MouseWheelEvent.getY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.event.MouseWheelEvent的用法示例。


在下文中一共展示了MouseWheelEvent.getY方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ScrollMove

import java.awt.event.MouseWheelEvent; //导入方法依赖的package包/类
/**
 * Recebe o evento de MouseWheel do quadro de edição se não consumido.
 *
 * @param e
 */
public void ScrollMove(MouseWheelEvent e) {
    int x = parente.getHorizontalScrollBar().getValue();
    int y = parente.getVerticalScrollBar().getValue();
    int vpw = parente.getViewport().getWidth() - getMargem();
    int vph = parente.getViewport().getHeight() - getMargem();
    int p1 = e.getX() + getMargem() - x;
    int p2 = e.getY() + getMargem() - y;

    boolean ambos = (p2 > vph && p1 > vpw);

    p1 = vpw - (p1);
    p2 = vph - (p2);

    if (p1 < p2 || ambos) {
        parente.getVerticalScrollBar().setValue(y + 2 * e.getUnitsToScroll());
    }
    if (p2 < p1 || ambos) {
        parente.getHorizontalScrollBar().setValue(x + 2 * e.getUnitsToScroll());
    }
    e.consume();
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:27,代码来源:Editor.java

示例2: WidgetMouseWheelEvent

import java.awt.event.MouseWheelEvent; //导入方法依赖的package包/类
/**
 * Creates a mouse wheel event.
 * @param id the event id
 * @param event the Swing event
 */
public WidgetMouseWheelEvent(long id, MouseWheelEvent event) {
    this.id = id;
    this.event = event;
    x = event.getX ();
    y = event.getY ();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:WidgetAction.java

示例3: mouseWheelMoved

import java.awt.event.MouseWheelEvent; //导入方法依赖的package包/类
public void mouseWheelMoved(MouseWheelEvent e) {
      //System.out.println("PlotCanvas.mouseWheelMoved");
/*
       * System.out.println("PlotCanvas.mouseWheelMoved");
       * System.out.println(" mouseClick = [" + mouseClick[0] + " " +
       * mouseClick[1] + "]"); System.out.println(" mouseCurent = [" +
       * mouseCurent[0] + " " + mouseCurent[1] + "]");
       */
      mouseCurent[0] = e.getX();
      mouseCurent[1] = e.getY();
      e.consume();
      int[] origin;
      double[] ratio;
      // double factor = 1.5;
      //switch (ActionMode) {
      //    case ZOOM:
      if (e.getWheelRotation() == -1) {
          if (Array.max(((AWTDrawer) draw).projection.totalScreenRatio) > .01) {
              origin = new int[]{(int) (mouseCurent[0] - getWidth() / 3/* (2*factor) */),
                                 (int) (mouseCurent[1] - getHeight() / 3/* (2*factor) */)};
              ratio = new double[]{0.666/* 1/factor, 1/factor */, 0.666};
              draw.dilate(origin, ratio);
          }
      } else {
          if (Array.max(((AWTDrawer) draw).projection.totalScreenRatio) < 1) {
              origin = new int[]{(int) (mouseCurent[0] - getWidth() / 1.333/* (2/factor) */),
                                 (int) (mouseCurent[1] - getHeight() / 1.333/* (2/factor) */)
              };
              ratio = new double[]{1.5, 1.5 /* factor, factor */};
              draw.dilate(origin, ratio);
          } else /* (Array.max(((AWTDrawer) draw).projection.totalScreenRatio) >= 1)*/ {
              ((AWTDrawer) draw).projection.initBaseCoordsProjection(true);
          }
      }
      repaint();
      //       break;
      //}
  }
 
开发者ID:Cvarier,项目名称:2D-Elliptic-Mesh-Generator,代码行数:39,代码来源:PlotCanvas.java

示例4: mouseWheelMoved

import java.awt.event.MouseWheelEvent; //导入方法依赖的package包/类
@Override
public void mouseWheelMoved(MouseWheelEvent mouseWheelEvent) {
    super.mouseWheelMoved(mouseWheelEvent);
    int x = mouseWheelEvent.getX();
    int y = mouseWheelEvent.getY();
    int wheelRotation = mouseWheelEvent.getWheelRotation();
    InputSource inputSource = Util.retrieveInputSourceFromMouseEvent(mouseWheelEvent);
    input.events.add(new TouchInputEvent(inputSource, InputType.move, x, y, getPointerId(mouseWheelEvent), wheelRotation));
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:10,代码来源:SimulatorInputListener.java


注:本文中的java.awt.event.MouseWheelEvent.getY方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。