sun.swing.MenuItemLayoutHelper Java Examples

The following examples show how to use sun.swing.MenuItemLayoutHelper. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SynthGraphicsUtils.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
static void paintText(Graphics g, SynthMenuItemLayoutHelper lh,
                      MenuItemLayoutHelper.LayoutResult lr) {
    if (!lh.getText().equals("")) {
        if (lh.getHtmlView() != null) {
            // Text is HTML
            lh.getHtmlView().paint(g, lr.getTextRect());
        } else {
            // Text isn't HTML
            g.setColor(lh.getStyle().getColor(
                    lh.getContext(), ColorType.TEXT_FOREGROUND));
            g.setFont(lh.getStyle().getFont(lh.getContext()));
            lh.getGraphicsUtils().paintText(lh.getContext(), g, lh.getText(),
                    lr.getTextRect().x, lr.getTextRect().y,
                    lh.getMenuItem().getDisplayedMnemonicIndex());
        }
    }
}
 
Example #2
Source File: SynthGraphicsUtils.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
static void paintMenuItem(Graphics g, SynthMenuItemLayoutHelper lh,
                          MenuItemLayoutHelper.LayoutResult lr) {
    // Save original graphics font and color
    Font holdf = g.getFont();
    Color holdc = g.getColor();

    paintCheckIcon(g, lh, lr);
    paintIcon(g, lh, lr);
    paintText(g, lh, lr);
    paintAccText(g, lh, lr);
    paintArrowIcon(g, lh, lr);

    // Restore original graphics font and color
    g.setColor(holdc);
    g.setFont(holdf);
}
 
Example #3
Source File: DarkMenuItemUIBase.java    From darklaf with MIT License 6 votes vote down vote up
protected void paintIcon(final Graphics g, final JMenuItem mi, final MenuItemLayoutHelper lh,
                         final MenuItemLayoutHelper.LayoutResult lr, final Color holdc) {
    if (lh.getIcon() != null) {
        Icon icon;
        ButtonModel model = mi.getModel();
        if (!model.isEnabled()) {
            icon = mi.getDisabledIcon();
        } else if (model.isPressed() && model.isArmed()) {
            icon = mi.getPressedIcon();
            if (icon == null) {
                // Use default icon
                icon = mi.getIcon();
            }
        } else {
            icon = mi.getIcon();
        }

        if (icon != null) {
            icon.paintIcon(mi, g, lr.getIconRect().x, lr.getIconRect().y);
            g.setColor(holdc);
        }
    }
}
 
Example #4
Source File: SynthGraphicsUtils.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
static void paintText(Graphics g, SynthMenuItemLayoutHelper lh,
                      MenuItemLayoutHelper.LayoutResult lr) {
    if (!lh.getText().equals("")) {
        if (lh.getHtmlView() != null) {
            // Text is HTML
            lh.getHtmlView().paint(g, lr.getTextRect());
        } else {
            // Text isn't HTML
            g.setColor(lh.getStyle().getColor(
                    lh.getContext(), ColorType.TEXT_FOREGROUND));
            g.setFont(lh.getStyle().getFont(lh.getContext()));
            lh.getGraphicsUtils().paintText(lh.getContext(), g, lh.getText(),
                    lr.getTextRect().x, lr.getTextRect().y,
                    lh.getMenuItem().getDisplayedMnemonicIndex());
        }
    }
}
 
Example #5
Source File: SynthGraphicsUtils.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static void paintMenuItem(Graphics g, SynthMenuItemLayoutHelper lh,
                          MenuItemLayoutHelper.LayoutResult lr) {
    // Save original graphics font and color
    Font holdf = g.getFont();
    Color holdc = g.getColor();

    paintCheckIcon(g, lh, lr);
    paintIcon(g, lh, lr);
    paintText(g, lh, lr);
    paintAccText(g, lh, lr);
    paintArrowIcon(g, lh, lr);

    // Restore original graphics font and color
    g.setColor(holdc);
    g.setFont(holdf);
}
 
