Dae galera!! Tava dando uma testada na biblioteca JDIC (JDesktop Integration Components) (https://jdic.dev.java.net/), e achei um
exemplo na net, baixei e adicionei esse jar no eclipse jdic.jar, só que quando eu rodo esse exemplo, dá as seguintes mensagens:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no tray in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at org.jdesktop.jdic.tray.internal.impl.DisplayThread.<clinit>(Unknown Source)
at org.jdesktop.jdic.tray.internal.impl.WinSystemTrayService.<clinit>(Unknown Source)
at org.jdesktop.jdic.tray.internal.impl.ServiceManagerStub.getService(Unknown Source)
at org.jdesktop.jdic.tray.internal.ServiceManager.getService(Unknown Source)
at org.jdesktop.jdic.tray.SystemTray.<clinit>(Unknown Source)
at tray.TryTeste.<init>(TryTeste.java:38)
at tray.TryTeste.main(TryTeste.java:43)
Exception in thread "Thread-2" java.lang.UnsatisfiedLinkError: removeIcon
at org.jdesktop.jdic.tray.internal.impl.WinTrayIconService.removeIcon(Native Method)
at org.jdesktop.jdic.tray.internal.impl.WinTrayIconService.removeAllIcons(Unknown Source)
at org.jdesktop.jdic.tray.internal.impl.WinTrayIconService$1.run(Unknown Source)
O fonte que eu to usando é esse:
package tray.teste;
import java.awt.event.*;
import javax.swing.*;
import org.jdesktop.jdic.tray.TrayIcon;
import org.jdesktop.jdic.tray.SystemTray;
public class TrayTeste {
public static JMenuItem quit;
public TrayTeste() {
JPopupMenu menu = new JPopupMenu("Tray Icon Menu");
menu.add(new JMenuItem("Test Item"));
menu.addSeparator();
JMenuItem quitItem = new JMenuItem("Quit");
quitItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
System.exit(0);
}});
menu.add(quitItem);
// O arquivo “devmedia.gif” deve existir no mesmo diretório
// onde estiver esta classe.
ImageIcon icon = new ImageIcon("eletric.gif");
TrayIcon ti = new TrayIcon(icon, "JDIC Tray Icon API Test", menu);
// Ação para clique com botão esquerdo.
ti.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JOptionPane.showMessageDialog(null,
"JDIC Tray Icon API Test!", "About",
JOptionPane.INFORMATION_MESSAGE);
}
});
SystemTray tray = SystemTray.getDefaultSystemTray();
tray.addTrayIcon(ti);
}
public static void main(String[] args) {
new TrayTeste();
}
}
Alguém sabe do que se trata?
Valeu!!!