com.pepper.guiutils
Class SystemTrayObject

java.lang.Object
  extended by com.pepper.guiutils.SystemTrayObject

public class SystemTrayObject
extends Object

This object encapsulates information needed to display a button in the SystemTray.


Constructor Summary
SystemTrayObject(String id, String displayName)
          Creates a new SystemTrayObject instance.
SystemTrayObject(String id, String displayName, ImageIcon icon)
          Creates a new SystemTrayObject instance.
SystemTrayObject(String id, String displayName, JComponent uiComponent)
          Creates a new SystemTrayObject instance with a component to use for the UI
 
Method Summary
 Action getAction()
          Return the action set using setMenuWithAction()
 JButton getButton()
          Get the button to display in the tray
 ImageIcon getDefaultIcon()
          Get the default icon for this object
 ImageIcon getDisabledIcon()
          Get the disabled icon
 String getDisplayName()
          Get the displayName
 String getId()
          Get the id of this object
 JPopupMenu getMenu()
          Return the menu set using setMenu() or setMenuWithAction()
 String getTooltipText()
          Get the tooltip text
 JComponent getUIComponent()
          Get the component to display in the tray
 void setDisabledIcon(ImageIcon icon)
          Set the disabled icon
 void setDisplayName(String displayName)
          Set the displayName
 void setMenu(JPopupMenu theMenu)
          Set menu that will be displayed when the icon is selected in the SystemTray
 void setMenuWithAction(JPopupMenu theMenu, Action action)
          Set menu that will be displayed when the icon is selected in the SystemTray.
 void setParent(SystemTray parent)
           
 void setTooltipText(String text)
          Set the tooltip text.
 void showMenu()
          Show the menu previously set using setMenu() above the system tray icon
 void showMenu(JPopupMenu theMenu, int secondsToShow)
          Show the specified menu above the system tray icon
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SystemTrayObject

public SystemTrayObject(String id,
                        String displayName)
Creates a new SystemTrayObject instance.

Parameters:
id - Unique id of the SystemTrayObject
displayName - Name displayed if no icon is provided

SystemTrayObject

public SystemTrayObject(String id,
                        String displayName,
                        ImageIcon icon)
Creates a new SystemTrayObject instance.

Parameters:
id - Unique id of the SystemTrayObject
displayName - Name displayed if no icon is provided
icon - Icon to display in SystemTray

SystemTrayObject

public SystemTrayObject(String id,
                        String displayName,
                        JComponent uiComponent)
Creates a new SystemTrayObject instance with a component to use for the UI

Parameters:
id - Unique id of the SystemTrayObject
displayName - Name displayed if no icon is provided
uiComponent - Component to display in SystemTray
Method Detail

getButton

public JButton getButton()
Get the button to display in the tray

Returns:
JBuutton to put in the tray

getUIComponent

public JComponent getUIComponent()
Get the component to display in the tray

Returns:
JComponent to put in the tray

getId

public String getId()
Get the id of this object

Returns:
a String value

getDisplayName

public String getDisplayName()
Get the displayName

Returns:
a String value

setDisplayName

public void setDisplayName(String displayName)
Set the displayName

Parameters:
displayName - a String value

getDefaultIcon

public ImageIcon getDefaultIcon()
Get the default icon for this object

Returns:
an ImageIcon value

getDisabledIcon

public ImageIcon getDisabledIcon()
Get the disabled icon

Returns:
an ImageIcon value

setDisabledIcon

public void setDisabledIcon(ImageIcon icon)
Set the disabled icon

Parameters:
icon - an ImageIcon value

getMenu

public JPopupMenu getMenu()
Return the menu set using setMenu() or setMenuWithAction()

Returns:
a JPopupMenu value

getAction

public Action getAction()
Return the action set using setMenuWithAction()

Returns:
an Action value

setMenu

public void setMenu(JPopupMenu theMenu)
Set menu that will be displayed when the icon is selected in the SystemTray

Parameters:
theMenu - a JPopupMenu

showMenu

public void showMenu()
Show the menu previously set using setMenu() above the system tray icon


showMenu

public void showMenu(JPopupMenu theMenu,
                     int secondsToShow)
Show the specified menu above the system tray icon

Parameters:
theMenu - a JPopupMenu value

setMenuWithAction

public void setMenuWithAction(JPopupMenu theMenu,
                              Action action)
Set menu that will be displayed when the icon is selected in the SystemTray. The assoicated action will first be executed before the menu is displayed. This is useful for dynamic menus that can be manipulated by the action before they are displayed. If menu is null, then the action will just be performed.

Parameters:
theMenu - a JPopupMenu

setTooltipText

public void setTooltipText(String text)
Set the tooltip text. Display Name will be used if this is not set.

Parameters:
text - a String value

getTooltipText

public String getTooltipText()
Get the tooltip text

Returns:
a String value

setParent

public void setParent(SystemTray parent)


Copyright © 2006-2007 Pepper Computer, Inc. All Rights Reserved.