当前位置: 首页>>代码示例>>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;未经允许,请勿转载。