Alberto
Alberto

Reputation: 1579

JavaFX 8 default message icons

with the last few updates of JavaFX we have alerts. I want to get the message's default icons (error, warning, ...). In Swing, I can get the L&F message icons through some UIManager's properties. How can I get the message's default icons in JavaFX? Are them contained in properties, or defined by CSS class?

enter image description here

Thanks in advance.

Upvotes: 2

Views: 1932

Answers (2)

Younes Meridji
Younes Meridji

Reputation: 309

.dialog-pane{
    -fx-graphic: url(the url of your icon) ;
}

To hide definitely the icon, put

-fx-graphic: null;

Upvotes: 0

Uluk Biy
Uluk Biy

Reputation: 49185

They are defined in modena.css as

.alert.confirmation.dialog-pane,
.text-input-dialog.dialog-pane,
.choice-dialog.dialog-pane {
    -fx-graphic: url("dialog-confirm.png");
}

.alert.information.dialog-pane {
    -fx-graphic: url("dialog-information.png");
}

.alert.error.dialog-pane {
    -fx-graphic: url("dialog-error.png");
}

.alert.warning.dialog-pane {
    -fx-graphic: url("dialog-warning.png");
}

You can override them in a regular way.

Upvotes: 6

Related Questions