13

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
Casper
  • 4,435
  • 10
  • 41
  • 72

2 Answers2

18

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);
Anshul Parashar
  • 3,096
  • 4
  • 30
  • 56
2

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

Eden Sharvit
  • 765
  • 11
  • 14