Package com.formdev.flatlaf.ui
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 Summary
Fields Modifier and Type Field Description protected int
acceleratorArrowGap
protected String
acceleratorDelimiter
protected Font
acceleratorFont
protected Icon
arrowIcon
protected Color
checkBackground
protected Icon
checkIcon
protected Insets
checkMargins
protected JMenuItem
menuItem
protected Dimension
minimumIconSize
protected int
minimumWidth
protected int
selectionArc
protected Insets
selectionInsets
protected int
textAcceleratorGap
protected int
textNoAcceleratorGap
protected Color
underlineSelectionBackground
protected Color
underlineSelectionCheckBackground
protected Color
underlineSelectionColor
protected int
underlineSelectionHeight
protected boolean
verticallyAlignText
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Object
applyStyleProperty(String key, Object value)
protected Color
deriveBackground(Color background)
protected String
getMacOSModifiersExText(int modifiers, boolean leftToRight)
protected Dimension
getPreferredMenuItemSize()
Map<String,Class<?>>
getStyleableInfos()
Object
getStyleableValue(String key)
protected String
getTextForAccelerator(KeyStroke accelerator)
protected static boolean
isArmedOrSelected(JMenuItem menuItem)
Returnstrue
if either the menu item is armed (mouse over item) or it is aJMenu
and selected (shows submenu).protected static boolean
isTopLevelMenu(JMenuItem menuItem)
protected boolean
isUnderlineSelection()
protected void
paintAccelerator(Graphics g, Rectangle accelRect, String accelText, Color foreground, Color selectionForeground, Color disabledForeground)
protected void
paintArrowIcon(Graphics g, Rectangle arrowRect, Icon arrowIcon)
protected void
paintBackground(Graphics g)
protected static void
paintHTMLText(Graphics g, JMenuItem menuItem, Rectangle textRect, View htmlView, Color selectionForeground)
protected void
paintIcon(Graphics g, Rectangle iconRect, Icon icon, Color checkBackground, Color selectionBackground)
protected static void
paintIcon(Graphics g, JMenuItem menuItem, Icon icon, Rectangle iconRect)
protected void
paintMenuItem(Graphics g, Color selectionBackground, Color selectionForeground, Color disabledForeground, Color acceleratorForeground, Color acceleratorSelectionForeground)
protected void
paintSelection(Graphics g, Color selectionBackground, Insets selectionInsets, int selectionArc)
protected void
paintText(Graphics g, Rectangle textRect, String text, Color selectionForeground, Color disabledForeground)
protected static void
paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text, int mnemonicIndex, Font font, Color foreground, Color selectionForeground, Color disabledForeground)
protected void
paintUnderlineSelection(Graphics g, Color underlineSelectionBackground, Color underlineSelectionColor, int underlineSelectionHeight)
-
-
-
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
-
-
Method Detail
-
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
-
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)
-
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)
Returnstrue
if either the menu item is armed (mouse over item) or it is aJMenu
and selected (shows submenu).
-
isTopLevelMenu
protected static boolean isTopLevelMenu(JMenuItem menuItem)
-
isUnderlineSelection
protected boolean isUnderlineSelection()
-
getMacOSModifiersExText
protected String getMacOSModifiersExText(int modifiers, boolean leftToRight)
-
-