Search in sources :

Example 1 with CGraphicsDevice

use of sun.awt.CGraphicsDevice 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)

Aggregations

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