【发布时间】:2013-12-21 14:26:52
【问题描述】:
这是我的 sn-p:
package javafxdemo;
import org.tbee.javafx.scene.layout.MigPane;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Stage;
public class FXDemo extends Application {
@Override
public void start (Stage stage) throws Exception {
MigPane root = new MigPane();
Scene scene = new Scene(root);
Button b = new Button("Hello");
root.getChildren().add(b);
stage.setScene(scene);
stage.setTitle("FX");
stage.show();
}
public static void main (String[] args) {
launch (args);
}
}
运行时 gui 无法正确显示:框架尺寸小于按钮。为什么会发生? HBox Layout在设置场景的时候会自动调整大小,为什么用MiGLayout就不行呢?
我正在使用 MigLayout 4.3
【问题讨论】:
-
我自己也遇到过类似的 MigPane 问题。似乎 MigPane 打破了一些常见的约定。我不得不改用 GridPane。好消息是 GridPane 比 GridBag 更容易使用,实际上与 MigPane 相差不远。
标签: java user-interface javafx miglayout