Search in sources :

Example 1 with CGraphicsEnvironment

use of sun.awt.CGraphicsEnvironment in project jdk8u_jdk by JetBrains.

the class CPlatformLWWindow method getGraphicsDevice.

@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();
}
Also used : LightweightFrame(sun.awt.LightweightFrame) LWLightweightFramePeer(sun.lwawt.LWLightweightFramePeer) GraphicsDevice(java.awt.GraphicsDevice) CGraphicsDevice(sun.awt.CGraphicsDevice) Rectangle(java.awt.Rectangle) CGraphicsEnvironment(sun.awt.CGraphicsEnvironment) CGraphicsDevice(sun.awt.CGraphicsDevice) Point(java.awt.Point)

Example 2 with CGraphicsEnvironment

use of sun.awt.CGraphicsEnvironment in project jdk8u_jdk by JetBrains.

the class CPlatformView method getGraphicsDevice.

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;
}
Also used : CGraphicsEnvironment(sun.awt.CGraphicsEnvironment) CGraphicsEnvironment(sun.awt.CGraphicsEnvironment)

Aggregations

CGraphicsEnvironment (sun.awt.CGraphicsEnvironment)2 GraphicsDevice (java.awt.GraphicsDevice)1 Point (java.awt.Point)1 Rectangle (java.awt.Rectangle)1 CGraphicsDevice (sun.awt.CGraphicsDevice)1 LightweightFrame (sun.awt.LightweightFrame)1 LWLightweightFramePeer (sun.lwawt.LWLightweightFramePeer)1