Class MenuService

    • Field Detail

      • SEPARATOR

        public static final int SEPARATOR
        Const to add a separator to a menu.
        See Also:
        Constant Field Values
    • Constructor Detail

      • MenuService

        public MenuService()
    • Method Detail

      • menuBar

        public static MenuBar menuBar​(Menu... menus)
        Construct a menu bar with some menus.
        Parameters:
        menus - menus to add to the menu bar
        Returns:
        menu bar with menus
      • menu

        public static Menu menu​(String text,
                                Object... children)
        Construct a named menu with some children.
        Parameters:
        text - name of the menu
        children - items in the menu
        Returns:
        a named menu with given items
      • item

        public static MenuItem item​(String label,
                                    ActionListener action,
                                    MenuShortcut s)
        Construct a menu item with a label, an action and a shortcut.
        Parameters:
        label - menu label
        action - menu action
        s - menu item shortcut
        Returns:
        menu item with label, action and shortcut
      • item

        public static MenuItem item​(String label,
                                    ActionListener action)
        Construct a menu item with a label and an action.
        Parameters:
        label - menu label
        action - menu action
        Returns:
        menu item with label, action and shortcut
      • shortcut

        public static MenuShortcut shortcut​(int key,
                                            boolean useShiftModifier)
        Construct a new menu shortcut with a key code and the shift modifier flag.
        Parameters:
        key - which key code to react to
        useShiftModifier - shift must be pressed
        Returns:
        menu shortcut
        See Also:
        KeyEvent
      • shortcut

        public static MenuShortcut shortcut​(int key)
        Construct a new menu shortcut with a key code. By default, the shift modifier flag is set to false.
        Parameters:
        key - which key code to react to
        Returns:
        menu shortcut
        See Also:
        KeyEvent
      • shortcut

        public static MenuShortcut shortcut​(char key,
                                            boolean useShiftModifier)
        Construct a new menu shortcut with a key char and the shift modifier flag.
        Parameters:
        key - which key char to react to
        useShiftModifier - shift must be pressed
        Returns:
        menu shortcut
      • shortcut

        public static MenuShortcut shortcut​(char key)
        Construct a new menu shortcut with a key char. By default, the shift modifier flag is set to false.
        Parameters:
        key - which key char to react to
        Returns:
        menu shortcut