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


Java ScreenUpdateManager.createGraphics方法代码示例

本文整理汇总了Java中sun.java2d.ScreenUpdateManager.createGraphics方法的典型用法代码示例。如果您正苦于以下问题:Java ScreenUpdateManager.createGraphics方法的具体用法?Java ScreenUpdateManager.createGraphics怎么用?Java ScreenUpdateManager.createGraphics使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.java2d.ScreenUpdateManager的用法示例。


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

示例1: getGraphics

import sun.java2d.ScreenUpdateManager; //导入方法依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public Graphics getGraphics() {
    if (isDisposed()) {
        return null;
    }

    Component target = (Component)getTarget();
    Window window = SunToolkit.getContainingWindow(target);
    if (window != null) {
        Graphics g =
            ((WWindowPeer)window.getPeer()).getTranslucentGraphics();
        // getTranslucentGraphics() returns non-null value for non-opaque windows only
        if (g != null) {
            // Non-opaque windows do not support heavyweight children.
            // Redirect all painting to the Window's Graphics instead.
            // The caller is responsible for calling the
            // WindowPeer.updateWindow() after painting has finished.
            int x = 0, y = 0;
            for (Component c = target; c != window; c = c.getParent()) {
                x += c.getX();
                y += c.getY();
            }

            g.translate(x, y);
            g.clipRect(0, 0, target.getWidth(), target.getHeight());

            return g;
        }
    }

    SurfaceData surfaceData = this.surfaceData;
    if (surfaceData != null) {
        /* Fix for bug 4746122. Color and Font shouldn't be null */
        Color bgColor = background;
        if (bgColor == null) {
            bgColor = SystemColor.window;
        }
        Color fgColor = foreground;
        if (fgColor == null) {
            fgColor = SystemColor.windowText;
        }
        Font font = this.font;
        if (font == null) {
            font = defaultFont;
        }
        ScreenUpdateManager mgr =
            ScreenUpdateManager.getInstance();
        return mgr.createGraphics(surfaceData, this, fgColor,
                                  bgColor, font);
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:54,代码来源:WComponentPeer.java

示例2: getGraphics

import sun.java2d.ScreenUpdateManager; //导入方法依赖的package包/类
@Override
public Graphics getGraphics() {
    if (isDisposed()) {
        return null;
    }

    Component target = (Component)getTarget();
    Window window = SunToolkit.getContainingWindow(target);
    if (window != null) {
        final WWindowPeer wpeer = AWTAccessor.getComponentAccessor()
                                             .getPeer(window);
        Graphics g = wpeer.getTranslucentGraphics();
        // getTranslucentGraphics() returns non-null value for non-opaque windows only
        if (g != null) {
            // Non-opaque windows do not support heavyweight children.
            // Redirect all painting to the Window's Graphics instead.
            // The caller is responsible for calling the
            // WindowPeer.updateWindow() after painting has finished.
            int x = 0, y = 0;
            for (Component c = target; c != window; c = c.getParent()) {
                x += c.getX();
                y += c.getY();
            }

            g.translate(x, y);
            g.clipRect(0, 0, target.getWidth(), target.getHeight());

            return g;
        }
    }

    SurfaceData surfaceData = this.surfaceData;
    if (surfaceData != null) {
        /* Fix for bug 4746122. Color and Font shouldn't be null */
        Color bgColor = background;
        if (bgColor == null) {
            bgColor = SystemColor.window;
        }
        Color fgColor = foreground;
        if (fgColor == null) {
            fgColor = SystemColor.windowText;
        }
        Font font = this.font;
        if (font == null) {
            font = defaultFont;
        }
        ScreenUpdateManager mgr =
            ScreenUpdateManager.getInstance();
        return mgr.createGraphics(surfaceData, this, fgColor,
                                  bgColor, font);
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:54,代码来源:WComponentPeer.java

示例3: getGraphics

import sun.java2d.ScreenUpdateManager; //导入方法依赖的package包/类
public Graphics getGraphics() {
    if (isDisposed()) {
        return null;
    }

    Component target = (Component)getTarget();
    Window window = SunToolkit.getContainingWindow(target);
    if (window != null) {
        Graphics g =
            ((WWindowPeer)window.getPeer()).getTranslucentGraphics();
        // getTranslucentGraphics() returns non-null value for non-opaque windows only
        if (g != null) {
            // Non-opaque windows do not support heavyweight children.
            // Redirect all painting to the Window's Graphics instead.
            // The caller is responsible for calling the
            // WindowPeer.updateWindow() after painting has finished.
            int x = 0, y = 0;
            for (Component c = target; c != window; c = c.getParent()) {
                x += c.getX();
                y += c.getY();
            }

            g.translate(x, y);
            g.clipRect(0, 0, target.getWidth(), target.getHeight());

            return g;
        }
    }

    SurfaceData surfaceData = this.surfaceData;
    if (surfaceData != null) {
        /* Fix for bug 4746122. Color and Font shouldn't be null */
        Color bgColor = background;
        if (bgColor == null) {
            bgColor = SystemColor.window;
        }
        Color fgColor = foreground;
        if (fgColor == null) {
            fgColor = SystemColor.windowText;
        }
        Font font = this.font;
        if (font == null) {
            font = defaultFont;
        }
        ScreenUpdateManager mgr =
            ScreenUpdateManager.getInstance();
        return mgr.createGraphics(surfaceData, this, fgColor,
                                  bgColor, font);
    }
    return null;
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:52,代码来源:WComponentPeer.java

示例4: getGraphics

import sun.java2d.ScreenUpdateManager; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
public Graphics getGraphics() {
    if (isDisposed()) {
        return null;
    }

    Component target = (Component)getTarget();
    Window window = SunToolkit.getContainingWindow(target);
    if (window != null) {
        Graphics g =
            ((WWindowPeer)window.getPeer()).getTranslucentGraphics();
        // getTranslucentGraphics() returns non-null value for non-opaque windows only
        if (g != null) {
            // Non-opaque windows do not support heavyweight children.
            // Redirect all painting to the Window's Graphics instead.
            // The caller is responsible for calling the
            // WindowPeer.updateWindow() after painting has finished.
            int x = 0, y = 0;
            for (Component c = target; c != window; c = c.getParent()) {
                x += c.getX();
                y += c.getY();
            }

            g.translate(x, y);
            g.clipRect(0, 0, target.getWidth(), target.getHeight());

            return g;
        }
    }

    SurfaceData surfaceData = this.surfaceData;
    if (surfaceData != null) {
        /* Fix for bug 4746122. Color and Font shouldn't be null */
        Color bgColor = background;
        if (bgColor == null) {
            bgColor = SystemColor.window;
        }
        Color fgColor = foreground;
        if (fgColor == null) {
            fgColor = SystemColor.windowText;
        }
        Font font = this.font;
        if (font == null) {
            font = defaultFont;
        }
        ScreenUpdateManager mgr =
            ScreenUpdateManager.getInstance();
        return mgr.createGraphics(surfaceData, this, fgColor,
                                  bgColor, font);
    }
    return null;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:53,代码来源:WComponentPeer.java


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