import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.layout.VBox; import javafx.stage.Modality; import javafx.stage.Stage; public class MsgBox { public static void show(String title, String msg) { Stage stage = new Stage(); stage.initModality(Modality.APPLICATION_MODAL); stage.setTitle(title); Label label = new Label(msg); Button button = new Button("Bezár"); button.setOnAction(e -> stage.close()); VBox vbox = new VBox(); vbox.getChildren().addAll(label, button); vbox.setAlignment(Pos.CENTER); Scene scene = new Scene(vbox, 300, 250); stage.setScene(scene); stage.show(); } }