Why disable scene resizing not working in javafx?

When I try to execute setResizable for my scene in a javaFX application, it does not work. I can still resize the window. Here is the code for my test application:

 @Override public void start(Stage stage) throws Exception { // TODO Auto-generated method stub stage.setTitle("Test window"); stage.setWidth(300); stage.setHeight(200); stage.setResizable(false); stage.show(); } public static void main(String[] args) { // TODO Auto-generated method stub Application.launch(args); } 

Maybe I missed something very simple because I am very new to JavaFX. Can someone help me? I am using Eclipse 4.3 and JavaSDK 7u25 on Ubuntu 13.04 64bit

+5
source share
3 answers

This works fine on Windows with JDK 1.7.0_25.

Perhaps your problem is that you are using your application on a Linux system (even if Ubuntu 13.04 is listed as a supported OS ...) Linux support recently, and some errors may persist.

+4
source
  stage.setMaxWidth(300); stage.setMaxHeight(200); 

This prevents the selection of the window at the borders, but not from pressing the button of the full-screen window window, I did not understand how to do this.

+3
source

This is not a bug. It depends on your operating system or window manager. Typically, you need to either set stage.setResizable(false); before or after stage.show() .

Although the above solution works in most cases, sometimes you have to set the maximum height and width of your scene:

 stage.setMaxWidth(400); stage.setMaxHeight(400); 
0
source

Source: https://habr.com/ru/post/1493012/


All Articles