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

WindowEvent.WINDOW_OPENING and WindowEvent.WINDOW_OPENED

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u45
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
    • Environment:

      JDK 8u45, Win 8.1, 64 bit

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      When programming a simple "backup and restore window size" functionality, I noticed that I cannot get an event when a window is getting opened, i. e. just before it is to become visible for the first time. This is a bad thing, because it would be the optimal event for a listener to chime in and provide position and size just "remember" from a persistent storage.

      So I'd like to propose that windows emit two more events: WINDOW_OPENING as a short-cut for "before the FIRST time this window emits WINDOW_SHOWING" and WINDOW_OPENED as a short-cut for "before the FIRST time this window emits WINDOW_SHOWN".

      Why can't this be done with existing events? It can, but it is not smart. Typically for performance reasons one wants to store the position and size ONLY when a window really gets closed (not at every resize / move, and not at every hiding, as this may happen often times in a windows lifetime). So when restoring that position and size at every WINDOW_SHOWING would simply be wrong as it discards and resize / move happening after the window got visible and / or renders the window to be non-movable and non-sizeable!

      The current workaround is to either "count" the number of WINDOW_SHOWING events (which is working, but feels like a dirty trick), or using the combination WINDOW_HIDING / WINDOW_SHOWING (which feels "wrong" as it talks to the persistent store way too often for being accepted as "good" solution).

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            mkarg Markus Karg
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: