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


Java MouseEvent.getY方法代码示例

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


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

示例1: canvasClicked

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@Override
public void canvasClicked(MouseEvent mouseEvent) {
	DrawCoords mousePosition = new DrawCoords(mouseEvent.getX(), mouseEvent.getY());
	CoordProjector projector = getProjector(boardCanvas);
	Coords boardPos = projector.nearestCoords(mousePosition);

	if ( !projector.isWithinBounds(mousePosition) )
		return;

	scorePane.enableButtons();
	if ( mouseEvent.getButton() == MouseButton.PRIMARY ) {
		if ( !mouseEvent.isShiftDown() )
			boardScorer.markGroupDead(boardPos);
		else
			boardScorer.unmarkGroupDead(boardPos);
	}
}
 
开发者ID:GoSuji,项目名称:Suji,代码行数:18,代码来源:Scoring.java

示例2: handleMousePressed

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
/**
 * Handles a mouse pressed event by recording the initial mouse pointer
 * location.
 * 
 * @param canvas  the JavaFX canvas ({@code null} not permitted).
 * @param e  the mouse event ({@code null} not permitted).
 */
@Override
public void handleMousePressed(ChartCanvas canvas, MouseEvent e) {
    Plot plot = canvas.getChart().getPlot();
    if (!(plot instanceof Pannable)) {
        canvas.clearLiveHandler();
        return;
    }
    Pannable pannable = (Pannable) plot;
    if (pannable.isDomainPannable() || pannable.isRangePannable()) {
        Point2D point = new Point2D.Double(e.getX(), e.getY());
        Rectangle2D dataArea = canvas.findDataArea(point);
        if (dataArea != null && dataArea.contains(point)) {
            this.panW = dataArea.getWidth();
            this.panH = dataArea.getHeight();
            this.panLast = point;
            canvas.setCursor(javafx.scene.Cursor.MOVE);
        }
    }
    // the actual panning occurs later in the mouseDragged() method
}
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:28,代码来源:PanHandlerFX.java

