Why disabling of stage resizable dont work in javafx?
Asked Answered
C

3

5

When I try to setResizable for my scene in javaFX application it doesn't work. I still can change window size. Here's 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);

}

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

Chiropody answered 23/7, 2013 at 17:10 Comment(2)
I have the same problem, Ian did you find the solution? I'm using windows 10Mcclure
Works for me on Windows 10 and JDK 1.8.0_77Paiz
C
4

This works fine on Windows with JDK 1.7.0_25.

Maybe your problem comes from the fact that you are running your application on a Linux system (even if Ubuntu 13.04 is listed as a supported OS...) The Linux support is recent and some bugs might persist.

Callous answered 24/7, 2013 at 15:21 Comment(1)
I tested the same application on another computer with windows 7 and everything is ok. You're right, it has to be a bug in Ubuntu. Thx for help.Chiropody
A
3
    stage.setMaxWidth(300);        
    stage.setMaxHeight(200);

It prevents from picking window on bounds, but not from clicking window fullscreen button, I didn't realize howto.

Astylar answered 4/4, 2014 at 18:7 Comment(0)
D
0

It's not a bug. It depends on your Operating System's system or window manager. Generally, you either need to put stage.setResizable(false); before or after stage.show().

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

stage.setMaxWidth(400);        
stage.setMaxHeight(400);
Dud answered 10/7, 2019 at 22:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.