Example #6
Source File: SynthMenuItemUI.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Dimension getPreferredMenuItemSize(JComponent c,
                                                 Icon checkIcon,
                                                 Icon arrowIcon,
                                                 int defaultTextIconGap) {
    SynthContext context = getContext(c);
    SynthContext accContext = getContext(c, Region.MENU_ITEM_ACCELERATOR);
    Dimension value = SynthGraphicsUtils.getPreferredMenuItemSize(
            context, accContext, c, checkIcon, arrowIcon,
            defaultTextIconGap, acceleratorDelimiter,
            MenuItemLayoutHelper.useCheckAndArrow(menuItem),
            getPropertyPrefix());
    context.dispose();
    accContext.dispose();
    return value;
}
 
Example #7
Source File: SynthGraphicsUtils.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
static void paintIcon(Graphics g, SynthMenuItemLayoutHelper lh,
                      MenuItemLayoutHelper.LayoutResult lr) {
    if (lh.getIcon() != null) {
        Icon icon;
        JMenuItem mi = lh.getMenuItem();
        ButtonModel model = mi.getModel();
        if (!model.isEnabled()) {
            icon = mi.getDisabledIcon();
        } else if (model.isPressed() && model.isArmed()) {
            icon = mi.getPressedIcon();
            if (icon == null) {
                // Use default icon
                icon = mi.getIcon();
            }
        } else {
            icon = mi.getIcon();
        }

        if (icon != null) {
            Rectangle iconRect = lr.getIconRect();
            SynthIcon.paintIcon(icon, lh.getContext(), g, iconRect.x,
                    iconRect.y, iconRect.width, iconRect.height);
        }
    }
}
 
Example #8
Source File: SynthGraphicsUtils.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
static void paint(SynthContext context, SynthContext accContext, Graphics g,
           Icon checkIcon, Icon arrowIcon, String acceleratorDelimiter,
           int defaultTextIconGap, String propertyPrefix) {
    JMenuItem mi = (JMenuItem) context.getComponent();
    SynthStyle style = context.getStyle();
    g.setFont(style.getFont(context));

    Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight());
    boolean leftToRight = SynthLookAndFeel.isLeftToRight(mi);
    applyInsets(viewRect, mi.getInsets(), leftToRight);

    SynthMenuItemLayoutHelper lh = new SynthMenuItemLayoutHelper(
            context, accContext, mi, checkIcon, arrowIcon, viewRect,
            defaultTextIconGap, acceleratorDelimiter, leftToRight,
            MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix);
    MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem();

    paintMenuItem(g, lh, lr);
}
 
Example #9
Source File: SynthMenuItemUI.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Dimension getPreferredMenuItemSize(JComponent c,
                                                 Icon checkIcon,
                                                 Icon arrowIcon,
                                                 int defaultTextIconGap) {
    SynthContext context = getContext(c);
    SynthContext accContext = getContext(c, Region.MENU_ITEM_ACCELERATOR);
    Dimension value = SynthGraphicsUtils.getPreferredMenuItemSize(
            context, accContext, c, checkIcon, arrowIcon,
            defaultTextIconGap, acceleratorDelimiter,
            MenuItemLayoutHelper.useCheckAndArrow(menuItem),
            getPropertyPrefix());
    context.dispose();
    accContext.dispose();
    return value;
}
 
Example #10
Source File: SynthGraphicsUtils.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static void paintMenuItem(Graphics g, SynthMenuItemLayoutHelper lh,
                          MenuItemLayoutHelper.LayoutResult lr) {
    // Save original graphics font and color
    Font holdf = g.getFont();
    Color holdc = g.getColor();

    paintCheckIcon(g, lh, lr);
    paintIcon(g, lh, lr);
    paintText(g, lh, lr);
    paintAccText(g, lh, lr);
    paintArrowIcon(g, lh, lr);

    // Restore original graphics font and color
    g.setColor(holdc);
    g.setFont(holdf);
}
 
Example #11
Source File: SynthMenuUI.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Dimension getPreferredMenuItemSize(JComponent c,
                                                 Icon checkIcon,
                                                 Icon arrowIcon,
                                                 int defaultTextIconGap) {
    SynthContext context = getContext(c);
    SynthContext accContext = getContext(c, Region.MENU_ITEM_ACCELERATOR);
    Dimension value = SynthGraphicsUtils.getPreferredMenuItemSize(
            context, accContext, c, checkIcon, arrowIcon,
            defaultTextIconGap, acceleratorDelimiter,
            MenuItemLayoutHelper.useCheckAndArrow(menuItem),
            getPropertyPrefix());
    context.dispose();
    accContext.dispose();
    return value;
}
 
Example #12
Source File: SynthGraphicsUtils.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
static void paintMenuItem(Graphics g, SynthMenuItemLayoutHelper lh,
                          MenuItemLayoutHelper.LayoutResult lr) {
    // Save original graphics font and color
    Font holdf = g.getFont();
    Color holdc = g.getColor();

    paintCheckIcon(g, lh, lr);
    paintIcon(g, lh, lr);
    paintText(g, lh, lr);
    paintAccText(g, lh, lr);
    paintArrowIcon(g, lh, lr);

    // Restore original graphics font and color
    g.setColor(holdc);
    g.setFont(holdf);
}
 
Example #13
Source File: SynthMenuUI.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Dimension getPreferredMenuItemSize(JComponent c,
                                                 Icon checkIcon,
                                                 Icon arrowIcon,
                                                 int defaultTextIconGap) {
    SynthContext context = getContext(c);
    SynthContext accContext = getContext(c, Region.MENU_ITEM_ACCELERATOR);
    Dimension value = SynthGraphicsUtils.getPreferredMenuItemSize(
            context, accContext, c, checkIcon, arrowIcon,
            defaultTextIconGap, acceleratorDelimiter,
            MenuItemLayoutHelper.useCheckAndArrow(menuItem),
            getPropertyPrefix());
    context.dispose();
    accContext.dispose();
    return value;
}
 
Example #14
Source File: SynthGraphicsUtils.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static void paintIcon(Graphics g, SynthMenuItemLayoutHelper lh,
                      MenuItemLayoutHelper.LayoutResult lr) {
    if (lh.getIcon() != null) {
        Icon icon;
        JMenuItem mi = lh.getMenuItem();
        ButtonModel model = mi.getModel();
        if (!model.isEnabled()) {
            icon = mi.getDisabledIcon();
        } else if (model.isPressed() && model.isArmed()) {
            icon = mi.getPressedIcon();
            if (icon == null) {
                // Use default icon
                icon = mi.getIcon();
            }
        } else {
            icon = mi.getIcon();
        }

        if (icon != null) {
            Rectangle iconRect = lr.getIconRect();
            SynthIcon.paintIcon(icon, lh.getContext(), g, iconRect.x,
                    iconRect.y, iconRect.width, iconRect.height);
        }
    }
}
 
Example #15
Source File: SeaGlassGraphicsUtils.java    From seaglass with Apache License 2.0 6 votes vote down vote up
public static void paint(SynthContext context, SynthContext accContext, Graphics g, Icon checkIcon, Icon arrowIcon,
    String acceleratorDelimiter, int defaultTextIconGap, String propertyPrefix) {
    JMenuItem mi = (JMenuItem) context.getComponent();
    SynthStyle style = context.getStyle();
    g.setFont(style.getFont(context));

    Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight());
    boolean leftToRight = SeaGlassLookAndFeel.isLeftToRight(mi);
    applyInsets(viewRect, mi.getInsets(), leftToRight);

    SeaGlassMenuItemLayoutHelper lh = new SeaGlassMenuItemLayoutHelper(context, accContext, mi, checkIcon, arrowIcon, viewRect,
        defaultTextIconGap, acceleratorDelimiter, leftToRight, MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix);
    MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem();

    paintMenuItem(g, lh, lr);
}
 
