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


Java MouseEvent.getSceneX方法代碼示例

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


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

示例1: mouseReleased

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
private void mouseReleased(MouseEvent e) {
	// Geklickt: Stein setzen, wenn der Spieler an der Reihe ist
	
	if (!isPlayerTurn)
		return;
	
	int x = (int)e.getSceneX();

	int column = Math.max((int)((x - PADDING_X / 2) / ((2 * RADIUS + MARGIN))), 0);
	
	isPlayerTurn = false;
	setStone(column, false, (didSet) -> {
		if (didSet) {
			resetTempStone();
			draw();
			updateStatusMenu(GameStatus.OPPONENT_TURN);
		} else {
			System.err.println("Couldn't set stone ==> reset");
			
			this.board.get(temporaryStone[1]).set(temporaryStone[0], 0);
			resetTempStone();
			draw();
			updateStatusMenu(GameStatus.ERROR);
		}
	});
}
 
開發者ID:lukasbischof,項目名稱:Orsum-occulendi,代碼行數:27,代碼來源:GameController.java

示例2: handle

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
@Override
public void handle(MouseEvent event) {

    // don't do anything if the user is in the process of adding to the selection model
    if( event.isControlDown() || event.isShiftDown()) {
        return;
    }

    Node node = (Node) event.getSource();

    dragContext.x = node.getTranslateX() - event.getSceneX();
    dragContext.y = node.getTranslateY() - event.getSceneY();

    // clear the model if the current node isn't in the selection => new selection
    if( !selectionModel.contains(node)) {
        selectionModel.clear();
        selectionModel.add( node);
    }

    // flag that the mouse released handler should consume the event, so it won't bubble up to the pane which has a rubberband selection mouse released handler
    enabled = true;

    // prevent rubberband selection handler
    event.consume();
}
 
開發者ID:lttng,項目名稱:lttng-scope,代碼行數:26,代碼來源:ExampleMouseDrag2.java

示例3: moveNodes

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
public void moveNodes(MouseEvent event){
    double offsetX = (event.getSceneX() - initMoveX)*(1/diagramController.drawPane.getScaleX());
    double offsetY = (event.getSceneY() - initMoveY)*(1/diagramController.drawPane.getScaleY());

    //Drag all selected nodes and their children
    for(AbstractNode n : toBeMoved)
    {
        Double x = initTranslateMap.get(n).getX() + offsetX;
        Double y = initTranslateMap.get(n).getY() + offsetY;
        n.setTranslateX(x);
        n.setTranslateY(y);
        n.setX(x);
        n.setY(y);
        if(snapIndicators){
            setSnapIndicators(closestInteger(x.intValue(), Constants.GRID_DISTANCE), closestInteger(y.intValue(), Constants.GRID_DISTANCE), n, true);
        }
    }
}
 
開發者ID:kaanburaksener,項目名稱:octoBubbles,代碼行數:19,代碼來源:NodeController.java

示例4: thumbMousePressed

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
@FXML
    void thumbMousePressed(MouseEvent event) {
        gradientPicker.setSelectedStop(this);
        startDragX = event.getSceneX();
        origX = getLayoutX();
        toFront(); // make sure this stop is in highest z-order
//        showHUD();
        pixelsToValue();
        // Called when selecting a gradient stop :
        // - update color preview accordingly
        // - do not update the model
        final PaintPickerController paintPicker
                = gradientPicker.getPaintPickerController();
        final ColorPickerControl colorPicker = paintPicker.getColorPicker();
        colorPicker.updateUI(color);
        stop_button.requestFocus();
    }
 
開發者ID:EricCanull,項目名稱:fxexperience2,代碼行數:18,代碼來源:GradientPickerStop.java

示例5: thumbMouseDragged

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
@FXML
    void thumbMouseDragged(MouseEvent event) {
        double dragValue = event.getSceneX() - startDragX;
        double deltaX = origX + dragValue;
        double trackWidth = getParent().getBoundsInLocal().getWidth();
        final Double newX = clamp(edgeMargin, deltaX, (trackWidth - (getWidth() + edgeMargin)));
        setLayoutX(newX);
//        showHUD();
        pixelsToValue();
        // Called when moving a gradient stop :
        // - update gradient preview accordingly
        // - update model
        final PaintPickerController paintPicker
                = gradientPicker.getPaintPickerController();
        final Mode mode = paintPicker.getMode();
        final Paint value = gradientPicker.getValue(mode);
        gradientPicker.updatePreview(value);
        // Update model
        paintPicker.setPaintProperty(value);
    }
 
開發者ID:EricCanull,項目名稱:fxexperience2,代碼行數:21,代碼來源:GradientPickerStop.java

