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


Java MouseWheelEvent.consume方法代碼示例

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


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

示例1: mouseWheelMoved

import java.awt.event.MouseWheelEvent; //導入方法依賴的package包/類
@Override
public void mouseWheelMoved(MouseWheelEvent me) {

	Point2D mouse = me.getPoint();
	Point2D center = this.getVisViewer().getCenter();
	int amount = me.getWheelRotation();
        
	if(zoomAtMouse) {
		if(amount > 0) {
			scaler.scale(this.getVisViewer(), out, mouse);
		} else if(amount < 0) {
			scaler.scale(this.getVisViewer(), in, mouse);
		}
		
	} else {
		if(amount > 0) {
			scaler.scale(this.getVisViewer(), out, center);
		} else if(amount < 0) {
			scaler.scale(this.getVisViewer(), in, center);
		}
        }
        me.consume();
	
}
 
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:25,代碼來源:GraphEnvironmentMousePlugin.java

示例2: 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

示例3: mouseWheelMoved

import java.awt.event.MouseWheelEvent; //導入方法依賴的package包/類
@Override
public void mouseWheelMoved( MouseWheelEvent e ) {
    if( !isEnabled() )
        return;
    int rotation = e.getWheelRotation();
    if( (rotation < 0 && isScrollLeft)
            || (rotation > 0 && !isScrollLeft ) ) {
        int increment = getDefaultIncrement();
        increment *= Math.abs( rotation );
        scroll( increment );
        e.consume();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:14,代碼來源:ScrollAction.java

示例4: scroll

import java.awt.event.MouseWheelEvent; //導入方法依賴的package包/類
private static void scroll(JScrollBar scroller, MouseWheelEvent event) {
    if (event.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        int direction = event.getUnitsToScroll() < 0 ? -1 : 1;
        int increment = scroller.getUnitIncrement(direction);
        int amount = event.getScrollAmount();
        int oldValue = scroller.getValue();
        int newValue = oldValue + increment * amount * direction;
        if (oldValue != newValue) scroller.setValue(newValue);
        event.consume();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:12,代碼來源:ProfilerTableContainer.java

示例5: scroll

import java.awt.event.MouseWheelEvent; //導入方法依賴的package包/類
private static void scroll(final JScrollBar scroller, final MouseWheelEvent event) {
    if (event.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
        int unitsToScroll = event.getUnitsToScroll();
        int direction = unitsToScroll < 0 ? -1 : 1;
        if (unitsToScroll != 0) {
            int increment = scroller.getUnitIncrement(direction);
            int oldValue = scroller.getValue();
            int newValue = oldValue + increment * unitsToScroll;
            newValue = Math.max(Math.min(newValue, scroller.getMaximum() -
                       scroller.getVisibleAmount()), scroller.getMinimum());
            if (oldValue != newValue) scroller.setValue(newValue);
        }
        event.consume();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:JTreeTablePanel.java

示例6: mouseWheelMoved

import java.awt.event.MouseWheelEvent; //導入方法依賴的package包/類
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
    if (e.getWheelRotation() == 0) {
        return;
    }

    for (int i = 0; i < base.dimension; i++) {
        int s = baseGrid.getAxis(i).getLinearSlices();
        double r = e.getWheelRotation() > 0 ? 1.0 / s : -1.0 / s;
        if (r > -0.5) {
            double d = (base.upperBound[i] - base.lowerBound[i]) * r;
            base.lowerBound[i] -= d;
            base.upperBound[i] += d;
        }
    }

    for (int i = 0; i < base.dimension; i++) {
        base.setPrecisionUnit(i);
    }
    
    base.initBaseCoord();
    graphics.projection.reset();
    baseGrid.setBase(base);
    
    repaint();
    e.consume();
}
 
開發者ID:takun2s,項目名稱:smile_1.5.0_java7,代碼行數:28,代碼來源:PlotCanvas.java

示例7: 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

示例8: mouseWheelMoved

import java.awt.event.MouseWheelEvent; //導入方法依賴的package包/類
public void mouseWheelMoved(MouseWheelEvent e) {
    if (e.isControlDown()) {
        if (e.getWheelRotation() < 0) {
            getEditor().ZoomMais();
        } else {
            getEditor().ZoomMenos();
        }
        e.consume();
    }
}
 
開發者ID:chcandido,項目名稱:brModelo,代碼行數:11,代碼來源:Diagrama.java

示例9: mouseWheelMoved

import java.awt.event.MouseWheelEvent; //導入方法依賴的package包/類
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
	e.consume();
	wheel += e.getWheelRotation();
}
 
開發者ID:ZetzmannM,項目名稱:CGL,代碼行數:6,代碼來源:Listener.java


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