本文整理匯總了Java中javafx.scene.canvas.Canvas.setOnMouseExited方法的典型用法代碼示例。如果您正苦於以下問題:Java Canvas.setOnMouseExited方法的具體用法?Java Canvas.setOnMouseExited怎麽用?Java Canvas.setOnMouseExited使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.canvas.Canvas
的用法示例。
在下文中一共展示了Canvas.setOnMouseExited方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: constructCanvas
import javafx.scene.canvas.Canvas; //導入方法依賴的package包/類
private void constructCanvas() {
boardCanvas = new Canvas();
if ( interactive ) {
boardCanvas.setOnMouseMoved(this::canvasHover);
boardCanvas.setOnMouseClicked(this::canvasClicked);
boardCanvas.setOnMouseExited(this::canvasExit);
}
boardPane.getChildren().add(boardCanvas);
gameDrawer = buildGameDrawer();
gameDrawer.draw(getGameHandler().getBoard());
}
示例2: setCanvas
import javafx.scene.canvas.Canvas; //導入方法依賴的package包/類
/**
* Sets the {@link Canvas} for use by the visualizer.
* <p>
* When the user clicks on the canvas, if the x and y coordinates intersect with a base then the offset is updated
* to the given base. If the mouse is hovered over a base the hovered base id is updated.
*
* @param canvas {@link Canvas} for use by the visualizer
*/
public void setCanvas(final Canvas canvas) {
this.canvas = canvas;
this.graphicsContext = canvas.getGraphicsContext2D();
canvas.widthProperty().addListener((observable, oldValue, newValue) -> draw());
canvas.setOnMouseClicked(event -> {
Optional.of(rTree).ifPresent(tree -> tree.find(event.getX(), event.getY(), offsetProperty::set));
// Do a second search as base nodes have been shifted.
Optional.of(rTree).ifPresent(tree -> tree.find(event.getX(), event.getY(), hoveredBaseIdProperty::set));
});
canvas.setOnMouseMoved(event -> Optional.of(rTree)
.ifPresent(tree -> tree.find(event.getX(), event.getY(), hoveredBaseIdProperty::set)));
canvas.setOnMouseExited(event -> hoveredBaseIdProperty.set(-1));
}
示例3: setCanvas
import javafx.scene.canvas.Canvas; //導入方法依賴的package包/類
/**
* Set {@link Canvas} which the {@link GraphVisualizer} use to draw.
*
* @param canvas canvas to be used to {@link GraphVisualizer}
*/
public void setCanvas(final Canvas canvas) {
this.canvas = canvas;
this.graphicsContext = canvas.getGraphicsContext2D();
this.segmentDrawingToolkit.setGraphicsContext(graphicsContext);
this.snpDrawingToolkit.setGraphicsContext(graphicsContext);
this.edgeDrawingToolkit.setGraphicsContext(graphicsContext);
this.graphAnnotationVisualizer.setGraphicsContext(graphicsContext);
canvas.setOnMouseClicked(event -> {
selectedSegmentProperty.setValue(null);
if (rTree == null) {
return;
}
rTree.find(event.getX(), event.getY(), this::setSelectedSegment);
});
canvas.setOnMouseMoved(event -> {
if (graphDimensionsCalculator.getLastScrollTime() > System.currentTimeMillis() - 100) {
return;
}
hoveredSegmentProperty.set(null);
if (rTree == null) {
return;
}
rTree.find(event.getX(), event.getY(), this::setHoveredSegmentProperty);
});
canvas.setOnMouseExited(event -> hoveredSegmentProperty.set(null));
graphDimensionsCalculator.setCanvasSize(canvas.getWidth(), canvas.getHeight());
canvas.widthProperty().addListener((observable, oldValue, newValue) -> {
graphDimensionsCalculator.setCanvasSize(newValue.doubleValue(), canvas.getHeight());
graphAnnotationVisualizer.setCanvasWidth(newValue.doubleValue());
});
canvas.heightProperty().addListener((observable, oldValue, newValue) -> {
graphDimensionsCalculator.setCanvasSize(canvas.getWidth(), newValue.doubleValue());
segmentDrawingToolkit.setCanvasHeight(newValue.doubleValue());
snpDrawingToolkit.setCanvasHeight(newValue.doubleValue());
});
graphAnnotationVisualizer.setCanvasWidth(canvas.getWidth());
segmentDrawingToolkit.setCanvasHeight(canvas.getHeight());
snpDrawingToolkit.setCanvasHeight(canvas.getHeight());
}