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

Cannot move undecorated, maximized JFrame to other monitors using Shift+Win+<arrow> keyboard shortcut

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "9.0.1"
      Java(TM) SE Runtime Environment (build 9.0.1+11)
      Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 10.0.16299.64]

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      It is related to multimonitor environment. To reproducuce the bug you will need at least two monitors.

      A DESCRIPTION OF THE PROBLEM :
      Create a JFrame, setup it as undecorated, maximize it and try to move it to other monitors using the standard Shift+Win+<arrow> keyboard shortcuts. It stucks on 2nd monitor. Other (native) applications works as expected.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Compile the attached sample app.
      2. Start it wit the "UNDECORATED" argument:
          java MainFrame UNDECORATED
      3. Maximize it (click the Maximize button). It should appear on primary (left) monitor.
      4. Press Shift+Win+Right to move it to 2nd monitor.
      5. Press Shift+Win+Left to move it back primary monitor.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      It should be possible to use Shift+Win+<arrow> keyboard shortcuts to move window to all monitors.
      ACTUAL -
      It is not possible to use Shift+Win+<arrow> keyboard shortcuts to move window to all monitors. The window stuck on the 2nd monitor.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      /**
       * Created with IntelliJ IDEA.
       * User: sdrzka
       * Date: 9.10.13
       * Time: 10:36
       * To change this template use File | Settings | File Templates.
       */
      public class MainFrame extends JFrame {

          private JButton maximizeButton = new JButton("Maximize");
          private JButton restoreButton = new JButton("Restore");
          private JButton exitButton = new JButton("Exit");

          public MainFrame() throws HeadlessException {
              setSize(1280, 1024);
              setLocation(100, 100);
              setLayout(new FlowLayout());
              ActionListener actionListener = new ActionListener() {
                  @Override
                  public void actionPerformed(ActionEvent e) {
                      if (e.getSource() == maximizeButton)
                          setExtendedState(JFrame.MAXIMIZED_BOTH);
                      else if (e.getSource() == restoreButton)
                          setExtendedState(JFrame.NORMAL);
                      else if (e.getSource() == exitButton)
                          System.exit(0);
                  }
              };
              maximizeButton.addActionListener(actionListener);
              restoreButton.addActionListener(actionListener);
              exitButton.addActionListener(actionListener);
              add(maximizeButton);
              add(restoreButton);
              add(exitButton);
              KeyListener keyListener = new KeyListener() {
                  @Override
                  public void keyTyped(KeyEvent e) {
                      System.out.println(e);
                  }

                  @Override
                  public void keyPressed(KeyEvent e) {
                      System.out.println(e);
                  }

                  @Override
                  public void keyReleased(KeyEvent e) {
                      System.out.println(e);
                  }
              };
              addKeyListener(keyListener);
              setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
          }

          public static void main(String[] args) {
              JFrame f = new MainFrame();
              if (args.length > 0)
                  if (args[0].compareToIgnoreCase("UNDECORATED") == 0)
                      f.setUndecorated(true);
              f.setVisible(true);
          }
      }

      ---------- END SOURCE ----------

      SUPPORT :
      YES

            psadhukhan Prasanta Sadhukhan
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: