Ejemplo n.º 1
0
  // WComponentPeer overrides
  @SuppressWarnings("unchecked")
  protected void disposeImpl() {
    AppContext appContext = SunToolkit.targetToAppContext(target);
    synchronized (appContext) {
      List<WWindowPeer> l = (List<WWindowPeer>) appContext.get(ACTIVE_WINDOWS_KEY);
      if (l != null) {
        l.remove(this);
      }
    }

    // Remove ourself from the Map of DisplayChangeListeners
    GraphicsConfiguration gc = getGraphicsConfiguration();
    ((Win32GraphicsDevice) gc.getDevice()).removeDisplayChangedListener(this);

    synchronized (getStateLock()) {
      TranslucentWindowPainter currentPainter = painter;
      if (currentPainter != null) {
        currentPainter.flush();
        // don't set the current one to null here; reduces the chances of
        // MT issues (like NPEs)
      }
    }

    super.disposeImpl();
  }
Ejemplo n.º 2
0
 public void propertyChange(PropertyChangeEvent e) {
   Window w = (Window) e.getNewValue();
   if (w == null) {
     return;
   }
   AppContext appContext = SunToolkit.targetToAppContext(w);
   synchronized (appContext) {
     WWindowPeer wp = (WWindowPeer) w.getPeer();
     // add/move wp to the end of the list
     List<WWindowPeer> l = (List<WWindowPeer>) appContext.get(ACTIVE_WINDOWS_KEY);
     if (l != null) {
       l.remove(wp);
       l.add(wp);
     }
   }
 }