我尝试编写显示警告对话框的简单方法,并询问用户对我的电子邮件的反馈。
我的方法:
public static void showExceptionDialog(Exception exception) {
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
exception.printStackTrace(printWriter);
String exceptionText = stringWriter.toString();
try {
VBox content = FXMLLoader.load(Dialogs.class.getResource("/org/flycraft/minecraft/droplauncher/exception_dialog_content.fxml"));
TextArea exceptionTextArea = (TextArea) content.lookup("#exception_text_area");
exceptionTextArea.setText(exceptionText);
Alert alert = new Alert(Alert.AlertType.WARNING);
alert.setTitle("Ошибка");
alert.setHeaderText("Что-то пошло не так");
alert.getDialogPane().setContent(content);
alert.showAndWait();
} catch (IOException e) {
e.printStackTrace();
}
}
但在实际对话中,我看到:
这是一个错误,或者我不理解的东西?
答案 0 :(得分:1)
compileJava.options.encoding = 'UTF-8'