|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jeans.trayicon.WindowsTrayIcon
WindowsTrayIcon A Java Implementation for showing icons in the Windows System Tray Written by Jan Struyf (jan.struyf@cs.kuleuven.ac.be) (http://ace.ulyssis.org/~jeans) Instantiate this class for each icon This file comes with native code in TRAYICON.DLL The DLL should go in C:/WINDOWS/SYSTEM or in your current directory
| Field Summary | |
static int |
BALLOON_ERROR
|
static int |
BALLOON_INFO
|
static int |
BALLOON_NONE
|
static int |
BALLOON_NOSOUND
|
static int |
BALLOON_WARNING
|
static int |
DLLNOTFOUND
|
static int |
ERRTHREAD
|
static int |
JNIERR
|
static int |
METHODID
|
static int |
NOERR
|
static int |
NOLISTENER
|
static int |
NOTENOUGHMEM
|
static int |
NOTIFYPROCERR
|
static int |
NOVMS
|
static int |
TOOMANYICONS
|
static java.lang.String |
TRAY_VERSION
|
static int |
WIN_VER_2K
|
static int |
WIN_VER_95
|
static int |
WIN_VER_98
|
static int |
WIN_VER_ME
|
static int |
WIN_VER_NET
|
static int |
WIN_VER_NT
|
static int |
WIN_VER_UNKNOWN
|
static int |
WIN_VER_WIN32
|
static int |
WIN_VER_XP
|
static int |
WRONGICONID
|
| Constructor Summary | |
WindowsTrayIcon(java.awt.Image image,
int w,
int h)
Construct a new Tray Icon Using a Java Image - This can be loaded from a 16x16 GIF or JPG file Param image 16x16 icon - make sure it's loaded in memory - use MediaTracker Param w the icon width - eg. |
|
| Method Summary | |
void |
addActionListener(java.awt.event.ActionListener listener)
Add an ActionLister to this icon Just like with java.awt.Button or javax.swing.JButton Param listener = your listener |
void |
addMouseListener(java.awt.event.MouseListener listener)
|
static void |
cleanUp()
Free all native resources - call this method before System.exit() |
void |
freeIcon()
Free all native resources for this icon On exit use cleanUp() |
static java.awt.Window |
getCurrentWindow()
|
static TrayDummyComponent |
getDummyComponent()
|
static int |
getLastError()
Return error code from native library - use for debugging |
static int |
getWindowsVersion()
|
static java.lang.String |
getWindowsVersionString()
|
static void |
initHook()
|
static void |
initJAWT()
|
static void |
initTrayIcon(java.lang.String appName)
Init native library - call this method in the main() method of your app Param appName = the title for the hidden window Each app has it's own hidden window that receives the mouse/menu messages for it's Tray Icons The window title is used by sendWindowsMessage() and isRunning() to identify an app |
static boolean |
isRunning(java.lang.String appName)
Checks if there's an instance with hidden window title = appName running Can be used to detect that another instance of your app is already running (so exit..) Param appName = the title of the hidden window to search for |
boolean |
isVisible()
Test if this icon is currently visible in the Windows System Tray Returns true if visible |
static void |
keepAlive()
Keep TrayIcon alive (make sure application does not exit) |
void |
removeActionListener(java.awt.event.ActionListener listener)
|
void |
removeMouseListener(java.awt.event.MouseListener listener)
|
static int |
sendWindowsMessage(java.lang.String appName,
int message)
Send a message to another app (message can contain an integer) Can be used to detect that another instance of your app is already running That instance can for example restore it's window after it receives the windows message - see demo app for more info Param appName = the title of the hidden window to search for Param message = the integer message to send (only native int size supported) |
static void |
setAlwaysOnTop(java.awt.Component wnd,
boolean onTop)
|
static void |
setCurrentWindow(java.awt.Window wnd)
|
void |
setImage(java.awt.Image image,
int w,
int h)
Change this icon's Image Using a Java Image - This can be loaded from a 16x16 GIF or JPG file Param image 16x16 icon - make sure it's loaded in memory - use MediaTracker Param w the icon width Param h the icon height Exception TrayIconException - if something goes wrong :O( - Error loading icon image Exception InterruptedException - if the thread loading the image is interrupted |
static void |
setMouseClickHook(java.awt.event.MouseListener listener)
|
static void |
setMouseHookEnabled(int enable)
|
void |
setPopup(TrayIconPopup popup)
Set new popup menu The popup menu is displayed when the user right clicks the icon See class TrayIconPopup, TrayIconPopupSimpleItem, .. |
void |
setToolTipText(java.lang.String tip)
Changes the text for the ToolTip of this icon The ToolTip is displayed when the user mouses over the icon Param tip = the new text for the ToolTip |
void |
setVisible(boolean status)
Show/Hide this icon in the Windows System Tray Param status true = show, false = hide |
static void |
setWindowsMessageCallback(TrayIconCallback callback)
Set callback method for receiving windows messages See sendWindowsMessage() for more information or take a look at the demo app Param callback = the callback method for this app |
void |
showBalloon(java.lang.String msg,
java.lang.String title,
int timeout,
int flags)
|
static boolean |
supportsBallonInfo()
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String TRAY_VERSION
public static final int BALLOON_NONE
public static final int BALLOON_INFO
public static final int BALLOON_WARNING
public static final int BALLOON_ERROR
public static final int BALLOON_NOSOUND
public static final int NOERR
public static final int NOTIFYPROCERR
public static final int TOOMANYICONS
public static final int NOTENOUGHMEM
public static final int WRONGICONID
public static final int DLLNOTFOUND
public static final int NOVMS
public static final int ERRTHREAD
public static final int METHODID
public static final int NOLISTENER
public static final int JNIERR
public static final int WIN_VER_UNKNOWN
public static final int WIN_VER_WIN32
public static final int WIN_VER_95
public static final int WIN_VER_98
public static final int WIN_VER_ME
public static final int WIN_VER_NT
public static final int WIN_VER_2K
public static final int WIN_VER_XP
public static final int WIN_VER_NET
| Constructor Detail |
public WindowsTrayIcon(java.awt.Image image,
int w,
int h)
throws TrayIconException,
java.lang.InterruptedException
| Method Detail |
public static void initTrayIcon(java.lang.String appName)
public static void cleanUp()
public void setImage(java.awt.Image image,
int w,
int h)
throws TrayIconException,
java.lang.InterruptedException
TrayIconException
java.lang.InterruptedExceptionpublic void setVisible(boolean status)
public boolean isVisible()
public void setToolTipText(java.lang.String tip)
public void showBalloon(java.lang.String msg,
java.lang.String title,
int timeout,
int flags)
public void addActionListener(java.awt.event.ActionListener listener)
public void removeActionListener(java.awt.event.ActionListener listener)
public void addMouseListener(java.awt.event.MouseListener listener)
public void removeMouseListener(java.awt.event.MouseListener listener)
public void setPopup(TrayIconPopup popup)
public void freeIcon()
public static void setAlwaysOnTop(java.awt.Component wnd,
boolean onTop)
public static int getLastError()
public static boolean isRunning(java.lang.String appName)
public static int sendWindowsMessage(java.lang.String appName,
int message)
public static void setWindowsMessageCallback(TrayIconCallback callback)
public static void keepAlive()
public static void setCurrentWindow(java.awt.Window wnd)
public static java.lang.String getWindowsVersionString()
public static int getWindowsVersion()
public static boolean supportsBallonInfo()
public static TrayDummyComponent getDummyComponent()
public static void initJAWT()
public static void initHook()
public static void setMouseHookEnabled(int enable)
public static void setMouseClickHook(java.awt.event.MouseListener listener)
public static java.awt.Window getCurrentWindow()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||