/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package id.amigogroup.posterminal.util; import javafx.scene.control.Alert; import javafx.scene.control.ButtonBar.ButtonData; import javafx.scene.control.ButtonType; import javafx.scene.image.Image; import javafx.scene.image.ImageView; /** * * @author ronal */ public class AlertUtil { public static final String ERROR_TIDAK_DITEMUKAN_TITLE = "Error: Data Tidak Ditemukan"; public static final String ERROR_TIDAK_TERDUGA_TITLE = "Error: Terjadi Kesalahan"; public static final String ERROR_TIDAK_TERDUGA_MESSAGE = "Terjadi kesalahan yang tidak terduga."; public static final String ERROR_KONEKSI_TIMEOUT_TITLE = "Error: Timeout - Koneksi Gagal"; public static final String ERROR_KONEKSI_TIMEOUT_MESSAGE = "Koneksi ke server mengalami kegagalan."; public static final String ERROR_TIDAK_LENGKAP_TITLE = "Error: Data Tidak Lengkap"; public static Alert getAlertWarning(String title, String message){ Alert alert = new Alert(Alert.AlertType.WARNING, message, ButtonType.OK); alert.setTitle(title); alert.setHeaderText(null); return alert; } public static Alert getAlertError(String title, String message){ Alert alert = new Alert(Alert.AlertType.ERROR, message, ButtonType.OK); alert.setTitle(title); alert.setHeaderText(null); return alert; } public static Alert getAlertUlangTahun(String nama) { Alert alert = new Alert(Alert.AlertType.INFORMATION); Image image = new Image("/assets/birthday.png"); ImageView imageView = new ImageView(image); imageView.setFitHeight(100); imageView.setFitWidth(100); alert.setGraphic(imageView); alert.setTitle("Selamat Ulang Tahun"); alert.setHeaderText(null); alert.setContentText("Selamat Ulang Tahun " + nama); return alert; } }