How can I set program icon to alert without using alert.initOwner()
?
Why without initOwner
? It\'s because some alert must be shown before whole win
public class AlertWithIcon
extends Application {
@Override
public void start(Stage stage) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION,
"Are you sure you want to delete this item?",
ButtonType.YES, ButtonType.NO);
alert.setHeaderText("Delete Item");
((Stage)alert.getDialogPane().getScene().getWindow()).getIcons().add(new image("GenericApp.png"));
alert.showAndWait();
}
}