JavaFX fullscreen - resizing elements based upon screen size

后端 未结 3 1577
情歌与酒
情歌与酒 2020-11-29 05:15

Is there any way to make fullscreen(and if possible resizing too) to instead of rearranging everything (actually what it does is to rearrange the elements like resizing but

3条回答
  •  爱一瞬间的悲伤
    2020-11-29 05:36

    You may copy this into JavaFXApplication

    Dimension resolution = Toolkit.getDefaultToolkit().getScreenSize();
    double width = resolution.getWidth();
    double height = resolution.getHeight(); 
    double w = width/1280;  // your window width
    double h = height/720;  // your window height
    Scale scale = new Scale(w, h, 0, 0);
    root.getTransforms().add(scale);
    

提交回复
热议问题