문제

Here's my snippet:

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);
        }
}

When running the gui doesn't show properly: the frame size is smaller than the button. Why does it happens? In HBox Layout when setting the scene it is automatically resized, so why with MiGLayout it doesn't work?

I'm using MigLayout 4.3

도움이 되었습니까?

해결책

So, I filed an issue and later found out a workaround for this: just add stage.sizeToScene() after stage.show().

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top