sun.awt.CGraphicsEnvironment Java Examples

The following examples show how to use sun.awt.CGraphicsEnvironment. 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: CPlatformLWWindow.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public GraphicsDevice getGraphicsDevice() {
    CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
                              getLocalGraphicsEnvironment();

    LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
    int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();

    Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
    for (GraphicsDevice d : ge.getScreenDevices()) {
        if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
            ((CGraphicsDevice)d).getScaleFactor() == scale)
        {
            return d;
        }
    }
    // We shouldn't be here...
    return ge.getDefaultScreenDevice();
}
 
Example #2
Source File: CPlatformLWWindow.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public GraphicsDevice getGraphicsDevice() {
    CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
                              getLocalGraphicsEnvironment();

    LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
    int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();

    Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
    for (GraphicsDevice d : ge.getScreenDevices()) {
        if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
            ((CGraphicsDevice)d).getScaleFactor() == scale)
        {
            return d;
        }
    }
    // We shouldn't be here...
    return ge.getDefaultScreenDevice();
}
 
Example #3
Source File: CPlatformLWWindow.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public GraphicsDevice getGraphicsDevice() {
    CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
                              getLocalGraphicsEnvironment();

    LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
    int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();

    Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
    for (GraphicsDevice d : ge.getScreenDevices()) {
        if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
            ((CGraphicsDevice)d).getScaleFactor() == scale)
        {
            return d;
        }
    }
    // We shouldn't be here...
    return ge.getDefaultScreenDevice();
}
 
Example #4
Source File: CPlatformLWWindow.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public GraphicsDevice getGraphicsDevice() {
    CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
                              getLocalGraphicsEnvironment();

    LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
    int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();

    Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
    for (GraphicsDevice d : ge.getScreenDevices()) {
        if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
            ((CGraphicsDevice)d).getScaleFactor() == scale)
        {
            return d;
        }
    }
    // We shouldn't be here...
    return ge.getDefaultScreenDevice();
}
 
Example #5
Source File: CPlatformLWWindow.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
@Override
public GraphicsDevice getGraphicsDevice() {
    CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
                              getLocalGraphicsEnvironment();

    LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
    int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();

    Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
    for (GraphicsDevice d : ge.getScreenDevices()) {
        if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
            ((CGraphicsDevice)d).getScaleFactor() == scale)
        {
            return d;
        }
    }
    // We shouldn't be here...
    return ge.getDefaultScreenDevice();
}
 
Example #6
Source File: CPlatformLWWindow.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
public GraphicsDevice getGraphicsDevice() {
    CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
                              getLocalGraphicsEnvironment();

    LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
    int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();

    Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
    for (GraphicsDevice d : ge.getScreenDevices()) {
        if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
            ((CGraphicsDevice)d).getScaleFactor() == scale)
        {
            return d;
        }
    }
    // We shouldn't be here...
    return ge.getDefaultScreenDevice();
}
 
Example #7
Source File: CPlatformLWWindow.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public GraphicsDevice getGraphicsDevice() {
    CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
                              getLocalGraphicsEnvironment();

    LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
    int scale =(int) Math.round(((LightweightFrame)peer.getTarget())
                                                        .getScaleFactorX());

    Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
    for (GraphicsDevice d : ge.getScreenDevices()) {
        if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
            ((CGraphicsDevice)d).getScaleFactor() == scale)
        {
            return d;
        }
    }
    // We shouldn't be here...
    return ge.getDefaultScreenDevice();
}
 
Example #8
Source File: CPlatformLWWindow.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
public GraphicsDevice getGraphicsDevice() {
    CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
                              getLocalGraphicsEnvironment();

    LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
    int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();

    Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
    for (GraphicsDevice d : ge.getScreenDevices()) {
        if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
            ((CGraphicsDevice)d).getScaleFactor() == scale)
        {
            return d;
        }
    }
    // We shouldn't be here...
    return ge.getDefaultScreenDevice();
}
 
