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


Java Scene.getHeight方法代碼示例

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


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

示例1: scaleAll

import javafx.scene.Scene; //導入方法依賴的package包/類
private static void scaleAll(Scene scene, Node node) {
    double translateX = node.getTranslateX();
    double translateY = node.getTranslateY();
    double baseX = node.getBoundsInParent().getMinX();
    double baseY = node.getBoundsInParent().getMinY();
    double sceneWidth = scene.getWidth();
    double sceneHeight = scene.getHeight();
    ChangeListener<Number> widthResizer = (arg0, oldValue, newValue) -> {
        node.setScaleX(newValue.doubleValue() / sceneWidth);
        node.setTranslateX(translateX + (baseX * newValue.doubleValue() / sceneWidth) - baseX);
    };

    scene.widthProperty().addListener(widthResizer);
    ChangeListener<Number> heightResizer = (arg0, oldValue, newValue) -> {
        node.setScaleY(newValue.doubleValue() / sceneHeight);
        node.setTranslateY(translateY + (baseY * newValue.doubleValue() / sceneHeight) - baseY);
    };
    scene.heightProperty().addListener(heightResizer);

}
 
開發者ID:ciphertechsolutions,項目名稱:IO,代碼行數:21,代碼來源:BaseController.java

示例2: Stats

import javafx.scene.Scene; //導入方法依賴的package包/類
public Stats(Scene gameContextScene) {
    this.gameContextScene = gameContextScene;

    nbGoals = 0;
    beginTime = 0;
    length = 0;
    zeroTime = System.currentTimeMillis();
    lengthBetweenGoals = new ArrayList<Integer>(1000);

    log.info("GazeUtils ON : " + GazeUtils.isOn());

    if (GazeUtils.isOn()) {
        recordGazeMovements = buildRecordGazeMovements();
        GazeUtils.addStats(this);
    } else {
        recordMouseMovements = buildRecordMouseMovements();
        gameContextScene.addEventFilter(MouseEvent.ANY, recordMouseMovements);
    }

    int heatMapWidth = (int) (gameContextScene.getHeight() / heatMapPixelSize);
    int heatMapHeight = (int) (gameContextScene.getWidth() / heatMapPixelSize);
    log.info("heatMapWidth = {}, heatMapHeight = {}", heatMapWidth, heatMapHeight);
    heatMap = new double[heatMapWidth][heatMapHeight];
}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:25,代碼來源:Stats.java

示例3: makeScalable

import javafx.scene.Scene; //導入方法依賴的package包/類
private static void makeScalable(Scene scene, Region region) {
    double regionWidth = region.getPrefWidth();
    double sceneWidth = scene.getWidth();
    double regionHeight = region.getPrefHeight();
    double sceneHeight = scene.getHeight();
    if (regionWidth != -1.0) {
        ChangeListener<Number> widthResizer = (arg0, oldValue, newValue) -> region.setPrefWidth(regionWidth / sceneWidth * newValue.doubleValue());
        scene.widthProperty().addListener(widthResizer);
    }
    if (regionHeight != -1.0) {
        ChangeListener<Number> heightResizer = (arg0, oldValue, newValue) -> region.setPrefHeight(regionHeight / sceneHeight * newValue.doubleValue());
        scene.heightProperty().addListener(heightResizer);
    }
}
 
開發者ID:ciphertechsolutions,項目名稱:IO,代碼行數:15,代碼來源:BaseController.java

示例4: makeLocationScale

import javafx.scene.Scene; //導入方法依賴的package包/類
private static void makeLocationScale(Scene scene, Node node) {
    double nodeX = node.getLayoutX();
    double sceneWidth = scene.getWidth();
    double nodeY = node.getLayoutY();
    double sceneHeight = scene.getHeight();
    if (nodeX != 0.0) {
        ChangeListener<Number> xResizer = (arg0, oldValue, newValue) -> node.relocate(nodeX / sceneWidth * newValue.doubleValue(), node.getLayoutY());
        scene.widthProperty().addListener(xResizer);
    }
    if (nodeY != 0.0) {
        ChangeListener<Number> yResizer = (arg0, oldValue, newValue) -> node.relocate(node.getLayoutX(), nodeY / sceneHeight * newValue.doubleValue());
        scene.heightProperty().addListener(yResizer);
    }
}
 
開發者ID:ciphertechsolutions,項目名稱:IO,代碼行數:15,代碼來源:BaseController.java

示例5: scaleShape

import javafx.scene.Scene; //導入方法依賴的package包/類
private static void scaleShape(Scene scene, Shape shape) {
    double sceneWidth = scene.getWidth();
    double sceneHeight = scene.getHeight();
    ChangeListener<Number> widthResizer = (arg0, oldValue, newValue) -> shape.setScaleX(newValue.doubleValue() / sceneWidth);
    scene.widthProperty().addListener(widthResizer);
    ChangeListener<Number> heightResizer = (arg0, oldValue, newValue) -> shape.setScaleY(newValue.doubleValue() / sceneHeight);
    scene.heightProperty().addListener(heightResizer);

}
 
開發者ID:ciphertechsolutions,項目名稱:IO,代碼行數:10,代碼來源:BaseController.java

示例6: resetState

import javafx.scene.Scene; //導入方法依賴的package包/類
private void resetState(Scene scene) {
    Image image = new Image(pictureResourceLocation);

    double imageWidth = image.getWidth();
    double imageHeight = image.getHeight();
    double imageHeightToWidthRatio = imageHeight / imageWidth;

    double initialHeight = scene.getHeight() * pictureInitialHeightToSceneHeightRatio;
    double initialWidth = initialHeight / imageHeightToWidthRatio;

    double positionX = (scene.getWidth() - initialWidth) / 2;
    double positionY = (scene.getHeight() - initialHeight) / 2;

    setFill(new ImagePattern(image));

    setX(positionX);
    setY(positionY);
    setWidth(initialWidth);
    setHeight(initialHeight);

    setTranslateX(0);
    setScaleX(1);
    setScaleY(1);
    setScaleZ(1);

    setOpacity(0);

    toFront(); // bug when it is uncommented (with bloc at least).
}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:30,代碼來源:Bravo.java

示例7: recomputeSizeAndPosition

import javafx.scene.Scene; //導入方法依賴的package包/類
public void recomputeSizeAndPosition(Scene scene) {
    double size = scene.getWidth() / 10;

    double positionX = scene.getWidth() - (size * 1.5);
    double positionY = scene.getHeight() - (size * 1.5);

    setX(positionX);
    setY(positionY);
    setWidth(size);
    setHeight(size);
}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:12,代碼來源:CustomButton.java

示例8: computeGameSizing

import javafx.scene.Scene; //導入方法依賴的package包/類
public GameSizing computeGameSizing(Scene scene) {
    Rectangle2D bounds = new Rectangle2D(0, 0, scene.getWidth(), scene.getHeight());

    return computeGameSizing(bounds);
}
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:6,代碼來源:GameSizingComputer.java

示例9: Pictos

import javafx.scene.Scene; //導入方法依賴的package包/類
public Pictos(Scene scene) {

        this.scene = scene;

        buildPictos();

        enterEvent = buildEvent();

        currentPictos = new ArrayList<Picto>(2);

        // Picto R1 = pictos.get("compote");
        Picto R1 = pictos.get("minnie");

        Picto R2 = pictos.get("bulles");

        currentPictos.add(R1);
        currentPictos.add(R2);

        // log.info(scene.getWidth());
        // log.info(scene.getHeight());
        double imagesWidth = scene.getWidth() / 2 - min_X / 2 - sep / 2;
        double imagesHeight = scene.getHeight() - min_Y * 2;

        for (int i = 0; i < currentPictos.size(); i++) {

            Picto R = currentPictos.get(i);

            R.rectangle.setTranslateX(min_X + (sep + imagesWidth) * i);
            R.rectangle.setTranslateY(min_Y);
            R.rectangle.setWidth(imagesWidth);
            R.rectangle.setHeight(imagesHeight);
            R.rectangle.setStrokeWidth(imagesWidth * strokeFactor);

            this.getChildren().add(R.rectangle);

            GazeUtils.addEventFilter(R.rectangle);

            R.rectangle.addEventFilter(MouseEvent.ANY, enterEvent);
            R.rectangle.addEventFilter(GazeEvent.ANY, enterEvent);
        }

        /*
         * R1.setTranslateX(min_X); R1.setTranslateY(min_Y); R1.setWidth(imagesWidth); R1.setHeight(imagesHeight);
         * R1.setStrokeWidth(imagesWidth*strokeFactor);
         * 
         * this.getChildren().add(R1);
         * 
         * R2.setTranslateX(min_X + imagesWidth + sep); R2.setTranslateY(min_Y); R2.setWidth(imagesWidth);
         * R2.setHeight(imagesHeight); R2.setStrokeWidth(imagesWidth*strokeFactor);
         * 
         * this.getChildren().add(R2);
         */
        // GazeUtils.addEventFilter(R1);
        // GazeUtils.addEventFilter(R2);

        /*
         * R1.addEventFilter(MouseEvent.ANY, enterEvent); R1.addEventFilter(GazeEvent.ANY, enterEvent);
         * R2.addEventFilter(MouseEvent.ANY, enterEvent); R2.addEventFilter(GazeEvent.ANY, enterEvent);
         */
    }
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:61,代碼來源:Pictos.java

示例10: Choices

import javafx.scene.Scene; //導入方法依賴的package包/類
public Choices(Scene scene) {

        arduino = new ArduinoSerialCommunication();
        arduino.initialize();

        this.scene = scene;

        buildPictos();

        enterEvent = buildEvent();

        currentChoice = new ArrayList<Choice>(2);

        Choice R1 = choices.get("oui");

        Choice R2 = choices.get("non");

        currentChoice.add(R1);
        currentChoice.add(R2);

        double imagesWidth = scene.getWidth() / 2 - min_X / 2 - sep / 2;
        double imagesHeight = scene.getHeight() - min_Y * 2;

        for (int i = 0; i < currentChoice.size(); i++) {

            Choice R = currentChoice.get(i);

            R.rectangle.setTranslateX(min_X + (sep + imagesWidth) * i);
            R.rectangle.setTranslateY(min_Y);
            R.rectangle.setWidth(imagesWidth);
            R.rectangle.setHeight(imagesHeight);
            R.rectangle.setStrokeWidth(imagesWidth * strokeFactor);

            this.getChildren().add(R.rectangle);

            GazeUtils.addEventFilter(R.rectangle);

            R.rectangle.addEventFilter(MouseEvent.ANY, enterEvent);
            R.rectangle.addEventFilter(GazeEvent.ANY, enterEvent);
        }

    }
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:43,代碼來源:Choices.java


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