|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.jpackages.jtray.JTrayNativeMenu
public class JTrayNativeMenu
This class specifies the menu items to be displayed in a native popup menu.
If the contents of this menu change, it needs to be set again as the click target on the JTrayIcon.
Example:
JTrayNativeMenu nativemenu = new JTrayNativeMenu();
nativemenu.add("Show Window");
nativemenu.addSeparator();
nativemenu.add("Exit");
nativemenu.addListener(new JTrayNativeMenuListener() {
public void actionPerformed(JTrayNativeMenuItem item) {
System.out.println("java action detected for: " + item.getText());
if (item.getText().equals("Exit")) {
jTrayIcon.hide();
System.exit(0);
}
}
});
jTrayIcon.setRightClickTarget(nativemenu);
Copyright (c) 2001-2007
| Constructor Summary | |
|---|---|
JTrayNativeMenu()
Constructs an empty JTrayNativeMenu. |
|
| Method Summary | |
|---|---|
void |
add(JTrayNativeMenuItem menuItem)
Add a menu item. |
void |
add(java.lang.String menuText)
Add a menu item with the specified text. |
void |
addListener(JTrayNativeMenuListener listener)
Add a JTrayNativeMenuListener to detect native menu item click events. |
void |
addSeparator()
Add a menu item separator. |
void |
removeListener(JTrayNativeMenuListener listener)
Remove a JTrayNativeMenuListener. |
void |
setDefaultMenuItem(JTrayNativeMenuItem item)
Set the default menu item. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JTrayNativeMenu()
Constructs an empty JTrayNativeMenu.
| Method Detail |
|---|
public void setDefaultMenuItem(JTrayNativeMenuItem item)
Set the default menu item.
Each native menu can have one default item. The default item appears on the menu in bold. A common practice is to have the action of the default item be the same action of a left double-click.
item - The menu item to set as the defaultpublic void add(JTrayNativeMenuItem menuItem)
Add a menu item.
menuItem - Native menu item to addpublic void add(java.lang.String menuText)
Add a menu item with the specified text.
menuText - Text to display in this menu itempublic void addSeparator()
Add a menu item separator.
public void addListener(JTrayNativeMenuListener listener)
Add a JTrayNativeMenuListener to detect native menu item click events.
listener - The listener to addpublic void removeListener(JTrayNativeMenuListener listener)
Remove a JTrayNativeMenuListener.
listener - The listener to remove
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||