类sun.awt.ModalExclude源码实例Demo

下面列出了怎么用sun.awt.ModalExclude的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: dragonwell8_jdk   文件: GTKPainter.java
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();
        int xThickness = style.getXThickness();
        int yThickness = style.getYThickness();
        ENGINE.paintBackground(g, context, id, gtkState,
                style.getGTKColor(context, gtkState, GTKColorType.BACKGROUND),
                x + xThickness, y + yThickness,
                w - xThickness - xThickness, h - yThickness - yThickness);
        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);
            }
        }
    }
}
 
源代码2 项目: TencentKona-8   文件: GTKPainter.java
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();
        int xThickness = style.getXThickness();
        int yThickness = style.getYThickness();
        ENGINE.paintBackground(g, context, id, gtkState,
                style.getGTKColor(context, gtkState, GTKColorType.BACKGROUND),
                x + xThickness, y + yThickness,
                w - xThickness - xThickness, h - yThickness - yThickness);
        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);
            }
        }
    }
}
 
源代码3 项目: openjdk-jdk8u   文件: GTKPainter.java
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();
        int xThickness = style.getXThickness();
        int yThickness = style.getYThickness();
        ENGINE.paintBackground(g, context, id, gtkState,
                style.getGTKColor(context, gtkState, GTKColorType.BACKGROUND),
                x + xThickness, y + yThickness,
                w - xThickness - xThickness, h - yThickness - yThickness);
        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);
            }
        }
    }
}
 
源代码4 项目: Bytecoder   文件: GTKPainter.java
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);
            }
        }
    }
}
 
源代码5 项目: openjdk-jdk9   文件: GTKPainter.java
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);
            }
        }
    }
}
 
源代码6 项目: jdk8u_jdk   文件: GTKPainter.java
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();
        int xThickness = style.getXThickness();
        int yThickness = style.getYThickness();
        ENGINE.paintBackground(g, context, id, gtkState,
                style.getGTKColor(context, gtkState, GTKColorType.BACKGROUND),
                x + xThickness, y + yThickness,
                w - xThickness - xThickness, h - yThickness - yThickness);
        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);
            }
        }
    }
}
 
 类所在包
 类方法
 同包方法