Show an error message to the user @param header The content of the header @param content The content of the error message @param imageStream The InputStream object that contains the image for the Alert object
(final String header, final String content, final InputStream imageStream)
| 65 | * @param imageStream The {@link InputStream} object that contains the image for the {@link Alert} object |
| 66 | */ |
| 67 | public static void showErrorAlert(final String header, final String content, final InputStream imageStream) { |
| 68 | if (header == null) |
| 69 | throw new NullPointerException("Header cannot be null!"); |
| 70 | if (content == null) |
| 71 | throw new NullPointerException("Content cannot be null!"); |
| 72 | |
| 73 | final Alert alert = getErrorAlert(content); |
| 74 | alert.setHeaderText(header); |
| 75 | |
| 76 | final Stage stage = (Stage) alert.getDialogPane().getScene().getWindow(); |
| 77 | |
| 78 | if (imageStream != null) { |
| 79 | stage.getIcons().add(new Image(imageStream)); |
| 80 | } |
| 81 | |
| 82 | alert.showAndWait(); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Generate a new error {@link Alert} object |
no test coverage detected