Example #16
Source File: SynthMenuItemUI.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Dimension getPreferredMenuItemSize(JComponent c,
                                                 Icon checkIcon,
                                                 Icon arrowIcon,
                                                 int defaultTextIconGap) {
    SynthContext context = getContext(c);
    SynthContext accContext = getContext(c, Region.MENU_ITEM_ACCELERATOR);
    Dimension value = SynthGraphicsUtils.getPreferredMenuItemSize(
            context, accContext, c, checkIcon, arrowIcon,
            defaultTextIconGap, acceleratorDelimiter,
            MenuItemLayoutHelper.useCheckAndArrow(menuItem),
            getPropertyPrefix());
    context.dispose();
    accContext.dispose();
    return value;
}
 
Example #17
Source File: SynthMenuItemUI.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Dimension getPreferredMenuItemSize(JComponent c,
                                                 Icon checkIcon,
                                                 Icon arrowIcon,
                                                 int defaultTextIconGap) {
    SynthContext context = getContext(c);
    SynthContext accContext = getContext(c, Region.MENU_ITEM_ACCELERATOR);
    Dimension value = SynthGraphicsUtils.getPreferredMenuItemSize(
            context, accContext, c, checkIcon, arrowIcon,
            defaultTextIconGap, acceleratorDelimiter,
            MenuItemLayoutHelper.useCheckAndArrow(menuItem),
            getPropertyPrefix());
    context.dispose();
    accContext.dispose();
    return value;
}
 
Example #18
Source File: SynthGraphicsUtils.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
static void paint(SynthContext context, SynthContext accContext, Graphics g,
           Icon checkIcon, Icon arrowIcon, String acceleratorDelimiter,
           int defaultTextIconGap, String propertyPrefix) {
    JMenuItem mi = (JMenuItem) context.getComponent();
    SynthStyle style = context.getStyle();
    g.setFont(style.getFont(context));

    Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight());
    boolean leftToRight = SynthLookAndFeel.isLeftToRight(mi);
    applyInsets(viewRect, mi.getInsets(), leftToRight);

    SynthMenuItemLayoutHelper lh = new SynthMenuItemLayoutHelper(
            context, accContext, mi, checkIcon, arrowIcon, viewRect,
            defaultTextIconGap, acceleratorDelimiter, leftToRight,
            MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix);
    MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem();

    paintMenuItem(g, lh, lr);
}
 
Example #19
Source File: SynthGraphicsUtils.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
static void paintText(Graphics g, SynthMenuItemLayoutHelper lh,
                      MenuItemLayoutHelper.LayoutResult lr) {
    if (!lh.getText().equals("")) {
        if (lh.getHtmlView() != null) {
            // Text is HTML
            lh.getHtmlView().paint(g, lr.getTextRect());
        } else {
            // Text isn't HTML
            g.setColor(lh.getStyle().getColor(
                    lh.getContext(), ColorType.TEXT_FOREGROUND));
            g.setFont(lh.getStyle().getFont(lh.getContext()));
            lh.getGraphicsUtils().paintText(lh.getContext(), g, lh.getText(),
                    lr.getTextRect().x, lr.getTextRect().y,
                    lh.getMenuItem().getDisplayedMnemonicIndex());
        }
    }
}
 
