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


Java Pane.setOnMouseClicked方法代碼示例

本文整理匯總了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)));
}
 
開發者ID:tomrom95,項目名稱:GameAuthoringEnvironment,代碼行數:8,代碼來源:IOInterpeter.java

示例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;
}
 
開發者ID:tomrom95,項目名稱:GameAuthoringEnvironment,代碼行數:22,代碼來源:SceneCreator.java

示例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();
}
 
開發者ID:lttng,項目名稱:lttng-scope,代碼行數:36,代碼來源:ArrowExample.java

示例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));
}
 
開發者ID:tomrom95,項目名稱:GameAuthoringEnvironment,代碼行數:14,代碼來源:SpriteController.java

示例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)));
}
 
開發者ID:tomrom95,項目名稱:GameAuthoringEnvironment,代碼行數:11,代碼來源:ScreenInteractionUseCase.java


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