Class FlatMenuItemRenderer

  • Direct Known Subclasses:
    FlatMenuUI.FlatMenuRenderer

    public class FlatMenuItemRenderer
    extends Object
    Renderer for menu items.
    UiDefault:
    MenuItem.verticallyAlignText boolean, MenuItem.minimumWidth int, MenuItem.minimumIconSize Dimension, MenuItem.textAcceleratorGap int, MenuItem.textNoAcceleratorGap int, MenuItem.acceleratorArrowGap int, MenuItem.checkBackground Color, MenuItem.checkMargins Insets, MenuItem.selectionInsets Insets, MenuItem.selectionArc int, MenuItem.selectionType String null (default) or underline, MenuItem.underlineSelectionBackground Color, MenuItem.underlineSelectionCheckBackground Color, MenuItem.underlineSelectionColor Color, MenuItem.underlineSelectionHeight int
    • Field Detail

      • menuItem

        protected final JMenuItem menuItem
      • checkIcon

        protected Icon checkIcon
      • arrowIcon

        protected Icon arrowIcon
      • acceleratorFont

        protected Font acceleratorFont
      • acceleratorDelimiter

        protected final String acceleratorDelimiter
      • verticallyAlignText

        protected boolean verticallyAlignText
        Since:
        2
      • minimumWidth

        protected int minimumWidth
      • minimumIconSize

        protected Dimension minimumIconSize
      • textAcceleratorGap

        protected int textAcceleratorGap
      • textNoAcceleratorGap

        protected int textNoAcceleratorGap
      • acceleratorArrowGap

        protected int acceleratorArrowGap
      • checkBackground

        protected Color checkBackground
      • checkMargins

        protected Insets checkMargins
      • selectionInsets

        protected Insets selectionInsets
        Since:
        3
      • selectionArc

        protected int selectionArc
        Since:
        3
      • underlineSelectionBackground

        protected Color underlineSelectionBackground
      • underlineSelectionCheckBackground

        protected Color underlineSelectionCheckBackground
      • underlineSelectionColor

        protected Color underlineSelectionColor
      • underlineSelectionHeight

        protected int underlineSelectionHeight
    • Constructor Detail

      • FlatMenuItemRenderer

        protected FlatMenuItemRenderer​(JMenuItem menuItem,
                                       Icon checkIcon,
                                       Icon arrowIcon,
                                       Font acceleratorFont,
                                       String acceleratorDelimiter)
    • Method Detail

      • applyStyleProperty

        protected Object applyStyleProperty​(String key,
                                            Object value)
        Since:
        2
      • getStyleableInfos

        public Map<String,​Class<?>> getStyleableInfos()
        Since:
        2
      • getStyleableValue

        public Object getStyleableValue​(String key)
        Since:
        2.5
      • getPreferredMenuItemSize

        protected Dimension getPreferredMenuItemSize()
      • paintMenuItem

        protected void paintMenuItem​(Graphics g,
                                     Color selectionBackground,
                                     Color selectionForeground,
                                     Color disabledForeground,
                                     Color acceleratorForeground,
                                     Color acceleratorSelectionForeground)
      • paintBackground

        protected void paintBackground​(Graphics g)
        Since:
        3
      • paintSelection

        protected void paintSelection​(Graphics g,
                                      Color selectionBackground,
                                      Insets selectionInsets,
                                      int selectionArc)
        Since:
        3
      • paintUnderlineSelection

        protected void paintUnderlineSelection​(Graphics g,
                                               Color underlineSelectionBackground,
                                               Color underlineSelectionColor,
                                               int underlineSelectionHeight)
        Since:
        3
      • deriveBackground

        protected Color deriveBackground​(Color background)
      • isArmedOrSelected

        protected static boolean isArmedOrSelected​(JMenuItem menuItem)
        Returns true if either the menu item is armed (mouse over item) or it is a JMenu and selected (shows submenu).
      • isTopLevelMenu

        protected static boolean isTopLevelMenu​(JMenuItem menuItem)
      • isUnderlineSelection

        protected boolean isUnderlineSelection()
      • getTextForAccelerator

        protected String getTextForAccelerator​(KeyStroke accelerator)
      • getMacOSModifiersExText

        protected String getMacOSModifiersExText​(int modifiers,
                                                 boolean leftToRight)