示例#1
0
  @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();
  }
示例#2
0
  /**
   * Called by the {@code PlatformWindow} when this window is moved/resized by user or window insets
   * are changed. There's no notifyReshape() in LWComponentPeer as the only components which could
   * be resized by user are top-level windows.
   */
  @Override
  public void notifyReshape(int x, int y, int w, int h) {
    Rectangle oldBounds = getBounds();
    final boolean invalid = updateInsets(platformWindow.getInsets());
    final boolean moved = (x != oldBounds.x) || (y != oldBounds.y);
    final boolean resized = (w != oldBounds.width) || (h != oldBounds.height);

    // Check if anything changed
    if (!moved && !resized && !invalid) {
      return;
    }
    // First, update peer's bounds
    setBounds(x, y, w, h, SET_BOUNDS, false, false);

    // Second, update the graphics config and surface data
    final boolean isNewDevice = updateGraphicsDevice();
    if (resized || isNewDevice) {
      replaceSurfaceData();
      updateMinimumSize();
    }

    // Third, COMPONENT_MOVED/COMPONENT_RESIZED/PAINT events
    if (moved || invalid) {
      handleMove(x, y, true);
    }
    if (resized || invalid || isNewDevice) {
      handleResize(w, h, true);
      repaintPeer();
    }

    repositionSecurityWarning();
  }
示例#3
0
  /**
   * Called by the {@code PlatformWindow} when this window is moved/resized by user or window insets
   * are changed. There's no notifyReshape() in LWComponentPeer as the only components which could
   * be resized by user are top-level windows.
   */
  @Override
  public final void notifyReshape(int x, int y, int w, int h) {
    final boolean moved;
    final boolean resized;
    final boolean invalid = updateInsets(platformWindow.getInsets());
    synchronized (getStateLock()) {
      moved = (x != sysX) || (y != sysY);
      resized = (w != sysW) || (h != sysH);
      sysX = x;
      sysY = y;
      sysW = w;
      sysH = h;
    }

    // Check if anything changed
    if (!moved && !resized && !invalid) {
      return;
    }
    // First, update peer's bounds
    setBounds(x, y, w, h, SET_BOUNDS, false, false);

    // Second, update the graphics config and surface data
    final boolean isNewDevice = updateGraphicsDevice();
    if (resized || isNewDevice) {
      replaceSurfaceData();
    }

    // Third, COMPONENT_MOVED/COMPONENT_RESIZED/PAINT events
    if (moved || invalid) {
      handleMove(x, y, true);
    }
    if (resized || invalid || isNewDevice) {
      handleResize(w, h, true);
      repaintPeer();
    }

    repositionSecurityWarning();
  }