JavaFX Scene Builder:如何在“布局”选项卡中取消选中“调整大小”选项?

时间:2014-01-09 13:13:30

标签: javafx javafx-2 scenebuilder

我想让我的.fxml应用程序无法调整大小,但我无法取消选中任何anchorPanes上的“Resizeable”复选框,该选项显示为灰色。即使在一个新的,完全空的项目中也会发生同样的事情。

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

1 个答案:

答案 0 :(得分:15)

对于调整大小功能,您需要拥有主类的阶段。初始阶段引用将使用它使其不可归类。

试试这个。

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);
相关问题