public static void paintDisabledText(final BasicMenuItemUI originalUI, final Graphics g, final JMenuItem menuItem, final Rectangle textRect, final String text) { final FontMetrics fm = SwingUtilities2.getFontMetrics(menuItem, g); final int index = menuItem.getDisplayedMnemonicIndex(); final Color fg = getForeground(originalUI, menuItem); final Color shadow = UIUtil.shade(menuItem.getBackground(), 1.24, 0.5); g.setColor(shadow); SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, index, textRect.x + 1, textRect.y + fm.getAscent() + 1); g.setColor(fg); SwingUtilities2.drawStringUnderlineCharAt(menuItem, g, text, index, textRect.x, textRect.y + fm.getAscent()); }
private static Icon getCheckIconFromContext(final BasicMenuItemUI originalUI, final JCheckBoxMenuItem item) { if (myCachedCheckIcon == null) { final SynthContext context = GtkPaintingUtil.getSynthContext(originalUI, item); myCachedCheckIcon = context.getStyle().getIcon(context, "CheckBoxMenuItem.checkIcon"); } return myCachedCheckIcon; }
public static Color getForeground(final BasicMenuItemUI ui, final JMenuItem menuItem) { final SynthContext context = getSynthContext(ui, menuItem); return context.getStyle().getColor(context, ColorType.TEXT_FOREGROUND); }
public static boolean isUiAcceptable(final MenuItemUI ui) { return ui instanceof BasicMenuItemUI && GtkPaintingUtil.isSynthUI(ui); }