Example #20
Source File: SeaGlassGraphicsUtils.java    From seaglass with Apache License 2.0 6 votes vote down vote up
static void paintText(Graphics g, SeaGlassMenuItemLayoutHelper lh,
                      MenuItemLayoutHelper.LayoutResult lr) {
    if (!lh.getText().equals("")) {
        if (lh.getHtmlView() != null) {
            // Text is HTML
            lh.getHtmlView().paint(g, lr.getTextRect());
        } else {
            // Text isn't HTML
            g.setColor(lh.getStyle().getColor(
                    lh.getContext(), ColorType.TEXT_FOREGROUND));
            g.setFont(lh.getStyle().getFont(lh.getContext()));
            lh.getGraphicsUtils().paintText(lh.getContext(), g, lh.getText(),
                    lr.getTextRect().x, lr.getTextRect().y,
                    lh.getMenuItem().getDisplayedMnemonicIndex());
        }
    }
}
 
Example #21
Source File: SynthGraphicsUtils.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
static void paintMenuItem(Graphics g, SynthMenuItemLayoutHelper lh,
                          MenuItemLayoutHelper.LayoutResult lr) {
    // Save original graphics font and color
    Font holdf = g.getFont();
    Color holdc = g.getColor();

    paintCheckIcon(g, lh, lr);
    paintIcon(g, lh, lr);
    paintText(g, lh, lr);
    paintAccText(g, lh, lr);
    paintArrowIcon(g, lh, lr);

    // Restore original graphics font and color
    g.setColor(holdc);
    g.setFont(holdf);
}
 
Example #22
Source File: SynthGraphicsUtils.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static void paintIcon(Graphics g, SynthMenuItemLayoutHelper lh,
                      MenuItemLayoutHelper.LayoutResult lr) {
    if (lh.getIcon() != null) {
        Icon icon;
        JMenuItem mi = lh.getMenuItem();
        ButtonModel model = mi.getModel();
        if (!model.isEnabled()) {
            icon = mi.getDisabledIcon();
        } else if (model.isPressed() && model.isArmed()) {
            icon = mi.getPressedIcon();
            if (icon == null) {
                // Use default icon
                icon = mi.getIcon();
            }
        } else {
            icon = mi.getIcon();
        }

        if (icon != null) {
            Rectangle iconRect = lr.getIconRect();
            SynthIcon.paintIcon(icon, lh.getContext(), g, iconRect.x,
                    iconRect.y, iconRect.width, iconRect.height);
        }
    }
}
 
Example #23
Source File: SynthMenuItemUI.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Dimension getPreferredMenuItemSize(JComponent c,
                                                 Icon checkIcon,
                                                 Icon arrowIcon,
                                                 int defaultTextIconGap) {
    SynthContext context = getContext(c);
    SynthContext accContext = getContext(c, Region.MENU_ITEM_ACCELERATOR);
    Dimension value = SynthGraphicsUtils.getPreferredMenuItemSize(
            context, accContext, c, checkIcon, arrowIcon,
            defaultTextIconGap, acceleratorDelimiter,
            MenuItemLayoutHelper.useCheckAndArrow(menuItem),
            getPropertyPrefix());
    context.dispose();
    accContext.dispose();
    return value;
}
 
Example #24
Source File: SynthGraphicsUtils.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
static void paintIcon(Graphics g, SynthMenuItemLayoutHelper lh,
                      MenuItemLayoutHelper.LayoutResult lr) {
    if (lh.getIcon() != null) {
        Icon icon;
        JMenuItem mi = lh.getMenuItem();
        ButtonModel model = mi.getModel();
        if (!model.isEnabled()) {
            icon = mi.getDisabledIcon();
        } else if (model.isPressed() && model.isArmed()) {
            icon = mi.getPressedIcon();
            if (icon == null) {
                // Use default icon
                icon = mi.getIcon();
            }
        } else {
            icon = mi.getIcon();
        }

        if (icon != null) {
            Rectangle iconRect = lr.getIconRect();
            SynthIcon.paintIcon(icon, lh.getContext(), g, iconRect.x,
                    iconRect.y, iconRect.width, iconRect.height);
        }
    }
}
 
