Class FlatMenuItemRenderer

java.lang.Object
com.formdev.flatlaf.ui.FlatMenuItemRenderer
Direct Known Subclasses:
FlatMenuUI.FlatMenuRenderer

public class FlatMenuItemRenderer extends Object
Renderer for menu items.
  • Field Details

    • KEY_MAX_ICONS_WIDTH

      private static final String KEY_MAX_ICONS_WIDTH
      See Also:
    • 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
    • iconsShared

      private boolean iconsShared
    • cachedAccelerator

      private KeyStroke cachedAccelerator
    • cachedAcceleratorText

      private String cachedAcceleratorText
    • cachedAcceleratorLeftToRight

      private boolean cachedAcceleratorLeftToRight
    • controlGlyph

      private static final char controlGlyph
      See Also:
    • optionGlyph

      private static final char optionGlyph
      See Also:
    • shiftGlyph

      private static final char shiftGlyph
      See Also:
    • commandGlyph

      private static final char commandGlyph
      See Also:
  • 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()
    • layout

      private void layout(Rectangle viewRect, Rectangle iconRect, Rectangle textRect, Rectangle accelRect, Rectangle arrowRect, Rectangle labelRect)
    • centerOffset

      private static int centerOffset(int wh1, int wh2)
    • 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()
    • getTopLevelFont

      private Font getTopLevelFont()
    • getIconForPainting

      private Icon getIconForPainting()
    • getIconForLayout

      private Icon getIconForLayout()
    • getAcceleratorText

      private String getAcceleratorText()
    • getTextForAccelerator

      protected String getTextForAccelerator(KeyStroke accelerator)
    • getMacOSModifiersExText

      protected String getMacOSModifiersExText(int modifiers, boolean leftToRight)
    • getMaxIconsWidth

      private int getMaxIconsWidth()
      Calculates the maximum width of all menu item icons in the popup.
    • clearClientProperties

      static void clearClientProperties(Component c)