Package org.astrogrid.samp.gui

# Class SysTray

java.lang.Object
org.astrogrid.samp.gui.SysTray

public abstract class SysTray extends 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 final 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

Modifier and Type
Method
Description
`abstract Object`
`addIcon(Image im, String tooltip, PopupMenu popup, 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(Object trayIcon)`
Removes a previously-added icon from the tray.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### NOTRAY_PROP

public static final 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

## 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 display
  `tooltip` - tooltip text, or null
  `popup` - popup menu, or null
  `iconListener` - listener triggered when icon is activated, or null
Returns:
  tray icon object, may be used for later removal
Throws:
  `AWTException`

### removeIcon

public abstract void removeIcon(Object trayIcon) throws AWTException
Removes a previously-added icon from the tray.

Parameters:
  `trayIcon` - object obtained from a previous invocation of addIcon
Throws:
  `AWTException`

### getInstance

public static SysTray getInstance()
Returns an instance of this class.

Returns:
  instance