public class ContextualMenuHelper extends Object
| Constructor and Description |
|---|
ContextualMenuHelper()
|
ContextualMenuHelper(JComponent
|
| Modifier and Type | Method and Description |
|---|---|
static void |
add(JComponent
Add a menu item that invokes the argument Runnable when selected.
|
JMenuItem |
add(String
|
void |
addComponent(JComponent
Install this contextual menu on the component provided.
|
void |
addMenuItem(JMenuItem
|
JMenu |
addPopupMenu(String
|
static void |
addPopupMenu(String
Add a submenu that offers a choice of radiobutton menu items to control an EnumProperty.
|
JMenuItem |
addToggle(BooleanProperty
|
static void |
addToggle(JComponent
Add a checkbox menu item to control a BooleanProperty.
|
static void |
clear(JComponent
Clear any registered contextual menu information for this component.
|
static ContextualMenuHelper |
getContextualMenuHelper(JComponent
Return the ContextualMenuHelper the static helper methods refer to.
|
void |
removeMenuItem(JMenuItem
|
protected void |
showPopup(Component
|
public ContextualMenuHelper()
public ContextualMenuHelper(JComponentjc)
public static void add(JComponentjc, String menuItemName, Runnable runnable)
runnable - this is invoked (via SwingUtilities.invokeLater()) when this menu item is selected.
public static ContextualMenuHelpergetContextualMenuHelper(JComponent jc)
jc - the component to retrieve a common ContextualMenuHelper for.
public static void addToggle(JComponentjc, BooleanProperty property, Runnable runnable)
runnable - this is invoked (via SwingUtilities.invokeLater()) when this menu item is selected.
public static void addPopupMenu(StringpopupName, JComponent jc, EnumProperty <?> property, Runnable runnable)
runnable - this is invoked (via SwingUtilities.invokeLater()) when any choice is selected.
public void addComponent(JComponentjc)
public JMenuItemaddToggle(BooleanProperty property, Runnable runnable)
public JMenuaddPopupMenu(String popupName, EnumProperty property, Runnable runnable)
protected void showPopup(Componentc, int x, int y)
public static void clear(JComponentcomponent)
component - the component to purge all contextual menu info for.
public void addMenuItem(JMenuItemmenuItem)
public void removeMenuItem(JMenuItemmenuItem)