Aplikasi POS Amigo, dibangun dengan JavaFX dengan Maven
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

53 行
2.0 KiB

  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package id.amigogroup.posterminal.util;
  7. import javafx.scene.control.Alert;
  8. import javafx.scene.control.ButtonBar.ButtonData;
  9. import javafx.scene.control.ButtonType;
  10. import javafx.scene.image.Image;
  11. import javafx.scene.image.ImageView;
  12. /**
  13. *
  14. * @author ronal
  15. */
  16. public class AlertUtil {
  17. public static final String ERROR_TIDAK_DITEMUKAN_TITLE = "Error: Data Tidak Ditemukan";
  18. public static final String ERROR_TIDAK_TERDUGA_TITLE = "Error: Terjadi Kesalahan";
  19. public static final String ERROR_TIDAK_TERDUGA_MESSAGE = "Terjadi kesalahan yang tidak terduga.";
  20. public static final String ERROR_KONEKSI_TIMEOUT_TITLE = "Error: Timeout - Koneksi Gagal";
  21. public static final String ERROR_KONEKSI_TIMEOUT_MESSAGE = "Koneksi ke server mengalami kegagalan.";
  22. public static final String ERROR_TIDAK_LENGKAP_TITLE = "Error: Data Tidak Lengkap";
  23. public static Alert getAlertWarning(String title, String message){
  24. Alert alert = new Alert(Alert.AlertType.WARNING, message, ButtonType.OK);
  25. alert.setTitle(title);
  26. alert.setHeaderText(null);
  27. return alert;
  28. }
  29. public static Alert getAlertError(String title, String message){
  30. Alert alert = new Alert(Alert.AlertType.ERROR, message, ButtonType.OK);
  31. alert.setTitle(title);
  32. alert.setHeaderText(null);
  33. return alert;
  34. }
  35. public static Alert getAlertUlangTahun(String nama) {
  36. Alert alert = new Alert(Alert.AlertType.INFORMATION);
  37. Image image = new Image("/assets/birthday.png");
  38. ImageView imageView = new ImageView(image);
  39. imageView.setFitHeight(100);
  40. imageView.setFitWidth(100);
  41. alert.setGraphic(imageView);
  42. alert.setTitle("Selamat Ulang Tahun");
  43. alert.setHeaderText(null);
  44. alert.setContentText("Selamat Ulang Tahun " + nama);
  45. return alert;
  46. }
  47. }