I am developing an application that should have a custom icon. The provided icon is the same for all sizes (256x256, 48x48, 32x32), except for 16x16, where the icon is simplified.
I was thinking of the .ico format (where I can store all the differents icons and let the OS show the best), but it does not seem to be supported by javafx.scene.image (I did not find confirmation about this).
This is how I set the icon
stage.getIcons().add(new Image(getClass().getResourceAsStream("/path/to/icon.ico")));
In this case, the icon is never displayed. If I convert this icon to a .png image, it works, but it always displays the same icon (even in 16x16).
Is there a way in JavaFX 2.2 to display .ico (even in a hacked way) or do I need to use other image formats?
Update
I split my .ico into several pngs (one for each size) and then downloaded them one at a time.
stage.getIcons().add(new Image(getClass().getResourceAsStream("/path/to/icon_16x16.png"))); stage.getIcons().add(new Image(getClass().getResourceAsStream("/path/to/icon_256x256.png")));
256x256 and 16x16 are two different images, but 16x16 is never displayed in the upper left corner of the application (despite the fact that this is the closest size).
source share