Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Proper way to set an icon for the main application window (Stage) on Mac

ytwSep 25 2012 — edited Sep 26 2012
Hello,

I have a question about how to set an icon for the main application window (Stage) on Mac.
Currently, I'm using the code below to set an icon from a PNG file.
Stage primaryStage = new Stage(StageStyle.DECORATED);
primaryStage.getIcons().add(new Image(MainApplication.class.getResourceAsStream("/images/app_logo_32x32.png")));
This works most of the time.
However, sometimes when I start the application, the icon displayed near the center of the 'title bar' of the window is 'smeared' or 'fuzzy'.
The same code works fine all the time on Windows.
Has anyone one seen this issue and know how to fix it?

Thanks very much.

My environment:
Mac OS X 10.8.2 Mountain Lion
Java SE 7 1.7.0_06
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 24 2012
Added on Sep 25 2012
2 comments
1,806 views