'Change default locale language in JavaFx Alert
I am fairly new to Java and JavaFX. I am writing a program where it will recognize the default locale from the users location. I have been able to get the normal buttons and text to change to the default lang when I test it for French and English, but cant find a resource on how to change it for the Alert Confirmation below. Your help is appreciated.
@FXML
private void handleExit(ActionEvent event) {
Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
alert.setTitle("Exit");
alert.setHeaderText("Do you wish to exit the program?");
alert.showAndWait()
.filter(response -> response == ButtonType.OK)
.ifPresent((ButtonType response) -> {
Platform.exit();
System.exit(0);
}
);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
