@Override
 protected void setVisibleImpl(final boolean visible) {
   if (!visible && warningWindow != null) {
     warningWindow.setVisible(false, false);
   }
   updateFocusableWindowState();
   super.setVisibleImpl(visible);
   // TODO: update graphicsConfig, see 4868278
   platformWindow.setVisible(visible);
   if (isSimpleWindow()) {
     KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
     if (visible) {
       if (!getTarget().isAutoRequestFocus()) {
         return;
       } else {
         requestWindowFocus(CausedFocusEvent.Cause.ACTIVATION);
       }
       // Focus the owner in case this window is focused.
     } else if (kfmPeer.getCurrentFocusedWindow() == getTarget()) {
       // Transfer focus to the owner.
       LWWindowPeer owner = getOwnerFrameDialog(LWWindowPeer.this);
       if (owner != null) {
         owner.requestWindowFocus(CausedFocusEvent.Cause.ACTIVATION);
       }
     }
   }
 }
  @Override
  void initializeImpl() {
    super.initializeImpl();

    if (getTarget() instanceof Frame) {
      setTitle(((Frame) getTarget()).getTitle());
      setState(((Frame) getTarget()).getExtendedState());
    } else if (getTarget() instanceof Dialog) {
      setTitle(((Dialog) getTarget()).getTitle());
    }

    updateAlwaysOnTopState();
    updateMinimumSize();
    updateFocusableWindowState();

    final Shape shape = getTarget().getShape();
    if (shape != null) {
      applyShape(Region.getInstance(shape, null));
    }

    final float opacity = getTarget().getOpacity();
    if (opacity < 1.0f) {
      setOpacity(opacity);
    }

    setOpaque(getTarget().isOpaque());

    updateInsets(platformWindow.getInsets());
    if (getSurfaceData() == null) {
      replaceSurfaceData(false);
    }
    activateDisplayListener();
  }
  @Override
  protected void disposeImpl() {
    deactivateDisplayListener();
    SurfaceData oldData = getSurfaceData();
    synchronized (surfaceDataLock) {
      surfaceData = null;
    }
    if (oldData != null) {
      oldData.invalidate();
    }
    if (isGrabbing()) {
      ungrab();
    }
    if (warningWindow != null) {
      warningWindow.dispose();
    }

    platformWindow.dispose();
    super.disposeImpl();
  }
 @Override
 final void applyShapeImpl(final Region shape) {
   super.applyShapeImpl(shape);
   updateOpaque();
 }
 @Override
 public void setBackground(final Color c) {
   super.setBackground(c);
   updateOpaque();
 }