Example #25
Source File: SynthGraphicsUtils.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
static void paint(SynthContext context, SynthContext accContext, Graphics g,
           Icon checkIcon, Icon arrowIcon, String acceleratorDelimiter,
           int defaultTextIconGap, String propertyPrefix) {
    JMenuItem mi = (JMenuItem) context.getComponent();
    SynthStyle style = context.getStyle();
    g.setFont(style.getFont(context));

    Rectangle viewRect = new Rectangle(0, 0, mi.getWidth(), mi.getHeight());
    boolean leftToRight = SynthLookAndFeel.isLeftToRight(mi);
    applyInsets(viewRect, mi.getInsets(), leftToRight);

    SynthMenuItemLayoutHelper lh = new SynthMenuItemLayoutHelper(
            context, accContext, mi, checkIcon, arrowIcon, viewRect,
            defaultTextIconGap, acceleratorDelimiter, leftToRight,
            MenuItemLayoutHelper.useCheckAndArrow(mi), propertyPrefix);
    MenuItemLayoutHelper.LayoutResult lr = lh.layoutMenuItem();

    paintMenuItem(g, lh, lr);
}
 
Example #26
Source File: SynthMenuUI.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Dimension getPreferredMenuItemSize(JComponent c,
                                                 Icon checkIcon,
                                                 Icon arrowIcon,
                                                 int defaultTextIconGap) {
    SynthContext context = getContext(c);
    SynthContext accContext = getContext(c, Region.MENU_ITEM_ACCELERATOR);
    Dimension value = SynthGraphicsUtils.getPreferredMenuItemSize(
            context, accContext, c, checkIcon, arrowIcon,
            defaultTextIconGap, acceleratorDelimiter,
            MenuItemLayoutHelper.useCheckAndArrow(menuItem),
            getPropertyPrefix());
    context.dispose();
    accContext.dispose();
    return value;
}
 
Example #27
Source File: SynthGraphicsUtils.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
static void paintCheckIcon(Graphics g, SynthMenuItemLayoutHelper lh,
                           MenuItemLayoutHelper.LayoutResult lr) {
    if (lh.getCheckIcon() != null) {
        Rectangle checkRect = lr.getCheckRect();
        SynthIcon.paintIcon(lh.getCheckIcon(), lh.getContext(), g,
                checkRect.x, checkRect.y, checkRect.width, checkRect.height);
    }
}
 
Example #28
Source File: SynthGraphicsUtils.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static void paintAccText(Graphics g, SynthMenuItemLayoutHelper lh,
                         MenuItemLayoutHelper.LayoutResult lr) {
    String accText = lh.getAccText();
    if (accText != null && !accText.equals("")) {
        g.setColor(lh.getAccStyle().getColor(lh.getAccContext(),
                ColorType.TEXT_FOREGROUND));
        g.setFont(lh.getAccStyle().getFont(lh.getAccContext()));
        lh.getAccGraphicsUtils().paintText(lh.getAccContext(), g, accText,
                lr.getAccRect().x, lr.getAccRect().y, -1);
    }
}
 
Example #29
Source File: SynthGraphicsUtils.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static void paintArrowIcon(Graphics g, SynthMenuItemLayoutHelper lh,
                           MenuItemLayoutHelper.LayoutResult lr) {
    if (lh.getArrowIcon() != null) {
        Rectangle arrowRect = lr.getArrowRect();
        SynthIcon.paintIcon(lh.getArrowIcon(), lh.getContext(), g,
                arrowRect.x, arrowRect.y, arrowRect.width, arrowRect.height);
    }
}
 
Example #30
Source File: SynthMenuUI.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public void uninstallUI(JComponent c) {
    super.uninstallUI(c);
    // Remove values from the parent's Client Properties.
    JComponent p = MenuItemLayoutHelper.getMenuItemParent((JMenuItem) c);
    if (p != null) {
        p.putClientProperty(
                SynthMenuItemLayoutHelper.MAX_ACC_OR_ARROW_WIDTH, null);
    }
}