Java Code Examples for sun.java2d.ScreenUpdateManager#createGraphics()

The following examples show how to use sun.java2d.ScreenUpdateManager#createGraphics() . 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: WComponentPeer.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
@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;
}
 
Example 2
Source File: WComponentPeer.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@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;
}
 
Example 3
Source File: WComponentPeer.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@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;
}
 
Example 4
Source File: WComponentPeer.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@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;
}
 
Example 5
Source File: WComponentPeer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@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;
}
 
Example 6
Source File: WComponentPeer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@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;
}
 
Example 7
Source File: WComponentPeer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@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;
}
 
Example 8
Source File: WComponentPeer.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@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;
}
 
Example 9
Source File: WComponentPeer.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@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;
}
 
Example 10
Source File: WComponentPeer.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@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;
}
 
Example 11
Source File: WComponentPeer.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
@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;
}
 
Example 12
Source File: WComponentPeer.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@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;
}
 
Example 13
Source File: WComponentPeer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
@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;
}