< prev index next >
src/java.desktop/windows/classes/sun/awt/windows/WToolkit.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -45,10 +45,11 @@
import sun.awt.AWTAccessor;
import sun.awt.AppContext;
import sun.awt.AWTAutoShutdown;
import sun.awt.AWTPermissions;
import sun.awt.AppContext;
+import sun.awt.DisplayChangedListener;
import sun.awt.LightweightFrame;
import sun.awt.SunToolkit;
import sun.awt.util.ThreadGroupUtils;
import sun.awt.Win32GraphicsDevice;
import sun.awt.Win32GraphicsEnvironment;
@@ -800,13 +801,14 @@
@Override
public native int getMaximumCursorColors();
static void paletteChanged() {
- ((Win32GraphicsEnvironment)GraphicsEnvironment
- .getLocalGraphicsEnvironment())
- .paletteChanged();
+ Object lge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ if (lge instanceof DisplayChangedListener) {
+ ((DisplayChangedListener) lge).paletteChanged();
+ }
}
/*
* Called from Toolkit native code when a WM_DISPLAYCHANGE occurs.
* Have Win32GraphicsEnvironment execute the display change code on the
@@ -814,13 +816,14 @@
*/
public static void displayChanged() {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
- ((Win32GraphicsEnvironment)GraphicsEnvironment
- .getLocalGraphicsEnvironment())
- .displayChanged();
+ Object lge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ if (lge instanceof DisplayChangedListener) {
+ ((DisplayChangedListener) lge).displayChanged();
+ }
}
});
}
/**
< prev index next >