Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8334966

Stage.sizeToScene() on maximized/fullscreen Stage breaks the Window

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • jfx23, jfx24
    • javafx
    • None
    • behavioral
    • minimal
    • Minimal risk as it is unlikely that any user relies on this behaviour.
    • Java API
    • JDK

      Summary

      Do not allow the sizeToScene() request when a Window is maximized or in fullscreen mode. Document the behavior.

      Problem

      When a developer or the JavaFX framework (Dialog) calls sizeToScene() on a maximized or fullscreen Window, the whole Window will break. This looks a little bit different on every OS, but is broken in every case.

      Solution

      To address this issue, the sizeToScene() request should be ignored (but remembered) when the Window is maximized of in fullscreen mode. This behavior should also be documented on the sizeToScene() method.

      Specification

      ~ javafx.stage.Window

      /**
       * Set the width and height of this Window to match the size of the content
       * of this Window's Scene.
       * <p>This request might be ignored if the Window is not allowed to do so, for example a {@link Stage}
       * may be {@code maximized} or in {@code fullScreen} and therefore does not allow this request.
       * If that is the case, this request is remembered and reapplied later when allowed.</p>
       */
      public void sizeToScene() {

            mhanl Marius Hanl
            mhanl Marius Hanl
            Kevin Rushforth
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: