Adding an icon to a form dialog
Answered
I created a Dialog and changed the text. Now I am trying to change the icon in the header of the dialog.
So far I tried:
public CreateDialog() {
// set Title for dialog
this.setTitle("Create Class");
// set Image for dialog. Also tried .ico file
URL iconURL = getClass().getResource("/icons/logo.svg");
ImageIcon icon = new ImageIcon(iconURL);
// tried both
// this.setIconImage(icon.getImage());
this.getOwner().setIconImage(icon.getImage());
It always shows the red-blue IntelliJ icon.
When I am trying dialog.setIconImage nothing happens.
When I try dialog.getOwner().setIconImage I getting the full black IntelliJ icon, but still not mine.
Please sign in to leave a comment.
Please use DialogWrapper for showing dialogs in IDE https://plugins.jetbrains.com/docs/intellij/dialog-wrapper.html. There is no possibility to set custom icon for modal dialog.