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


Java ModalExclude类代码示例

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


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

示例1: paintPopupMenuBackground

import sun.awt.ModalExclude; //导入依赖的package包/类
public void paintPopupMenuBackground(SynthContext context, Graphics g,
                                    int x, int y, int w, int h) {
    Region id = context.getRegion();
    int gtkState = GTKLookAndFeel.synthStateToGTKState(
            id, context.getComponentState());
    boolean isHW = SunToolkit.getHeavyweightComponent(
            context.getComponent()) instanceof ModalExclude;
    synchronized (UNIXToolkit.GTK_LOCK) {
        if (ENGINE.paintCachedImage(g, x, y, w, h, id, gtkState, isHW)) {
            return;
        }
        ENGINE.startPainting(g, x, y, w, h, id, gtkState);
        ENGINE.paintBox(g, context, id, gtkState,
                ShadowType.OUT, "menu", x, y, w, h);

        GTKStyle style = (GTKStyle)context.getStyle();
        Insets insets = style.getInsets(context, null);
        ENGINE.paintBackground(g, context, id, gtkState,
            style.getGTKColor(context, gtkState, GTKColorType.BACKGROUND),
            x + insets.left, y + insets.top, w - insets.left - insets.right,
            h - insets.top - insets.bottom);
        BufferedImage img = ENGINE.finishPainting();
        if(!isHW) {
            int border = img.getRGB(0, h / 2);
            if (img != null && border == img.getRGB(w / 2, h / 2)) {
                // fix no menu borders in Adwaita theme
                Graphics g2 = img.getGraphics();
                Color c = new Color(border);
                g2.setColor(new Color(Math.max((int) (c.getRed() * 0.8), 0),
                        Math.max((int) (c.getGreen() * 0.8), 0),
                        Math.max((int) (c.getBlue() * 0.8), 0)));
                g2.drawLine(0, 0, w - 1, 0);
                g2.drawLine(w - 1, 0, w - 1, h - 1);
                g2.drawLine(0, h - 1, 0, 1);
                g2.setColor(c.darker());
                g2.drawLine(w - 1, h - 1, 0, h - 1);
                g2.dispose();
                g.drawImage(img, x, y, null);
            }
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:43,代码来源:GTKPainter.java


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