swingwtx.custom
Class JTaskTrayItem

java.lang.Object
  extended byswingwt.awt.Component
      extended byswingwt.awt.Container
          extended byswingwtx.swing.JComponent
              extended byswingwtx.custom.JTaskTrayItem
All Implemented Interfaces:
ImageObserver, MenuContainer

public class JTaskTrayItem
extends JComponent

Wraps up an item on the system task tray. For Win32 - the task tray, for GTK2/XFCE4 the GNOME notification area. Additionally, allows a JPopupMenu to be assigned to popup when the user right clicks on the item. An ActionEvent is fired for a left click on the tray item.


Nested Class Summary
 
Nested classes inherited from class swingwtx.swing.JComponent
JComponent.InternalFrameSelectionListener
 
Field Summary
protected  Icon pIcon
           
protected  JPopupMenu popup
           
protected  org.eclipse.swt.widgets.TrayItem ppeer
           
 
Fields inherited from class swingwtx.swing.JComponent
accessibleContext, actionMap, ancestorInputMap, border, clientProperties, descendantHasPeer, focusInputMap, internalFrameAdapter, internalFrameParent, opaque, propertyChangeListeners, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, windowInputMap
 
Fields inherited from class swingwt.awt.Container
composite, comps, containerListeners, layout, queuedValidateRequest
 
Fields inherited from class swingwt.awt.Component
actionCommand, actionListeners, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListeners, componentName, consumeAvailableHeight, consumeAvailableWidth, focusable, focusListeners, graphicsConfig, inputMethodListeners, isUserSetFont, keyListeners, layoutModifier, LEFT_ALIGNMENT, LOCK, mouseListeners, mouseMotionListeners, mouseWheelListeners, parent, pBackground, pCursor, pDoubleBuffered, peer, pEnabled, pFont, pForeground, pLayoutData, pLocation, pMaxSize, pMinSize, pPrefSize, pSize, pToolTipText, pVisible, RIGHT_ALIGNMENT, swingWTDefaultActionEventAdapter, swingWTEventAdapter, TOP_ALIGNMENT
 
Fields inherited from interface swingwt.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JTaskTrayItem()
           
JTaskTrayItem(Icon icon)
           
JTaskTrayItem(Icon icon, java.lang.String tooltiptext)
           
JTaskTrayItem(Icon icon, java.lang.String tooltiptext, JPopupMenu menu)
           
 
Method Summary
 JPopupMenu getPopupMenu()
          Returns the popup menu
 java.lang.String getToolTipText()
          Returns the text used by the tray icon
 void hide()
          Hide the tray item
 void registerEvents()
          When the component has been added to a container, this routine gets called to tell it to set up SWT listeners for all its events.
 void setIcon(Icon icon)
          Sets the image used for the tray item
 void setPopupMenu(JPopupMenu menu)
          Sets the popup menu used by the tray icon.
 void setToolTipText(java.lang.String text)
          Sets the tooltip used on the tray icon
 void setVisible(boolean b)
          Determines whether the tray item is visible.
 void show()
          Display the tray item
 
Methods inherited from class swingwtx.swing.JComponent
add, add, add, add, add, addPropertyChangeListener, addPropertyChangeListener, checkInternalFrameChild, dispose, getAccessibleContext, getActionMap, getAutoscrolls, getBorder, getClientProperty, getInputMap, getInsets, getToolTipLocation, getToolTipText, getTopLevelAncestor, getVisibleRect, isDoubleBuffered, isOpaque, isOptimizedDrawingEnabled, isValidateRoot, paint, paintBackground, paintChildren, paintComponent, paintImmediately, paintImmediately, putClientProperty, remove, remove, removePropertyChangeListener, removePropertyChangeListener, repaint, revalidate, scrollRectToVisible, setActionMap, setAutoscrolls, setBorder, setDoubleBuffered, setInputMap, setMargin, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setSwingWTParent
 
Methods inherited from class swingwt.awt.Container
addComponentToLayout, addContainerListener, debug_showContainmentTree, doAdd, doLayout, getComponent, getComponentCount, getComponentOrientation, getComponents, getComposite, getLayout, getMaximumSize, getMinimumSize, getParent, getPreferredSize, invalidate, minimumSize, preferredSize, processContainerEvent, processEvent, queuedValidate, removeAll, removeComponentFromCache, removeContainerListener, setLayout, setLayoutImpl, validate
 
Methods inherited from class swingwt.awt.Component
add, addActionListener, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, calculatePreferredSize, componentOnlyDispose, computePreferredSize, contains, contains, createImage, createListenerArrayFromVector, createVolatileImage, dispatchEvent, getActionCommand, getAlignmentX, getAlignmentY, getBackground, getBounds, getCursor, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getListeners, getLocation, getLocationOnScreen, getName, getPeer, getPeerSize, getSize, getSize, getSWTPeer, getToolkit, getTreeLock, getWidth, getX, getY, grabFocus, hasFocus, hasSetFont, imageUpdate, inside, isEnabled, isFocusable, isMinimumSizeSet, isShowing, isVisible, processActionEvent, processComponentEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, processTraverseEvent, registerActionEvents, registerComponentEvents, registerExtendedModifyEvents, registerFocusEvents, registerKeyEvents, registerModifyEvents, registerMouseEvents, registerPaintEvents, registerTraversalEvents, remove, removeActionListener, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, repaint, repaint, repaint, requestFocus, setActionCommand, setAlignmentX, setAlignmentY, setBackground, setBounds, setBounds, setCachedProperties, setComponentOrientation, setComponentRemoved, setCursor, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setFont, setForeground, setHeight, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setSize, setSize, setWidth, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ppeer

protected org.eclipse.swt.widgets.TrayItem ppeer

pIcon

protected Icon pIcon

popup

protected JPopupMenu popup
Constructor Detail

JTaskTrayItem

public JTaskTrayItem()

JTaskTrayItem

public JTaskTrayItem(Icon icon)

JTaskTrayItem

public JTaskTrayItem(Icon icon,
                     java.lang.String tooltiptext)

JTaskTrayItem

public JTaskTrayItem(Icon icon,
                     java.lang.String tooltiptext,
                     JPopupMenu menu)
Method Detail

setIcon

public void setIcon(Icon icon)
Sets the image used for the tray item

Parameters:
icon - The icon to display in the tray

setToolTipText

public void setToolTipText(java.lang.String text)
Sets the tooltip used on the tray icon

Overrides:
setToolTipText in class Component
Parameters:
text - The tooltip text

getToolTipText

public java.lang.String getToolTipText()
Returns the text used by the tray icon

Overrides:
getToolTipText in class Component
Returns:
The tray icon tooltip text

setPopupMenu

public void setPopupMenu(JPopupMenu menu)
Sets the popup menu used by the tray icon.

Parameters:
menu - The popup

getPopupMenu

public JPopupMenu getPopupMenu()
Returns the popup menu

Returns:
The popup menu used by the tray icon

setVisible

public void setVisible(boolean b)
Determines whether the tray item is visible.

Overrides:
setVisible in class Component
Parameters:
b - Whether to show the tray item or not

registerEvents

public void registerEvents()
Description copied from class: Component
When the component has been added to a container, this routine gets called to tell it to set up SWT listeners for all its events. We can map these then to the AWT-style events

Overrides:
registerEvents in class Component

show

public void show()
Display the tray item

Overrides:
show in class Component

hide

public void hide()
Hide the tray item

Overrides:
hide in class Component