本文整理匯總了Java中javafx.scene.layout.Pane.setOnMouseClicked方法的典型用法代碼示例。如果您正苦於以下問題:Java Pane.setOnMouseClicked方法的具體用法?Java Pane.setOnMouseClicked怎麽用?Java Pane.setOnMouseClicked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.scene.layout.Pane
的用法示例。
在下文中一共展示了Pane.setOnMouseClicked方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUpListener
import javafx.scene.layout.Pane; //導入方法依賴的package包/類
private void setUpListener (Scene scene, Pane pane) {
pane.requestFocus();
pane.setOnMouseClicked(e -> queue(myEventFactory.interpretEvent(e, myScale.getScale(),
myScale.getScale())));
scene.addEventFilter(KeyEvent.KEY_RELEASED, e -> queue(myEventFactory.interpretEvent(e)));
scene.addEventFilter(KeyEvent.KEY_PRESSED, e -> queue(myEventFactory.interpretEvent(e)));
}
示例2: createLevelView
import javafx.scene.layout.Pane; //導入方法依賴的package包/類
/**
* Creates the level view using an authoring renderer to
* keep track of the sprites on screen
*
* @return
*/
private Node createLevelView () {
Pane pane = new Pane();
Pane levelPane = new Pane();
myGrid = new GridPane();
myButton = placeableButton();
disableGrid();
myLevel.setBackgroundImageSize(Double.parseDouble(myBundle.getString("Width")),
Double.parseDouble(myBundle.getString("Height")));
myRenderer = new AuthoringRenderer(myLevel, levelPane, myGrid, myScale);
myRenderer.render();
levelPane.setOnMouseClicked(e -> handleMouseClick(e));
pane.getChildren().addAll(levelPane, myGrid, myButton);
return pane;
}
示例3: start
import javafx.scene.layout.Pane; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) throws Exception {
if (primaryStage == null) {
return;
}
Pane root = new Pane();
Arrow arrow = new Arrow();
arrow.setStroke(Color.GREEN);
root.getChildren().add(arrow);
root.setOnMouseClicked(evt -> {
switch (evt.getButton()) {
case PRIMARY:
// set pos of end with arrow head
arrow.setEndX(evt.getX());
arrow.setEndY(evt.getY());
break;
case SECONDARY:
// set pos of end without arrow head
arrow.setStartX(evt.getX());
arrow.setStartY(evt.getY());
break;
case MIDDLE:
case NONE:
default:
break;
}
});
Scene scene = new Scene(root, 400, 400);
primaryStage.setScene(scene);
primaryStage.show();
}
示例4: createNewPath
import javafx.scene.layout.Pane; //導入方法依賴的package包/類
/**
* Starts making a new path beginning with a start point
*
* @param sprite
* @param startPoint
* @param container
*/
public void createNewPath (ISprite sprite, Coordinate startPoint, Pane container) {
startPoint = new Coordinate(scale(startPoint.getX()), scale(startPoint.getY()));
pathCreator.newPath(startPoint, container, myScale);
container.setOnMouseClicked(e -> pathCreator.addToPath(e, container));
container.setOnKeyPressed(e -> handleKeyPress(e, container, sprite));
}
示例5: setUpWatchers
import javafx.scene.layout.Pane; //導入方法依賴的package包/類
/**
* Set ups the watchers the wait for clicks/key input to interpret
* This method relies on the IScreenEventFactory. The IScreenEvent factory takes in a JavaFX
* ActionEvent and returns
* the proper IGlobalEffect to pass to the game
*/
private void setUpWatchers (Pane pane) {
pane.setOnMouseClicked(e -> myQueue.add(factoryMock.interpretEvent(e)));
pane.setOnKeyPressed(e -> myQueue.add(factoryMock.interpretEvent(e)));
}