views:

70

answers:

1

Hi,

i have to detect the position of the systemTray with java. I already placed an icon in the tray but don't know if its possible to get the position of that icon?

Best regards

Hemeroc

A: 

No, the API does not offer that functionality. Why do you think you need that, anyway What are you actually trying to achieve?

Michael Borgwardt
I know that there is no API function to do that, thats why I'm asking for a "hack".There is a bug with transparent icons in linux: if you place a transparent icon in the system tray it will get a gray background. So I'll try to detect the color of the systen tray and set the backgroundcolor of the icon to the system tray color.Example: http://media.ubuntuusers.de/forum/attachments/1512816/Bildschirmfoto-1.png
Hemeroc
There is also a bug-report about that problem: http://bugs.sun.com/view_bug.do?bug_id=6453521 (It's not solved since 2006!)
Hemeroc
@Hemeroc: well, you could use java.awt.Robot do make screenshots and try to find the system tray. But I think it would be much more useful to try and get that bug fixed rather than building a complex workaround. And who says the system tray background is a single color?
Michael Borgwardt
a more actual usage for this would be what i once encountered.. i had a window minimize to the system tray in an animated way. Of course you need to know the location of the system tray for that. I couldn't find a solution so i simply opted for bottom-right of the screen as this would cover 90% of the cases... I would love to see if a solution is found though...
Savvas Dalkitsis