Advertisement
Guest User

Untitled

a guest
May 21st, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import javafx.geometry.Pos;
  2. import javafx.scene.Scene;
  3. import javafx.scene.control.Button;
  4. import javafx.scene.control.Label;
  5. import javafx.scene.layout.VBox;
  6. import javafx.stage.Modality;
  7. import javafx.stage.Stage;
  8.  
  9. public class AlertBox
  10. {
  11. public void display(String poruka, String naslov)
  12. {
  13. Stage abox = new Stage();
  14. abox.setTitle(naslov);
  15. abox.setMinHeight(250);
  16. abox.setMinWidth(250);
  17.  
  18. abox.initModality(Modality.APPLICATION_MODAL);
  19.  
  20. Label prk = new Label(poruka);
  21.  
  22. Button button = new Button("Zatvori prozor");
  23.  
  24. button.setOnAction(e -> abox.close());
  25.  
  26. VBox layout = new VBox();
  27.  
  28. layout.getChildren().addAll(prk, button);
  29. layout.setAlignment(Pos.CENTER);
  30.  
  31. Scene scene = new Scene(layout , 250, 250);
  32.  
  33. abox.setScene(scene);
  34. abox.showAndWait();
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement