Package org.astrogrid.samp.gui
Class SysTray
java.lang.Object
org.astrogrid.samp.gui.SysTray
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
FieldsModifier and TypeFieldDescriptionstatic final String
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 -
Method Summary
Modifier and TypeMethodDescriptionabstract Object
addIcon
(Image im, String tooltip, PopupMenu popup, ActionListener iconListener) Adds an icon to the system tray.static SysTray
Returns an instance of this class.abstract boolean
Indicates whether system tray functionality is available.abstract void
removeIcon
(Object trayIcon) Removes a previously-added icon from the tray.
-
Field Details
-
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:
-
-
Constructor Details
-
SysTray
public SysTray()
-
-
Method Details
-
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 Object addIcon(Image im, String tooltip, PopupMenu popup, ActionListener iconListener) throws 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:
AWTException
-
removeIcon
Removes a previously-added icon from the tray.- Parameters:
trayIcon
- object obtained from a previous invocation of addIcon- Throws:
AWTException
-
getInstance
Returns an instance of this class.- Returns:
- instance
-