--- old/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java 2019-12-19 09:50:36.000000000 +0300 +++ new/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java 2019-12-19 09:50:36.000000000 +0300 @@ -102,7 +102,6 @@ import com.apple.laf.AquaMenuBarUI; import sun.awt.AWTAccessor; import sun.awt.AppContext; -import sun.awt.CGraphicsConfig; import sun.awt.CGraphicsDevice; import sun.awt.LightweightFrame; import sun.awt.PlatformGraphicsInfo; @@ -479,7 +478,11 @@ @Override public Insets getScreenInsets(final GraphicsConfiguration gc) { - return ((CGraphicsConfig) gc).getDevice().getScreenInsets(); + GraphicsDevice gd = gc.getDevice(); + if (!(gd instanceof CGraphicsDevice)) { + return super.getScreenInsets(gc); + } + return ((CGraphicsDevice)gd).getScreenInsets(); } @Override