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

Wrong maximized notification when multiple displays with different DPI

    Details

    • Subcomponent:
    • Introduced In Version:
      9
    • CPU:
      x86_64
    • OS:
      windows_10

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10

      A DESCRIPTION OF THE PROBLEM :
      Using two displays with different scaling factors, one is scaled at 125% and the other at 100%.
      When the frame is dragged to the second screen as maximized, the "addWindowStateListener" notifies the maximized event correctly, the icon near the close icon and its tooltip are also good, but the size of the frame is wrong... the frame does not span the entire screen area.



      REGRESSION : Last worked in version 8u212

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the code and drag the frame from one screen to another, dragging it to the top border of the screen so that it should become maximized.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The dropped frame should be maximized on the second screen.
      ACTUAL -
      The dropped frame is not maximized on the second screen although the event received on the Window state listener seems to report that it is.

      ---------- BEGIN SOURCE ----------
      import java.awt.BorderLayout;
      import java.awt.Frame;
      import java.awt.event.WindowAdapter;
      import java.awt.event.WindowEvent;

      import javax.swing.JFrame;
      import javax.swing.JLabel;

      public class Main {
        
        public static void main(String[] args) {
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          
          frame.addWindowStateListener(new WindowAdapter() {
            @Override
            public void windowStateChanged(WindowEvent e) {
              boolean maximized = (e.getNewState() & Frame.MAXIMIZED_BOTH) == Frame.MAXIMIZED_BOTH;
              System.out.println("MAXIMIZED: " + maximized);
            }
          });
          
          frame.getContentPane().setLayout(new BorderLayout());
          frame.getContentPane().add(new JLabel("HELLO WITH JAVA 11"), BorderLayout.CENTER);
          
          frame.setSize(800, 600);
          frame.setVisible(true);
        }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                serb Sergey Bylokhov
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: