1 20 21 22 27 package org.jdesktop.jdic.tray.internal.impl; 28 29 30 import org.jdesktop.jdic.tray.internal.SystemTrayService; 31 import org.jdesktop.jdic.tray.internal.TrayIconService; 32 import org.jdesktop.jdic.tray.SystemTray; 33 import org.jdesktop.jdic.tray.TrayIcon; 34 import java.awt.Toolkit ; 35 import sun.awt.EmbeddedFrame; 36 37 38 public class GnomeSystemTrayService implements SystemTrayService { 39 40 public GnomeSystemTrayService() {} 41 42 public void addNotify() {} 43 44 public void addTrayIcon(TrayIcon ti, TrayIconService tis, int trayIndex) { 45 tis.addNotify(); 46 } 47 48 50 public void removeTrayIcon(TrayIcon ti, TrayIconService tis, int trayIndex) { 51 ((GnomeTrayIconService)tis).remove(); 52 } 53 54 56 static native boolean locateSystemTray(); 57 static Thread display_thread; 58 59 static native void eventLoop(); 60 61 static { 62 Toolkit t = Toolkit.getDefaultToolkit(); 66 67 t.sync(); 68 69 System.loadLibrary("tray"); 70 GnomeSystemTrayService.initNative(System.getProperty("java.home")); 71 if (!locateSystemTray()) { 72 throw new Error ("System Tray not Found !"); 73 } 74 75 display_thread = new Thread (new Runnable () { 76 public void run() { 77 eventLoop(); 78 } 79 }); 80 display_thread.setDaemon(true); 81 82 display_thread.start(); 83 84 } 85 86 static native void dockWindow(long window); 87 static native void initNative(String javaHome); 88 89 } 90 | Popular Tags |