static {
   // Ensure awt is loaded already.  Also, this forces static init
   // of WToolkit and Toolkit, which we depend upon
   WToolkit.loadLibraries();
   // setup flags before initializing native layer
   WindowsFlags.initFlags();
   initDisplayWrapper();
   eudcFontFileName = getEUDCFontFile();
 }
  /*
   * From DisplayChangeListener interface.
   * Called from WToolkit and executed on the event thread when the
   * display settings are changed.
   */
  @Override
  public void displayChanged() {
    // getNumScreens() will return the correct current number of screens
    GraphicsDevice newDevices[] = new GraphicsDevice[getNumScreens()];
    GraphicsDevice oldScreens[] = screens;
    // go through the list of current devices and determine if they
    // could be reused, or will have to be replaced
    if (oldScreens != null) {
      for (int i = 0; i < oldScreens.length; i++) {
        if (!(screens[i] instanceof Win32GraphicsDevice)) {
          // REMIND: can we ever have anything other than Win32GD?
          assert (false) : oldScreens[i];
          continue;
        }
        Win32GraphicsDevice gd = (Win32GraphicsDevice) oldScreens[i];
        // devices may be invalidated from the native code when the
        // display change happens (device add/removal also causes a
        // display change)
        if (!gd.isValid()) {
          if (oldDevices == null) {
            oldDevices = new ArrayList<WeakReference<Win32GraphicsDevice>>();
          }
          oldDevices.add(new WeakReference<Win32GraphicsDevice>(gd));
        } else if (i < newDevices.length) {
          // reuse the device
          newDevices[i] = gd;
        }
      }
      oldScreens = null;
    }
    // create the new devices (those that weren't reused)
    for (int i = 0; i < newDevices.length; i++) {
      if (newDevices[i] == null) {
        newDevices[i] = makeScreenDevice(i);
      }
    }
    // install the new array of devices
    // Note: no synchronization here, it doesn't matter if a thread gets
    // a new or an old array this time around
    screens = newDevices;
    for (GraphicsDevice gd : screens) {
      if (gd instanceof DisplayChangedListener) {
        ((DisplayChangedListener) gd).displayChanged();
      }
    }
    // re-invalidate all old devices. It's needed because those in the list
    // may become "invalid" again - if the current default device is removed,
    // for example. Also, they need to be notified about display
    // changes as well.
    if (oldDevices != null) {
      int defScreen = getDefaultScreen();
      for (ListIterator<WeakReference<Win32GraphicsDevice>> it = oldDevices.listIterator();
          it.hasNext(); ) {
        Win32GraphicsDevice gd = it.next().get();
        if (gd != null) {
          gd.invalidate(defScreen);
          gd.displayChanged();
        } else {
          // no more references to this device, remove it
          it.remove();
        }
      }
    }
    // Reset the static GC for the (possibly new) default screen
    WToolkit.resetGC();

    // notify SunDisplayChanger list (e.g. VolatileSurfaceManagers and
    // CachingSurfaceManagers) about the display change event
    displayChanger.notifyListeners();
    // note: do not call super.displayChanged, we've already done everything
  }