import javafx.application.Application;
import javafx.geometry.Rectangle2D;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.Scene;
import javafx.stage.Modality;
import javafx.stage.Screen;
import javafx.stage.Stage;
import javafx.stage.StageStyle;

public class FullScreenBug extends Application {

  public static void main(String[] args) {
    Application.launch(FullScreenBug.class);
  }

  @Override
  public void start(Stage primaryStage) throws Exception {
    Button root = new Button("Press to exit");

    root.setOnAction(e -> System.exit(0));

    StackPane stackPane = new StackPane(root);

    stackPane.setStyle("-fx-background-color: rgba(255, 0, 0, 0.3)");

    Stage childStage = new Stage(StageStyle.TRANSPARENT);
    Scene childScene = new Scene(stackPane);

    childScene.setFill(Color.TRANSPARENT);

    childStage.initModality(Modality.APPLICATION_MODAL);
    childStage.initOwner(primaryStage);
    childStage.setScene(childScene);

    Label label = new Label("Hello world! Hello world! Hello world!");

    label.setStyle("-fx-background-color: transparent; -fx-font-size: 50");

    primaryStage.setScene(new Scene(label, Color.BLACK));
    primaryStage.setFullScreen(true);
    primaryStage.show();

    setupStageLocation(childStage, Screen.getPrimary());

    childStage.show();
  }

  private static void setupStageLocation(Stage stage, Screen screen) {
    Rectangle2D bounds = screen.getBounds();

    stage.setX(bounds.getMinX());
    stage.setY(bounds.getMinY());
    stage.setWidth(bounds.getWidth());
    stage.setHeight(bounds.getHeight());
  }
}
