Package org.astrogrid.samp.gui
Class SysTray
- java.lang.Object
-
- org.astrogrid.samp.gui.SysTray
-
public abstract class SysTray extends java.lang.Object
Provides basic access to the windowing system's System Tray. This is a facade for a subset of the Java 1.6 java.awt.SystemTray functionality. When running in a J2SE1.6 JRE it will use reflection to access the underlying classes. In an earlier JRE, it will report lack of support.- Since:
- 20 Jul 2010
- Author:
- Mark Taylor
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NOTRAY_PROP
Name of system property ("jsamp.nosystray") to inhibit use of system tray; if set "true" the system tray will not be used even if it is apparently supported.
-
Constructor Summary
Constructors Constructor Description SysTray()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract java.lang.Object
addIcon(java.awt.Image im, java.lang.String tooltip, java.awt.PopupMenu popup, java.awt.event.ActionListener iconListener)
Adds an icon to the system tray.static SysTray
getInstance()
Returns an instance of this class.abstract boolean
isSupported()
Indicates whether system tray functionality is available.abstract void
removeIcon(java.lang.Object trayIcon)
Removes a previously-added icon from the tray.
-
-
-
Field Detail
-
NOTRAY_PROP
public static final java.lang.String NOTRAY_PROP
Name of system property ("jsamp.nosystray") to inhibit use of system tray; if set "true" the system tray will not be used even if it is apparently supported.- See Also:
- Constant Field Values
-
-
Method Detail
-
isSupported
public abstract boolean isSupported()
Indicates whether system tray functionality is available.- Returns:
- true iff the addIcon/removeIcon methods are expected to work
-
addIcon
public abstract java.lang.Object addIcon(java.awt.Image im, java.lang.String tooltip, java.awt.PopupMenu popup, java.awt.event.ActionListener iconListener) throws java.awt.AWTException
Adds an icon to the system tray.- Parameters:
im
- image for displaytooltip
- tooltip text, or nullpopup
- popup menu, or nulliconListener
- listener triggered when icon is activated, or null- Returns:
- tray icon object, may be used for later removal
- Throws:
java.awt.AWTException
-
removeIcon
public abstract void removeIcon(java.lang.Object trayIcon) throws java.awt.AWTException
Removes a previously-added icon from the tray.- Parameters:
trayIcon
- object obtained from a previous invocation of addIcon- Throws:
java.awt.AWTException
-
getInstance
public static SysTray getInstance()
Returns an instance of this class.- Returns:
- instance
-
-