|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.unidata.util.MenuUtil
public class MenuUtil
This is a vast catchall class to old various utilities for doing GUI things.
| Field Summary | |
|---|---|
static String |
MENU_SEPARATOR
Separator flag |
| Constructor Summary | |
|---|---|
MenuUtil()
|
|
| Method Summary | |
|---|---|
static Method |
findMethod(Class c,
String methodName,
Class[] paramTypes)
Find all methods with the given name. |
static JCheckBoxMenuItem |
makeCheckboxMenuItem(String label,
Object object,
String property,
boolean value,
Object arg)
Make a checkbox menu item. |
static JCheckBoxMenuItem |
makeCheckboxMenuItem(String label,
Object object,
String property,
Object arg)
Make a checkbox menu item. |
static JMenu |
makeMenu(JMenu menu,
List menuItems)
Create a JMenu and add the menus contained with the menus list If no menus then return null. |
static JMenu |
makeMenu(String name,
List menuItems)
Create a JMenu and add the menus contained with the menus list If no menus then return null. |
static JMenuItem |
makeMenuItem(String label,
Object object,
String methodName)
Make a jmenuItem. |
static JMenuItem |
makeMenuItem(String label,
Object object,
String methodName,
Object arg)
Make a jmenuItem. |
static JMenuItem |
makeMenuItem(String label,
Object object,
String methodName,
Object arg,
boolean inThread)
Make a jmenuItem. |
static List |
makeMenuItems(Object object,
Object[][] items)
Utility to make a list of menu items. |
static JPopupMenu |
makePopupMenu(JPopupMenu menu,
List menuItems)
Create a JPopupMenu and add the menus contained with the menus list If no menus then return null. |
static JPopupMenu |
makePopupMenu(List menuItems)
Create a JPopupMenu and add the menus contained with the menus list If no menus then return null. |
static void |
showPopupMenu(List menuItems,
Component comp)
Create a popup menu and show it near the given component |
static boolean |
typesMatch(Class[] formals,
Class[] actuals)
Returns true if the Classes defined in the actual parameter are equal or a sub-class of the corresponding classes defined in the formal argument. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String MENU_SEPARATOR
| Constructor Detail |
|---|
public MenuUtil()
| Method Detail |
|---|
public static boolean typesMatch(Class[] formals,
Class[] actuals)
formals - formal classes (types)actuals - actual classes
public static Method findMethod(Class c,
String methodName,
Class[] paramTypes)
c - class to checkmethodName - name of methodparamTypes - parameter types
null if one doesn't exist
public static JMenuItem makeMenuItem(String label,
Object object,
String methodName,
Object arg)
label - Labelobject - Object to callmethodName - Method name to callarg - Pass this to method name if non-null.
public static JMenuItem makeMenuItem(String label,
Object object,
String methodName)
label - Labelobject - Object to callmethodName - Method name to call
public static JMenuItem makeMenuItem(String label,
Object object,
String methodName,
Object arg,
boolean inThread)
label - Labelobject - Object to callmethodName - Method name to callarg - Pass this to method name if non-null.inThread - If true then call the method in a thread
public static JCheckBoxMenuItem makeCheckboxMenuItem(String label,
Object object,
String property,
Object arg)
label - Labelobject - Object to callproperty - Name of property to get/set valuearg - Optional arg to pass to method
public static JCheckBoxMenuItem makeCheckboxMenuItem(String label,
Object object,
String property,
boolean value,
Object arg)
label - Labelobject - Object to callproperty - Name of property to get/set valuevalue - The valuearg - Optional arg to pass to method
public static JMenu makeMenu(String name,
List menuItems)
name - The menu namemenuItems - List of either, JMenu, JMenuItem or MENU_SEPARATOR
public static JMenu makeMenu(JMenu menu,
List menuItems)
menu - The menu to add tomenuItems - List of either, JMenu, JMenuItem or MENU_SEPARATOR
public static List makeMenuItems(Object object,
Object[][] items)
object - The object to call the method onitems - An array. Each sub array has at least two elements:
{Menu name, method name}
If it has 3 elements then the 3rd element is an argument that is also passed
to the method. If it has 4 elements then the 4th element is a tooltip.
If there are 4 elements and the 3rd element is null then we don't try to find a method
that tags an extra argument.
public static void showPopupMenu(List menuItems,
Component comp)
menuItems - List of menu itemscomp - Component to show the menu at
public static JPopupMenu makePopupMenu(JPopupMenu menu,
List menuItems)
menu - The menumenuItems - List of either, JMenu, JMenuItem or MENU_SEPARATOR
public static JPopupMenu makePopupMenu(List menuItems)
menuItems - List of either, JMenu, JMenuItem or MENU_SEPARATOR
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||