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

JPopupMenu without an invoker should be treated as a desktop popup menu

XMLWordPrintable

      A DESCRIPTION OF THE REQUEST :
      JPopupMenu without an invoker should be treated as a desktop popup menu. This change does not actually require any API change and is unlikely to break any backwards compatibility so please consider it for a pre-Mustang release.

      Whenever a JPopupMenu is used with no invoker, Java should interpret this to mean it is a "desktop popup". That is, a popup that does not need to respect the screen insets. This popup should be allowed to cover the taskbar.

      This is easy to implement. Simple modify javax.swing.JPopupMenu.adjustPopupLocationToFitScreen(). The first line currently reads:

      if(popupPostionFixDisabled == true || GraphicsEnvironment.isHeadless())
           return p;

      The new version should read:

      if(popupPostionFixDisabled == true || GraphicsEnvironment.isHeadless() || invoker==null)
           return p;


      The heavyweight component should also use:

      SetWindowPos(dsi_win32->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE));

      to set its z-position to top-most since this is the correct behavior for all pop-ups under Win32 (whether normal JPopupMenus or desktop JPopupMenus).

      JUSTIFICATION :
      Currently there is no way to implement task-bar popup menus using pure Java. This is required for the implementation of a System-Tray API, as used by JDIC (see: https://jdic.dev.java.net/)

      The proposed new behavior is consistent with the desired meaning/design of JPopupMenu.


      CUSTOMER SUBMITTED WORKAROUND :
      A workaround involves heavy use of JNI and in-memory class rewriting. Even this solution involves noticable flickering as the popup is displayed in one position, then JNI is invoked to modify its z-position, then it is repositioned over the taskbar. The flickering is very noticable.
      ###@###.### 2004-11-09 04:10:09 GMT

            alexp Alexander Potochkin (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: