Class FlatMenuItemRenderer

java.lang.Object
com.formdev.flatlaf.ui.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 Details

    • 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 Details

    • FlatMenuItemRenderer

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

    • 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)
    • paintIcon

      protected void paintIcon(Graphics g, Rectangle iconRect, Icon icon, Color checkBackground, Color selectionBackground)
    • paintText

      protected void paintText(Graphics g, Rectangle textRect, String text, Color selectionForeground, Color disabledForeground)
    • paintAccelerator

      protected void paintAccelerator(Graphics g, Rectangle accelRect, String accelText, Color foreground, Color selectionForeground, Color disabledForeground)
    • paintArrowIcon

      protected void paintArrowIcon(Graphics g, Rectangle arrowRect, Icon arrowIcon)
    • paintIcon

      protected static void paintIcon(Graphics g, JMenuItem menuItem, Icon icon, Rectangle iconRect)
    • paintText

      protected static void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text, int mnemonicIndex, Font font, Color foreground, Color selectionForeground, Color disabledForeground)
    • paintHTMLText

      protected static void paintHTMLText(Graphics g, JMenuItem menuItem, Rectangle textRect, View htmlView, Color selectionForeground)
    • 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)
    • isInVerticalMenuBar

      public static boolean isInVerticalMenuBar(JMenuItem menuItem)
      Since:
      3.5
    • isUnderlineSelection

      protected boolean isUnderlineSelection()
    • getTextForAccelerator

      protected String getTextForAccelerator(KeyStroke accelerator)
    • getMacOSModifiersExText

      protected String getMacOSModifiersExText(int modifiers, boolean leftToRight)