import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

public class HelloFX extends Application {

    private Stage stage;

    @Override
    public void start(Stage stage) {
        this.stage = stage;
        String javaVersion = System.getProperty("java.version");
        String javafxVersion = System.getProperty("javafx.version");
        StackPane layout = new StackPane();
        StackPane layout2 = new StackPane();
        layout.getChildren().add(layout2);
        layout.getChildren().add(new Label("Hello, JavaFX " + javafxVersion + ", running on Java " + javaVersion + "."));
        
        BackgroundFill bf = new BackgroundFill(Color.valueOf("#f00"), new CornerRadii(8), Insets.EMPTY);
        layout2.setBackground(new Background(bf));
        layout2.setMinHeight(500);
        layout2.setMaxHeight(500);
        layout2.setMinWidth(500);
        layout2.setMaxWidth(500);
        Scene scene = new Scene(layout, 500, 500);
        stage.setScene(scene);
        stage.setMinWidth(500);
        stage.minHeightProperty().bind(stage.heightProperty().subtract(scene.heightProperty()).add(500));
        stage.show();
    }

    public static void main(String[] args) {
        launch();
    }
}