当前位置: 首页>>代码示例>>Java>>正文


Java MenuItemLayoutHelper类代码示例

本文整理汇总了Java中sun.swing.MenuItemLayoutHelper的典型用法代码示例。如果您正苦于以下问题:Java MenuItemLayoutHelper类的具体用法?Java MenuItemLayoutHelper怎么用?Java MenuItemLayoutHelper使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MenuItemLayoutHelper类属于sun.swing包,在下文中一共展示了MenuItemLayoutHelper类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: paint

import sun.swing.MenuItemLayoutHelper; //导入依赖的package包/类
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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:SynthGraphicsUtils.java

示例2: paintMenuItem

import sun.swing.MenuItemLayoutHelper; //导入依赖的package包/类
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);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:17,代码来源:SynthGraphicsUtils.java

示例3: paintIcon

import sun.swing.MenuItemLayoutHelper; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:26,代码来源:SynthGraphicsUtils.java

示例4: paintText

import sun.swing.MenuItemLayoutHelper; //导入依赖的package包/类
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());
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:SynthGraphicsUtils.java

示例5: getPreferredMenuItemSize

import sun.swing.MenuItemLayoutHelper; //导入依赖的package包/类
/**
 * {@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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:SynthMenuItemUI.java

示例6: paintIcon

import sun.swing.MenuItemLayoutHelper; //导入依赖的package包/类
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();
            paintIcon(icon, lh.getContext(), g, iconRect.x,
                    iconRect.y, iconRect.width, iconRect.height);
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:26,代码来源:SynthGraphicsUtils.java

示例7: paintIcon

import sun.swing.MenuItemLayoutHelper; //导入依赖的package包/类
protected void paintIcon(Graphics g, MenuItemLayoutHelper lh,
                       MenuItemLayoutHelper.LayoutResult lr, Color holdc) {
    if (lh.getIcon() != null) {
        Icon icon;
        ButtonModel model = lh.getMenuItem().getModel();
        if (!model.isEnabled()) {
            icon = lh.getMenuItem().getDisabledIcon();
        } else if (model.isPressed() && model.isArmed()) {
            icon = lh.getMenuItem().getPressedIcon();
            if (icon == null) {
                // Use default icon
                icon = lh.getMenuItem().getIcon();
            }
        } else {
            icon = lh.getMenuItem().getIcon();
        }

        if (icon != null) {
            icon.paintIcon(lh.getMenuItem(), g, lr.getIconRect().x,
                    lr.getIconRect().y);
            g.setColor(holdc);
        }
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:DarculaMenuItemUIBase.java

示例8: paintCheckIcon

import sun.swing.MenuItemLayoutHelper; //导入依赖的package包/类
protected void paintCheckIcon(Graphics g, MenuItemLayoutHelper lh,
                            MenuItemLayoutHelper.LayoutResult lr,
                            Color holdc, Color foreground) {
    if (lh.getCheckIcon() != null) {
        ButtonModel model = lh.getMenuItem().getModel();
        if (model.isArmed() || (lh.getMenuItem() instanceof JMenu
                && model.isSelected())) {
            g.setColor(foreground);
        } else {
            g.setColor(holdc);
        }
        if (lh.useCheckAndArrow()) {
            lh.getCheckIcon().paintIcon(lh.getMenuItem(), g,
                    lr.getCheckRect().x, lr.getCheckRect().y);
        }
        g.setColor(holdc);
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:DarculaMenuItemUIBase.java


注:本文中的sun.swing.MenuItemLayoutHelper类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。