I have an application that runs on Windows (great) and Ubuntu 12.04 (facing a couple interface issues). First, I have this code below to implement a TrayIcon:
if (SystemTray.isSupported()) {
// Get the SystemTray instance
SystemTray tray = SystemTray.getSystemTray();
// Load icon
java.awt.Image image = null;
try {
image = ImageIO.read(getClass().getResource("icon.png"));
} catch (IOException exc) {
exc.printStackTrace();
}
/**
* A few listeners to popup menu items click.
*/
// Create a popup menu and its items
PopupMenu popup = new PopupMenu();
MenuItem openItem = new MenuItem("Open");
openItem.addActionListener(openListener);
popup.add(openItem);
popup.addSeparator();
MenuItem closeItem = new MenuItem("Close");
closeItem.addActionListener(closeListener);
popup.add(closeItem);
trayIcon = new TrayIcon(image, "app test", popup);
try {
tray.add(trayIcon);
} catch (AWTException exc) {
exc.printStaceTrack();
}
}
This png icon is has a transparent backgrond. As I said, works fine on Windows. But on Linux it gets a white background. Also, when mouse is over its icon, a label (not tooltip) "JavaEmbeddedFrame" is shown.
My .desktop file (in /usr/share/application) is set as:
[Desktop Entry]
Encoding=UTF-8
Name=appTest
GenericName=appTest
Comment=Testing
Exec=/bin/sh "/usr/share/appTest/test.sh"
Icon=/usr/share/appTest/icon.png
Terminal=false
Type=Application
StartupNotify=true
When ALT+TAB, it isn't show "appTest" but "Java" with my application icon and a default Java icon (like another window) with "java.lang.Thread" description.
Any ideas of how to fix it? Thanks in advance!