Reputation:
I want to make my .fxml application to not be resizeable, but I am not able to uncheck "Resizeable" check box on any anchorPanes, the option is greyed out. The same thing happens even on a new, completely empty project.
Product Version
JavaFX Scene Builder 1.1
Build Information
Version: 1.1-b35, Changeset: 50e3d7cdf394
Date: 2013-08-27 10:45
Upvotes: 13
Views: 26825
Reputation: 864
In Main.java add:
primaryStage.setResizable(false);
before the:
primaryStage.show();
Upvotes: 3
Reputation: 3126
For resize functionality,you need to have stage of main class. initial stage reference will use it for make it non -resizable.
Try this.
MainClass.java
public class MainClass extends Application {
public static Stage stage;
@Override
public void start(Stage stage) throws Exception {
this.stage = stage; // initialize value of stage.
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
SampleController
MainClass.stage.setResizable(false);
Upvotes: 18