Class IMenu

All Implemented Interfaces:
ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible, MenuElement, SwingConstants

public class IMenu extends JMenu
Menu with internationalization support. The constructors take the name of a resource bundle and keys used to look up menu names and icons from the bundle. Changing the locale then automatically changes the icon and/or menu name.
See Also:
  • Constructor Details

    • IMenu

      public IMenu()
      Constructor.
    • IMenu

      public IMenu(Action a)
      Constructor with an action.
      Parameters:
      a - the action
    • IMenu

      public IMenu(String s)
      Constructor with a label.
      Parameters:
      s - the label
    • IMenu

      public IMenu(String s, boolean b)
      Constructor with a label and a tear-off mode.
      Parameters:
      s - the label
      b - true if the menu item can be torn off; false otherwise
    • IMenu

      public IMenu(String bundleName, String key)
      Constructor to create and install an internationalized menu.
      Parameters:
      bundleName - the name of a resource bundle.
      key - the key used to look up the menu's name from the bundle named by bundleName.
    • IMenu

      public IMenu(Locale locale, String bundleName, String key)
      Constructor to create and install a help menu given a locale.
      Parameters:
      locale - the local for the help menu.
      bundleName - the name of a resource bundle
      key - the key used to look up a string from the resource bundle.
    • IMenu

      public IMenu(String bundleName, String key, boolean b)
      Constructor to create and install an internationalized menu with a tear-off mode.
      Parameters:
      bundleName - the name of a resource bundle.
      key - the key used to look up the menu's name from the bundle named by bundleName.
      b - true if the menu item can be torn off; false otherwise
    • IMenu

      public IMenu(Locale locale, String bundleName, String key, boolean b)
      Constructor to create and install an internationalized menu with a tear-off mode, specifying a locale.
      Parameters:
      locale - the locale
      bundleName - the name of a resource bundle.
      key - the key used to look up the menu's name from the bundle named by bundleName.
      b - true if the menu item can be torn off; false otherwise
  • Method Details

    • setLocale

      public void setLocale(Locale locale)
      Overrides:
      setLocale in class Component
    • setText

      public void setText(String text)
      Overrides:
      setText in class AbstractButton
    • setTextKey

      public void setTextKey(String key)
      Set a menu item's text by key instead of by value.
      Parameters:
      key - the key used by a resource bundle to find the text used to label this menu item
    • setIcon

      public void setIcon(Icon icon)
      Overrides:
      setIcon in class AbstractButton
    • setIconKey

      public void setIconKey(String key)
      Set a menu item's icon by key instead of by value.
      Parameters:
      key - the key used by a resource bundle to find the icon for this menu item
      See Also:
    • setSelectedIcon

      public void setSelectedIcon(Icon icon)
      Overrides:
      setSelectedIcon in class AbstractButton
    • setSelectedIconKey

      public void setSelectedIconKey(String key)
      Set a menu item's selected icon by key instead of by value.
      Parameters:
      key - the key used by a resource bundle to find the icon for this menu item
      See Also:
    • setDisabledIcon

      public void setDisabledIcon(Icon icon)
      Overrides:
      setDisabledIcon in class AbstractButton
    • setDisabledIconKey

      public void setDisabledIconKey(String key)
      Set a menu item's disabled icon by key instead of by value.
      Parameters:
      key - the key used by a resource bundle to find the icon for this menu item
      See Also:
    • setDisabledSelectedIcon

      public void setDisabledSelectedIcon(Icon icon)
      Overrides:
      setDisabledSelectedIcon in class AbstractButton
    • setDisabledSelectedIconKey

      public void setDisabledSelectedIconKey(String key)
      Set a menu item's disabled-selected icon by key instead of by value.
      Parameters:
      key - the key used by a resource bundle to find the icon for this menu item
      See Also:
    • setRolloverIcon

      public void setRolloverIcon(Icon icon)
      Overrides:
      setRolloverIcon in class AbstractButton
    • setRolloverIconKey

      public void setRolloverIconKey(String key)
      Set a menu item's rollover icon by key instead of by value.
      Parameters:
      key - the key used by a resource bundle to find the icon for this menu item
      See Also:
    • setRolloverSelectedIcon

      public void setRolloverSelectedIcon(Icon icon)
      Overrides:
      setRolloverSelectedIcon in class AbstractButton
    • setRolloverSelectedIconKey

      public void setRolloverSelectedIconKey(String key)
      Set a menu item's rollover-selected icon by key instead of by value.
      Parameters:
      key - the key used by a resource bundle to find the icon for this menu item
      See Also:
    • setPressedIcon

      public void setPressedIcon(Icon icon)
      Overrides:
      setPressedIcon in class AbstractButton
    • setPressedIconKey

      public void setPressedIconKey(String key)
      Set a menu item's pressed icon by key instead of by value.
      Parameters:
      key - the key used by a resource bundle to find the icon for this menu item
      See Also:
    • setMnemonic

      public void setMnemonic(int mnemonic)
      Overrides:
      setMnemonic in class AbstractButton
    • setMnemonicKey

      public void setMnemonicKey(String key)
      Set a menu item's mnemonic code by key instead of by value.
      Parameters:
      key - the key used by a resource bundle to find the mnemonic code for this menu item
      See Also: