JavaFX: Why does stage.setResizable(false) cause additional margins?

前端 未结 3 1725
情深已故
情深已故 2020-12-05 00:53

This small JavaFX test application

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.sce         


        
3条回答
  •  [愿得一人]
    2020-12-05 01:32

    As already commented, this different behaviour of !/resizable smells like a bug (somebody might consider filing an issue ;-)

    A shorter (than sizing manually) way around is to explicitly fit the stage to the scene:

    primaryStage.setScene(scene);
    primaryStage.setResizable(false);
    primaryStage.sizeToScene();
    

    Just noticed that this works for jdk8, but not jdk7.

    For convenience, a bug update: the original report filed by jewelsea was closed as a duplicate of (in new coordinates) https://bugs.openjdk.java.net/browse/JDK-8089008 - still open, commented to be win-only.

提交回复
热议问题