SysTray for Java
v2.4.1  

snoozesoft.systray4j
Class SubMenu

java.lang.Object
  extended bysnoozesoft.systray4j.SysTrayMenuItem
      extended bysnoozesoft.systray4j.SubMenu

public class SubMenu
extends SysTrayMenuItem

This class represents a submenu. It consists of a special labeled (parent) item, and the actual submenu appearing whenever the cursor enters the client area of the parent item.


Constructor Summary
SubMenu(java.lang.String label)
          Constructs an empty submenu with label as the label of its parent item.
SubMenu(java.lang.String label, java.util.Vector items)
          Constructs a new submenu with label as the label of its parent item, and the passed items as content.
 
Method Summary
 void addItem(SysTrayMenuItem item)
          Inserts an item at the top of this menu.
 void addItem(SysTrayMenuItem item, int index)
          Inserts an item to this menu.
 void addSeparator()
          Inserts a separator at the top of this menu.
 void addSeparator(int index)
          Inserts a separator to this menu.
 SysTrayMenuItem getItem(java.lang.String label)
          Returns the first item labeled as label or null if no such item could be found.
 SysTrayMenuItem getItemAt(int index)
          Returns the item at position index.
 int getItemCount()
          Getter for the size of this menu.
 void removeAll()
          Removes all menu items.
 void removeItem(java.lang.Object item)
          Removes the passed item from this menu.
 void removeItemAt(int index)
          Removes the item at position index from this menu.
 void setItems(java.util.Vector items)
          Rebuilds this menu according to the passed vector.
 
Methods inherited from class snoozesoft.systray4j.SysTrayMenuItem
addSysTrayMenuListener, getActionCommand, getLabel, isEnabled, removeSysTrayMenuListener, setActionCommand, setEnabled, setLabel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubMenu

public SubMenu(java.lang.String label)
Constructs an empty submenu with label as the label of its parent item.

Parameters:
label - The label of the new submenu.

SubMenu

public SubMenu(java.lang.String label,
               java.util.Vector items)
Constructs a new submenu with label as the label of its parent item, and the passed items as content.

Parameters:
label - The label of the new submenu.
items - The menu items.
Method Detail

addItem

public void addItem(SysTrayMenuItem item)
Inserts an item at the top of this menu.

Parameters:
item - The new menu item.

addItem

public void addItem(SysTrayMenuItem item,
                    int index)
Inserts an item to this menu.

Parameters:
item - The new menu item.
index - The position of the new menu item.

addSeparator

public void addSeparator()
Inserts a separator at the top of this menu.


addSeparator

public void addSeparator(int index)
Inserts a separator to this menu.

Parameters:
index - The position of the new separator item.

getItem

public SysTrayMenuItem getItem(java.lang.String label)
Returns the first item labeled as label or null if no such item could be found.

Parameters:
label - The label of the menu item to look for.
Returns:
the target item or null.

getItemAt

public SysTrayMenuItem getItemAt(int index)
Returns the item at position index.

Parameters:
index - The position of the menu item to look for.
Returns:
the target item or null if the item at the given position is a separator.

getItemCount

public int getItemCount()
Getter for the size of this menu.

Returns:
The number of items in this menu, including separators.

removeAll

public void removeAll()
Removes all menu items.


removeItem

public void removeItem(java.lang.Object item)
Removes the passed item from this menu.

Parameters:
item - The menu item to remove.

removeItemAt

public void removeItemAt(int index)
Removes the item at position index from this menu.

Parameters:
index - The position of the menu item to remove.

setItems

public void setItems(java.util.Vector items)
Rebuilds this menu according to the passed vector.

Parameters:
items - The new menu items.

SysTray for Java
v2.4.1