Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PNG TrayIcon transparency on Windows

I'm trying to use a transparent PNG as the icon for my Java application. The image on the JFrame and task bar work great. However, when I use the image with a TrayIcon, I get a black matte background around the edge of the PNG.

Has anybody else come across this issue? I would really like to use a PNG instead of GIF or JPEG.

like image 209
Gavin Vickery Avatar asked Dec 22 '08 23:12

Gavin Vickery


1 Answers

With Java6, a PNG picture should be used for TrayIcon, but as mentioned in this SO question, check:

  • the background color chosen to represent the transparent pixels
  • the transparency options
  • the resolution of the icon
  • alternate format like SVG (provided you are using external library like Batik, and conversion mechnism to java.awt.Image)
like image 154
VonC Avatar answered Oct 08 '22 23:10

VonC