import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.event.EventType;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.stage.Modality;
import javafx.stage.Stage;

public class RT40798c extends Application {
    Stage modalStage;

    @Override
    public void start(Stage stage) throws Exception {
        Button button = new Button("hello");
        stage.setScene(new Scene(button));
        stage.setResizable(true);
        stage.sizeToScene();
        stage.show();

        button.setOnAction(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent event) {
                modalStage.show();
            }
        });

        // changing initStyle has not effect
        
        modalStage = new Stage();

        // if initOwner is set tp stage AND WINDOW_MODAL iset, then stage is not
        // resizable when modelStage is closed. If WINDOW_MODAL is set on its
        // own then stage is resizable when modalStage is closed.

        modalStage.initOwner(stage);
        modalStage.initModality(Modality.WINDOW_MODAL);

        // if APPLICATION_MODAL is set then stage is not resizable when
        // modelStage is closed
        //modalStage.initModality(Modality.APPLICATION_MODAL);

        modalStage.setScene(new Scene(new Button("modal hello")));
        modalStage.sizeToScene();

        // delay show to the button so we can check resize before and after
        //modalStage.show();
    }
} 
