Search code examples
gluongluon-desktop

How do you change the icon of a Gluon Desktop app?


How can I change the icon of a Gluon Desktop app? I changed the icon.png file, but that seems to only be used in the about dialog.

I'm using IntelliJ IDEA 16.


Solution

  • Application class has a postInit method you can override. Scene is passed into it. Once you get the scene you can get the stage from it and than use normal JavaFX way to set the icon.

    Stage stage = (Stage)(scene.getWindow());
    stage.getIcons().add(new Image("file:icon.png"));