public LWWindowPeer(
      Window target,
      PlatformComponent platformComponent,
      PlatformWindow platformWindow,
      PeerType peerType) {
    super(target, platformComponent);
    this.platformWindow = platformWindow;
    this.peerType = peerType;

    Window owner = target.getOwner();
    LWWindowPeer ownerPeer =
        owner == null ? null : (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner);
    PlatformWindow ownerDelegate = (ownerPeer != null) ? ownerPeer.getPlatformWindow() : null;

    // The delegate.initialize() needs a non-null GC on X11.
    GraphicsConfiguration gc = getTarget().getGraphicsConfiguration();
    synchronized (getStateLock()) {
      // graphicsConfig should be updated according to the real window
      // bounds when the window is shown, see 4868278
      this.graphicsConfig = gc;
    }

    if (!target.isFontSet()) {
      target.setFont(DEFAULT_FONT);
    }

    if (!target.isBackgroundSet()) {
      target.setBackground(SystemColor.window);
    } else {
      // first we check if user provided alpha for background. This is
      // similar to what Apple's Java do.
      // Since JDK7 we should rely on setOpacity() only.
      // this.opacity = c.getAlpha();
    }

    if (!target.isForegroundSet()) {
      target.setForeground(SystemColor.windowText);
      // we should not call setForeground because it will call a repaint
      // which the peer may not be ready to do yet.
    }

    platformWindow.initialize(target, this, ownerDelegate);

    // Init warning window(for applets)
    SecurityWarningWindow warn = null;
    if (target.getWarningString() != null) {
      // accessSystemTray permission allows to display TrayIcon, TrayIcon tooltip
      // and TrayIcon balloon windows without a warning window.
      if (!AWTAccessor.getWindowAccessor().isTrayIconWindow(target)) {
        LWToolkit toolkit = (LWToolkit) Toolkit.getDefaultToolkit();
        warn = toolkit.createSecurityWarning(target, this);
      }
    }

    warningWindow = warn;
  }
  void initialize() {
    super.initialize();

    updateInsets(insets_);

    Font f = ((Window) target).getFont();
    if (f == null) {
      f = defaultFont;
      ((Window) target).setFont(f);
      setFont(f);
    }
    // Express our interest in display changes
    GraphicsConfiguration gc = getGraphicsConfiguration();
    ((Win32GraphicsDevice) gc.getDevice()).addDisplayChangedListener(this);

    initActiveWindowsTracking((Window) target);

    updateIconImages();

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

    float opacity = ((Window) target).getOpacity();
    if (opacity < 1.0f) {
      setOpacity(opacity);
    }

    synchronized (getStateLock()) {
      // default value of a boolean field is 'false', so set isOpaque to
      // true here explicitly
      this.isOpaque = true;
      setOpaque(((Window) target).isOpaque());
    }
  }