Example #9
Source File: CPlatformLWWindow.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
@Override
public GraphicsDevice getGraphicsDevice() {
    CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
                              getLocalGraphicsEnvironment();

    LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
    int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();

    Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
    for (GraphicsDevice d : ge.getScreenDevices()) {
        if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
            ((CGraphicsDevice)d).getScaleFactor() == scale)
        {
            return d;
        }
    }
    // We shouldn't be here...
    return ge.getDefaultScreenDevice();
}
 
Example #10
Source File: CPlatformLWWindow.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public GraphicsDevice getGraphicsDevice() {
    CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
                              getLocalGraphicsEnvironment();

    LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
    int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();

    Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
    for (GraphicsDevice d : ge.getScreenDevices()) {
        if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
            ((CGraphicsDevice)d).getScaleFactor() == scale)
        {
            return d;
        }
    }
    // We shouldn't be here...
    return ge.getDefaultScreenDevice();
}
 
Example #11
Source File: CPlatformLWWindow.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public GraphicsDevice getGraphicsDevice() {
    CGraphicsEnvironment ge = (CGraphicsEnvironment)GraphicsEnvironment.
                              getLocalGraphicsEnvironment();

    LWLightweightFramePeer peer = (LWLightweightFramePeer)getPeer();
    int scale = ((LightweightFrame)peer.getTarget()).getScaleFactor();

    Rectangle bounds = ((LightweightFrame)peer.getTarget()).getHostBounds();
    for (GraphicsDevice d : ge.getScreenDevices()) {
        if (d.getDefaultConfiguration().getBounds().intersects(bounds) &&
            ((CGraphicsDevice)d).getScaleFactor() == scale)
        {
            return d;
        }
    }
    // We shouldn't be here...
    return ge.getDefaultScreenDevice();
}
 
Example #12
Source File: CPlatformView.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public GraphicsDevice getGraphicsDevice() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
    AtomicInteger ref = new AtomicInteger();
    execute(ptr -> {
        ref.set(nativeGetNSViewDisplayID(ptr));
    });
    GraphicsDevice gd = cge.getScreenDevice(ref.get());
    if (gd == null) {
        // this could possibly happen during device removal
        // use the default screen device in this case
        gd = ge.getDefaultScreenDevice();
    }
    return gd;
}
 
Example #13
Source File: CPlatformView.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public GraphicsDevice getGraphicsDevice() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
    AtomicInteger ref = new AtomicInteger();
    execute(ptr -> {
        ref.set(nativeGetNSViewDisplayID(ptr));
    });
    GraphicsDevice gd = cge.getScreenDevice(ref.get());
    if (gd == null) {
        // this could possibly happen during device removal
        // use the default screen device in this case
        gd = ge.getDefaultScreenDevice();
    }
    return gd;
}
 
Example #14
Source File: CPlatformView.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public GraphicsDevice getGraphicsDevice() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
    AtomicInteger ref = new AtomicInteger();
    execute(ptr -> {
        ref.set(nativeGetNSViewDisplayID(ptr));
    });
    GraphicsDevice gd = cge.getScreenDevice(ref.get());
    if (gd == null) {
        // this could possibly happen during device removal
        // use the default screen device in this case
        gd = ge.getDefaultScreenDevice();
    }
    return gd;
}
 
Example #15
Source File: CPlatformView.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public GraphicsDevice getGraphicsDevice() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
    int displayID = nativeGetNSViewDisplayID(getAWTView());
    GraphicsDevice gd = cge.getScreenDevice(displayID);
    if (gd == null) {
        // this could possibly happen during device removal
        // use the default screen device in this case
        gd = ge.getDefaultScreenDevice();
    }
    return gd;
}
 