示例3: onBackgroundDragged

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void onBackgroundDragged(MouseEvent event) {
    if (event.getButton() == MouseButton.PRIMARY && dragActive) {
        double x = event.getX() - panningComponent.panXProperty().get();
        double y = event.getY() - panningComponent.panYProperty().get();

        double minX = Math.min(x, xAtPress);
        double minY = Math.min(y, yAtPress);
        double maxX = Math.max(x, xAtPress);
        double maxY = Math.max(y, yAtPress);

        root.setVisible(true);
        root.setLayoutX(minX);
        root.setLayoutY(minY);
        root.setWidth(maxX - minX);
        root.setHeight(maxY - minY);
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:18,代码来源:SelectionBoxComponent.java

示例4: canvasHover

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void canvasHover(MouseEvent mouseEvent) {
	double x = mouseEvent.getX();
	double y = mouseEvent.getY();
	DrawCoords location = new DrawCoords(x, y);

	HoverEvent event = new HoverEvent(game, location, game);
	game.fireEvent(event);
}
 
开发者ID:GoSuji,项目名称:Suji,代码行数:9,代码来源:BoardController.java

示例5: onMousePressedOnCanvas

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
public void onMousePressedOnCanvas(MouseEvent event){
    dragStartX = event.getX();
    dragStartY = event.getY();
    if(diagramController instanceof SequenceDiagramController){
        for(AbstractNodeView node : diagramController.getAllNodeViews()){
            double middleOfNode = (node.getX() + (node.getX() + node.getWidth())) /2;
            if(event.getX() > middleOfNode - 20 && event.getX() < middleOfNode + 20
                    && event.getY() > node.getY()){
                startNodeView = node;
            }
        }
    }
    aDrawPane.getChildren().add(dragLine);
}
 
开发者ID:kaanburaksener,项目名称:octoBubbles,代码行数:15,代码来源:EdgeController.java

示例6: recordClick2

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@Override public void recordClick2(final RFXComponent r, MouseEvent e, boolean withCellInfo) {
    final JSONObject event = new JSONObject();
    event.put("type", "click");
    int button = e.getButton() == MouseButton.PRIMARY ? java.awt.event.MouseEvent.BUTTON1 : java.awt.event.MouseEvent.BUTTON3;
    event.put("button", button);
    event.put("clickCount", e.getClickCount());
    event.put("modifiersEx", buildModifiersText(e));
    double x = e.getX();
    double y = e.getY();
    Node source = (Node) e.getSource();
    Node target = r.getComponent();
    Point2D sts = source.localToScreen(new Point2D(0, 0));
    Point2D tts = target.localToScreen(new Point2D(0, 0));
    x = e.getX() - tts.getX() + sts.getX();
    y = e.getY() - tts.getY() + sts.getY();
    event.put("x", x);
    event.put("y", y);
    if (withCellInfo) {
        event.put("cellinfo", r.getCellInfo());
    }
    final JSONObject o = new JSONObject();
    o.put("event", event);
    fill(r, o);
    if (e.getClickCount() == 1) {
        clickTimer = new Timer();
        clickTimer.schedule(new TimerTask() {
            @Override public void run() {
                sendRecordMessage(o);
            }
        }, timerinterval.intValue());
    } else if (e.getClickCount() == 2) {
        if (clickTimer != null) {
            clickTimer.cancel();
            clickTimer = null;
        }
        sendRecordMessage(o);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:39,代码来源:WSRecorder.java

示例7: updateRotation

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void updateRotation(MouseEvent event) {
    if (!value.isBound()) {
        double mouseToCenterX = event.getX() - button.getWidth() / 2;
        double mouseToCenterY = event.getY() -  button.getHeight() / 2;
        double angle = Math.round(Math.toDegrees(Math.atan2(mouseToCenterY, mouseToCenterX)));
        double positiveAngle = angle < 0 ? angle + 360 : angle;
        setValue(positiveAngle);
        if (onChange != null) {
            onChange.run();
        }
    }
}
 
开发者ID:rmfisher,项目名称:fx-animation-editor,代码行数:13,代码来源:RotatorDialComponent.java

示例8: drawingAreaMouseDragged

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@FXML
private void drawingAreaMouseDragged(MouseEvent e)
{
   Circle newCircle = new Circle(e.getX(), e.getY(), 
      radius.getRadius(), brushColor);
   drawingAreaAnchorPane.getChildren().add(newCircle); 
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:8,代码来源:PainterController.java

示例9: handleMouseClicked

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
/**
 * Handles a mouse clicked event by setting the anchor point for the
 * canvas and redrawing the chart (the anchor point is a reference point
 * used by the chart to determine crosshair lines).
 * 
 * @param canvas  the chart canvas ({@code null} not permitted).
 * @param e  the mouse event ({@code null} not permitted).
 */
@Override
public void handleMouseClicked(ChartCanvas canvas, MouseEvent e) {
    if (this.mousePressedPoint == null) {
        return;
    }
    Point2D currPt = new Point2D.Double(e.getX(), e.getY());
    if (this.mousePressedPoint.distance(currPt) < 2) {
        canvas.setAnchor(currPt);
    }
    this.mousePressedPoint = null;
}
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:20,代码来源:AnchorHandlerFX.java

示例10: handleMouseMoved

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@Override
public void handleMouseMoved(ChartCanvas canvas, MouseEvent e) {
    double x = e.getX();
    double y = e.getY();
    ChartEntity entity = canvas.getRenderingInfo().getEntityCollection().getEntity(x, y);
    ChartMouseEventFX event = new ChartMouseEventFX(canvas.getChart(), e, entity);
    for (ChartMouseListenerFX listener : canvas.getChartMouseListeners()) {
        listener.chartMouseMoved(event);
    }
 }
 
开发者ID:jfree,项目名称:jfreechart-fx,代码行数:11,代码来源:DispatchHandlerFX.java

示例11: initDragModeAndHandle

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void initDragModeAndHandle(MouseEvent evt) {
    dragMode = null;
    handle = null;

    if (!(evt.getTarget() instanceof EntryViewBase)) {
        return;
    }

    dayEntryView = (DayEntryView) evt.getTarget();

    entry = dayEntryView.getEntry();
    Calendar calendar = entry.getCalendar();
    if (calendar.isReadOnly()) {
        return;
    }

    double y = evt.getY() - dayEntryView.getBoundsInParent().getMinY();

    LOGGER.finer("y-coordinate inside entry view: " + y);

    if (y > dayEntryView.getHeight() - 5) {
        if (dayView.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dayView, entry, DateControl.EditOperation.CHANGE_END))) {
            dragMode = DraggedEntry.DragMode.END_TIME;
            handle = Handle.BOTTOM;
        }
    } else if (y < 5) {
        if (dayView.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dayView, entry, DateControl.EditOperation.CHANGE_START))) {
            dragMode = DraggedEntry.DragMode.START_TIME;
            handle = Handle.TOP;
        }
    } else {
        if (dayView.getEntryEditPolicy().call(new DateControl.EntryEditParameter(dayView, entry, DateControl.EditOperation.MOVE))) {
            dragMode = DraggedEntry.DragMode.START_AND_END_TIME;
            handle = Handle.CENTER;
        }
    }
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:38,代码来源:DayViewEditController.java

示例12: getPointerPosition

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
public Position getPointerPosition(Event e) {
    double mousePositionX = 0;
    double mousePositionY = 0;
    if (e instanceof MouseEvent) {
        MouseEvent mouseEvent = (MouseEvent) e;
        mousePositionX = mouseEvent.getX();
        mousePositionY = mouseEvent.getY();
    }
    if (e instanceof GazeEvent) {
        GazeEvent gazeEvent = (GazeEvent) e;
        mousePositionX = gazeEvent.getX();
        mousePositionY = gazeEvent.getY();
    }
    return new Position((int) mousePositionX, (int) mousePositionY);
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:16,代码来源:Target.java

示例13: mouseDragged

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
private void mouseDragged(MouseEvent event) {
  if (!dragging) {
    return;
  }

  final double mouseX = event.getX();
  final double mouseY = event.getY();

  final double newWidth = tile.getMinWidth() + (mouseX - lastX);
  final double newHeight = tile.getMinHeight() + (mouseY - lastY);

  if (resizeLocation.isHorizontal && newWidth >= tilePane.getTileSize()) {
    if (tile.getContent().getView().getMinWidth() < newWidth) {
      tile.setMinWidth(newWidth);
    }
    tile.setMaxWidth(newWidth);
  }
  if (resizeLocation.isVertical && newHeight >= tilePane.getTileSize()) {
    if (tile.getContent().getView().getMinHeight() < newHeight) {
      tile.setMinHeight(newHeight);
    }
    tile.setMaxHeight(newHeight);
  }

  lastX = mouseX;
  lastY = mouseY;
  TileLayout layout = tilePane.getTileLayout(tile);
  tilePane.setHighlight(true);
  tilePane.setHighlightPoint(layout.origin);
  tilePane.setHighlightSize(finalSize());
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:32,代码来源:TileDragResizer.java

示例14: handleButtonClick_GraphPane

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@FXML
private void handleButtonClick_GraphPane(MouseEvent e) {
	
	// se mi trovo già su un nodo questo metodo non deve essere eseguito
	if (mouseOverNode) return;
	
	Singleton s = Singleton.getInstance();
	
	// se clicco su uno spazio vuoto mentro sto collegando due nodi annullo l'operazione ed esco dal metodo
	if (currentNode != null) {
		
		s.logger.log("Operazione annullata.");
		currentNode = null;
		
		return;
	}
	
	if (!s.graphLoaded) {	// non c'è ancora nessun grafo visualizzato, quindi gestisco il click
		
		double xPos = e.getX();
		double yPos = e.getY();
		
		Integer index = 0;
		
		// ricavo l'indice massimo tra i nodi del grafo
		Node<CoordinateNode> maxIndexKey = s.getCurrentGraph().getMaxKey();
		if (maxIndexKey != null) {
			index = ((CoordinateNode) maxIndexKey.getElement()).getIndex() + 1;
		}
			
		// disegno il nodo come un intero (indice del nodo) all'interno di un cerchio
		
		// se currentNode non è null vuol dire che mi trovo già su un nodo, quindi non faccio nulla
		if (MainController.currentNode != null) return;
		
		Singleton.getInstance().drawingUtility.drawNode(index, xPos, yPos);
		
		// inserisco il nuovo nodo nel grafo
		s.getCurrentGraph().insertNode(new Node<CoordinateNode>(new CoordinateNode(index, xPos, yPos)));
	}
}
 
开发者ID:steppp,项目名称:Breadth-First-Search,代码行数:42,代码来源:MainController.java

示例15: interpretEvent

import javafx.scene.input.MouseEvent; //导入方法依赖的package包/类
@Override
public MouseIOEvent interpretEvent (MouseEvent event, double xscale, double yscale) {
    InputType type = convertType(event.getEventType().toString());
    MouseIOEvent mouse = new MouseIOEvent(type, event.getX() / xscale, event.getY() / yscale);
    return mouse;
}
 
开发者ID:tomrom95,项目名称:GameAuthoringEnvironment,代码行数:7,代码来源:ScreenEventFactory.java


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