JavaFX更改警报对话框按钮的文本

时间:2016-05-17 04:14:26

标签: java intellij-idea javafx

public void PersianStandardDialog(String title,String header,String context) {
    Alert alert = new Alert(Alert.AlertType.INFORMATION);
    alert.setTitle(title);
    alert.setHeaderText(header);
    alert.setContentText(context);

    Scene scene = alert.getDialogPane().getScene();
    scene.setNodeOrientation(NodeOrientation.RIGHT_TO_LEFT);
    Stage standarddialogStage = (Stage) alert.getDialogPane().getScene().getWindow();

    Button okButton = (Button) alert.getDialogPane().lookupButton( ButtonType.OK );
    okButton.setText("Accept.");

    // Add a custom icon.
    standarddialogStage.getIcons().add(new Image("file:resources/images/calendar.png"));

    alert.showAndWait();
}

一切都很好,但是当我想使用Unicode字符时,结果是'????' 。我该如何解决这个问题?

0 个答案:

没有答案