Hi I am making an app in Java but the icon in the taskbar is blurry and big unlike other applications as Android studio, Netbeans, Chrome. I am using Adobe Illustrator for making icons with size of 96x96 px. Any ideas?
Asked
Active
Viewed 379 times
2
-
Possibly a duplicate of: http://stackoverflow.com/questions/12287137/system-tray-icon-looks-distorted – Ofer Lando Jan 21 '15 at 13:40
-
1@OferLando Not a duplicate as the linked question is about system tray icon, and this question is about the taskbar icon. – icza Jan 21 '15 at 13:48
-
@icza - you are correct, of course - thanks for the correction! – Ofer Lando Jan 21 '15 at 13:51
1 Answers
2
Most likely you set the icon of your window with Window.setIconImage(Image image)
method.
Note that there is another method: Window.SetIconImages(List icons)
. Since different platforms display application icons in different sizes (and the resize algorithm is often a bad one), you should use this to supply your icon in differnet sizes, and the size which best fits into the required size will be used.
Quoting from the javadoc:
Depending on the platform capabilities one or several images of different dimensions will be used as the window's icon.
The icons list is scanned for the images of most appropriate dimensions from the beginning. If the list contains several images of the same size, the first will be used.
Example:
List<Image> icons = new ArrayList<Image>();
icons.add(new ImageIcon("icon16x16.png").getImage());
icons.add(new ImageIcon("icon32x32.png").getImage());
icons.add(new ImageIcon("icon48x48.png").getImage());
icons.add(new ImageIcon("icon64x64.png").getImage());
window.setIconImages(icons);