Example #16
Source File: CPlatformView.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public GraphicsDevice getGraphicsDevice() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
    int displayID = nativeGetNSViewDisplayID(getAWTView());
    GraphicsDevice gd = cge.getScreenDevice(displayID);
    if (gd == null) {
        // this could possibly happen during device removal
        // use the default screen device in this case
        gd = ge.getDefaultScreenDevice();
    }
    return gd;
}
 
Example #17
Source File: CPlatformView.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public GraphicsDevice getGraphicsDevice() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
    int displayID = nativeGetNSViewDisplayID(getAWTView());
    GraphicsDevice gd = cge.getScreenDevice(displayID);
    if (gd == null) {
        // this could possibly happen during device removal
        // use the default screen device in this case
        gd = ge.getDefaultScreenDevice();
    }
    return gd;
}
 
Example #18
Source File: CPlatformView.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public GraphicsDevice getGraphicsDevice() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
    int displayID = nativeGetNSViewDisplayID(getAWTView());
    GraphicsDevice gd = cge.getScreenDevice(displayID);
    if (gd == null) {
        // this could possibly happen during device removal
        // use the default screen device in this case
        gd = ge.getDefaultScreenDevice();
    }
    return gd;
}
 
Example #19
Source File: CPlatformView.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public GraphicsDevice getGraphicsDevice() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
    int displayID = nativeGetNSViewDisplayID(getAWTView());
    GraphicsDevice gd = cge.getScreenDevice(displayID);
    if (gd == null) {
        // this could possibly happen during device removal
        // use the default screen device in this case
        gd = ge.getDefaultScreenDevice();
    }
    return gd;
}
 
Example #20
Source File: CPlatformView.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public GraphicsDevice getGraphicsDevice() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
    AtomicInteger ref = new AtomicInteger();
    execute(ptr -> {
        ref.set(nativeGetNSViewDisplayID(ptr));
    });
    GraphicsDevice gd = cge.getScreenDevice(ref.get());
    if (gd == null) {
        // this could possibly happen during device removal
        // use the default screen device in this case
        gd = ge.getDefaultScreenDevice();
    }
    return gd;
}
 
Example #21
Source File: CPlatformView.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public GraphicsDevice getGraphicsDevice() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
    int displayID = nativeGetNSViewDisplayID(getAWTView());
    GraphicsDevice gd = cge.getScreenDevice(displayID);
    if (gd == null) {
        // this could possibly happen during device removal
        // use the default screen device in this case
        gd = ge.getDefaultScreenDevice();
    }
    return gd;
}
 
Example #22
Source File: CPlatformView.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public GraphicsDevice getGraphicsDevice() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
    AtomicInteger ref = new AtomicInteger();
    execute(ptr -> {
        ref.set(nativeGetNSViewDisplayID(ptr));
    });
    GraphicsDevice gd = cge.getScreenDevice(ref.get());
    if (gd == null) {
        // this could possibly happen during device removal
        // use the default screen device in this case
        gd = ge.getDefaultScreenDevice();
    }
    return gd;
}
 
Example #23
Source File: CPlatformView.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public GraphicsDevice getGraphicsDevice() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
    int displayID = nativeGetNSViewDisplayID(getAWTView());
    GraphicsDevice gd = cge.getScreenDevice(displayID);
    if (gd == null) {
        // this could possibly happen during device removal
        // use the default screen device in this case
        gd = ge.getDefaultScreenDevice();
    }
    return gd;
}
 
Example #24
Source File: CPlatformView.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public GraphicsDevice getGraphicsDevice() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    CGraphicsEnvironment cge = (CGraphicsEnvironment)ge;
    AtomicInteger ref = new AtomicInteger();
    execute(ptr -> {
        ref.set(nativeGetNSViewDisplayID(ptr));
    });
    GraphicsDevice gd = cge.getScreenDevice(ref.get());
    if (gd == null) {
        // this could possibly happen during device removal
        // use the default screen device in this case
        gd = ge.getDefaultScreenDevice();
    }
    return gd;
}