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

[macos] popup menu does not work when created by component embedded in a modal panel

XMLWordPrintable

      If a Swing component such as a combo box is embedded in a macOS native modal panel, any popup menu it creates is useless, because:
      1. The menu is displayed under the native panel instead of on top of the panel.
      2. The menu does not respond to mouse events.
      I believe there is a single cause for these problems, which is in the method CPlatformWindow.initializeBase. This code identifies the owning window as follows:
      if (owner instanceof CPlatformWindow) {
          this.owner = (CPlatformWindow)owner;
      }
      In the embedded case the owner is a CViewPlatformEmbeddedFrame, which is not a CPlatformWindow.
      When this.owner is null, the code that sets the window level (applyWindowLevel) is not run, so the window is displayed at the default level, which is lower than the modal panel level. Also, when this.owner is null, the popup window is not installed as a child of the native panel, so it is blocked from mouse events because it is unrelated to the native modal panel.

            honkar Harshitha Onkar
            alans Alan Snyder
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: