net.sf.jaxodraw.gui.menu
Class JaxoMenuUtils

java.lang.Object
  extended by net.sf.jaxodraw.gui.menu.JaxoMenuUtils

public final class JaxoMenuUtils
extends Object

Menu-related utility methods.


Method Summary
static boolean isChecked(JMenuItem m)
          Checks whether the given JMenuItem is selected.
static JMenuItem newCheckmarkMenuItem()
          =newCheckmarMenuItem(null).
static JMenuItem newCheckmarkMenuItem(String text)
          Depending on configuration, a JCheckBoxMenuItem or a JMenuItem with custom Icon.
static void setAccelerator(JMenuItem m, char keyChar)
          Sets the Keyboard Accelerator of a JMenuItem to the specified character.
static void setAccelerator(JMenuItem m, int keyCode, int modifiers)
          Sets the Keyboard Accelerator of a JMenuItem to a KeyStroke given by a numeric key code and a set of modifiers.
static void setActionCommand(JMenuItem m, int mode)
          Sets the ActionCommand of a JMenuItem to the given mode.
static void setChecked(JMenuItem m, boolean value)
          Sets the given JMenuItem as selected.
static void setLanguageKey(JMenuItem m, String key)
          Set the i18n key of a JMenuItem.
static void updateLanguage(JMenuItem m)
          Update the text of a JMenuItem.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newCheckmarkMenuItem

public static JMenuItem newCheckmarkMenuItem()
=newCheckmarMenuItem(null).

Returns:
A new JMenuItem.

newCheckmarkMenuItem

public static JMenuItem newCheckmarkMenuItem(String text)
Depending on configuration, a JCheckBoxMenuItem or a JMenuItem with custom Icon. Use {#isChecked}, {#setChecked} to control checking instead of is/setSelected.

Parameters:
text - The text of the JMenuItem.
Returns:
A new JMenuItem.

isChecked

public static boolean isChecked(JMenuItem m)
Checks whether the given JMenuItem is selected.

Parameters:
m - The JMenuItem to check.
Returns:
True if the JMenuItem is selected.
See Also:
newCheckmarkMenuItem()

setChecked

public static void setChecked(JMenuItem m,
                              boolean value)
Sets the given JMenuItem as selected.

Parameters:
m - The JMenuItem to check.
value - True to set the JMenuItem as selected.
See Also:
newCheckmarkMenuItem()

updateLanguage

public static void updateLanguage(JMenuItem m)
Update the text of a JMenuItem.

Parameters:
m - The JMenuItem.

setLanguageKey

public static void setLanguageKey(JMenuItem m,
                                  String key)
Set the i18n key of a JMenuItem.

Parameters:
m - The JMenuItem.
key - the language key.

setAccelerator

public static void setAccelerator(JMenuItem m,
                                  char keyChar)
Sets the Keyboard Accelerator of a JMenuItem to the specified character.

Parameters:
m - The JMenuItem.
keyChar - the character value for a keyboard key
See Also:
KeyStroke.getKeyStroke(char)

setAccelerator

public static void setAccelerator(JMenuItem m,
                                  int keyCode,
                                  int modifiers)
Sets the Keyboard Accelerator of a JMenuItem to a KeyStroke given by a numeric key code and a set of modifiers.

Parameters:
m - The JMenuItem.
keyCode - an int specifying the numeric code for a keyboard key.
modifiers - a bitwise-ored combination of any modifiers.
See Also:
KeyStroke.getKeyStroke(int,int)

setActionCommand

public static void setActionCommand(JMenuItem m,
                                    int mode)
Sets the ActionCommand of a JMenuItem to the given mode.

Parameters:
m - The JMenuItem.
mode - A mode as defined in JaxoConstants.
See Also:
JaxoConstants.getModeAsString(int)


Copyright © 2003-2011 The JaxoDraw team. All Rights Reserved.