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

WDesktopPeer does not support APP_REQUEST_FOREGROUND

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10
      Java 11

      A DESCRIPTION OF THE PROBLEM :
      On windows, calling Desktop.getDesktop().requestForeground() fails because it is not implemented. Looking at the source it has not been changed in 2 years so I expect that it doesn't work in later releases either. This seems like a fairly basic command so it should probably be implemented.

      For requestForeground(true) the following workaround may work:
      Arrays.stream(Window.getWindows()).forEach(win -> {
                                      if(win.isDisplayable()) {
                                          if(win instanceof JFrame) {
                                              int e = ((JFrame)win).getExtendedState();
                                              ((JFrame)win).setExtendedState(JFrame.ICONIFIED);
                                              ((JFrame)win).setExtendedState(e);
                                          } else {
                                              win.toFront();
                                          }
                                          win.requestFocus();
                                      }
                                  });


        Attachments

          Activity

            People

            • Assignee:
              pbansal Pankaj Bansal
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: