これは、JavaFX 8.0(現在のJava 8.0 EAPリリースで利用可能)で修正されたStageクラスのバグです。
resizablePropertyは、双方向にバインドされたときに実際に正しく設定されることに注意してください。設定値は効果がないだけです。
私のテスト:
import javafx.application.Application;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class StageResizableTest extends Application{
public static void main(String[] args) {
launch(args);
}
@Override
public void start(final Stage stage) throws Exception {
Button button = new Button("resize");
button.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
stage.setResizable(true);
}
});
Button button2 = new Button("not resize");
button2.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
stage.setResizable(false);
}
});
CheckBox checkBox = new CheckBox("Resizable");
checkBox.selectedProperty().bindBidirectional(stage.resizableProperty());
checkBox.selectedProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observableValue, Boolean aBoolean, Boolean aBoolean2) {
System.out.println("checkbox changed from "+aBoolean+" to "+aBoolean2);
}
});
stage.resizableProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observableValue, Boolean aBoolean, Boolean aBoolean2) {
System.out.println("stage resizable changed from "+aBoolean+" to "+aBoolean2);
}
});
Button button3 = new Button("request stage resizable");
button3.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
System.out.println(stage.resizableProperty().get());
}
});
VBox box = new VBox();
box.getChildren().addAll(checkBox, button, button2, button3);
Scene scene = new Scene(box, 500, 500);
stage.setScene(scene);
stage.show();
}
}