user1648411
user1648411

Reputation:

JavaFX Scene Builder: How to uncheck "Resize" option in Layout tab?

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.

enter image description here

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

Answers (2)

Eden Sharvit
Eden Sharvit

Reputation: 864

In Main.java add:
primaryStage.setResizable(false);
before the:
primaryStage.show();

Upvotes: 3

Anshul Parashar
Anshul Parashar

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

Related Questions