示例6: moveSketches

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
public void moveSketches(MouseEvent event) {
    double offsetX = event.getSceneX() - initMoveX;
    double offsetY = event.getSceneY() - initMoveY;

    //Drag all selected sketches.
    for(Sketch sketch : toBeMoved)
    {
        sketch.setTranslateX(initTranslateMap.get(sketch).getX() + offsetX);
        sketch.setTranslateY(initTranslateMap.get(sketch).getY() + offsetY);
    }
}
 
開發者ID:kaanburaksener,項目名稱:octoBubbles,代碼行數:12,代碼來源:SketchController.java

示例7: moveSketchStart

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
public void moveSketchStart(MouseEvent event) {
    initMoveX = event.getSceneX();
    initMoveY = event.getSceneY();
    Point2D.Double initTranslate;
    for (Sketch sketch : mController.getSelectedSketches()) {
        initTranslate = new Point2D.Double(sketch.getTranslateX(), sketch.getTranslateY());
        initTranslateMap.put(sketch, initTranslate);
        toBeMoved.add(sketch);
    }
}
 
開發者ID:kaanburaksener,項目名稱:octoBubbles,代碼行數:11,代碼來源:SketchController.java

示例8: moveThumb

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
public void moveThumb(MouseEvent event) {
    double deltaX = event.getSceneX() - thumbWidth * 2;
    double trackWidth = track_container.getWidth() - thumbWidth;
    final Double newX = ColorEncoder.clamp(0, deltaX, trackWidth);
    thumb.setLayoutX(newX);
    pixelsToValue();
}
 
開發者ID:EricCanull,項目名稱:fxexperience2,代碼行數:8,代碼來源:SliderControl.java

示例9: handle

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
/**
 * Sets the current position of the mouse and the current position on the canvas
 * @param event - event
 */
public void handle(MouseEvent event) {
    // right mouse button => panning
    if (!event.isSecondaryButtonDown()) {
        return;
    }

    sceneDragContext.mouseAnchorX = event.getSceneX();
    sceneDragContext.mouseAnchorY = event.getSceneY();

    sceneDragContext.translateAnchorX = canvas.getTranslateX();
    sceneDragContext.translateAnchorY = canvas.getTranslateY();
}
 
開發者ID:INAETICS,項目名稱:Drones-Simulator,代碼行數:17,代碼來源:SceneGestures.java

示例10: moveSketchFinished

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
public double[] moveSketchFinished(MouseEvent event) {
    toBeMoved.clear();
    initTranslateMap.clear();
    double[] deltaTranslateVector = new double[2];
    deltaTranslateVector[0] = event.getSceneX() - initMoveX;
    deltaTranslateVector[1] = event.getSceneY() - initMoveY;
    return deltaTranslateVector;
}
 
開發者ID:kaanburaksener,項目名稱:octoBubbles,代碼行數:9,代碼來源:SketchController.java

示例11: handleMousePressed

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
@FXML
private void handleMousePressed(MouseEvent event) {
	xOffset = event.getSceneX();
	yOffset = event.getSceneY();
}
 
開發者ID:nshusa,項目名稱:rsam-gui,代碼行數:6,代碼來源:StoreController.java

示例12: moveMousePressed

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
@FXML
void moveMousePressed(MouseEvent event) {
    xOffset = event.getSceneX();
    yOffset = event.getSceneY();
}
 
開發者ID:dainesch,項目名稱:HueSense,代碼行數:6,代碼來源:QuickPresenter.java

示例13: mousePressed

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
private void mousePressed(MouseEvent mouseEvent) {
    mouseOldX = mouseEvent.getSceneX();
    mouseOldY = mouseEvent.getSceneY();
}
 
開發者ID:adihubba,項目名稱:javafx-3d-surface-chart,代碼行數:5,代碼來源:Mesh3DChartPanel.java

示例14: handle

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
public void handle(MouseEvent event) {

            // left mouse button => dragging
            if (!event.isPrimaryButtonDown())
                return;

            nodeDragContext.mouseAnchorX = event.getSceneX();
            nodeDragContext.mouseAnchorY = event.getSceneY();

            Node node = (Node) event.getSource();
            System.out.format("%10f,%10f%n", node.getTranslateX(), node.getTranslateY());

            nodeDragContext.translateAnchorX = node.getTranslateX();
            nodeDragContext.translateAnchorY = node.getTranslateY();

        }
 
開發者ID:INAETICS,項目名稱:Drones-Simulator,代碼行數:17,代碼來源:NodeGestures.java

示例15: movePaneStart

import javafx.scene.input.MouseEvent; //導入方法依賴的package包/類
void movePaneStart(MouseEvent event) {
    initMoveX = event.getSceneX();
    initMoveY = event.getSceneY();
}
 
開發者ID:kaanburaksener,項目名稱:octoBubbles,代碼行數:5,代碼來源:GraphController.java


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