[英]How to change the icon of a javafx alert box
像這樣?
@Override
public void start(Stage stage) {
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Alert Test");
alert.setHeaderText("Hello, world!");
ImageView icon = new ImageView(new Image(String.valueOf(this.getClass().getResource("img/close-on.png"))));
icon.setFitHeight(48);
icon.setFitWidth(48);
alert.getDialogPane().setGraphic(icon);
alert.show();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.