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

JFrame is not validated on resizing in height by Windows Aero Snap

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "1.7.0_04"
      Java(TM) SE Runtime Environment (build 1.7.0_04-b20)
      Java HotSpot(TM) Client VM (build 23.0-b21, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      When a JFrame is stretched in height by Windows Aero Snap, it is not validated. The components stay at their old positions and the new space is just black.
      This only happens when the JFrame is resized in height but not in width. So docking on one side of the screen or maximizing works normally.

      REGRESSION. Last worked in version 6u31

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      The numbers in braces are linked to the corresponding numbers in the result sections to indicate the console output.

      Run the executable test case. (1)
      Grab the JFrame with the left mouse button at the upper edge and move it one pixel to the left or right. On a modern Windows system with Aero and its feature Snap enabled, you will see the translucent preview as to how the JFrame will be stretched in height. (2)
        Release the left mouse button. (3)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      You get the expected result with Java SE 6.

      (1)
      v 0
      p 0
      v 1
      p 1

      (2)
      v 2
      v 3

      (3)
      v 4
      p 2
      p 3

      Everything looks fine. The JFrame was correctly validated ("v 4").
      ACTUAL -
      You get the actual result with Java SE 7.

      (1)
      v 0
      p 0
      v 1
      p 1

      (2)
      v 2
      v 3
      v 4
      v 5

      (3)
      p 2

      The new allocated space stays black. The components are in their old positions. Note the missing validation after (3).

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Graphics;
      import javax.swing.JFrame;
      import javax.swing.SwingUtilities;

      public class AeroSnapTest {
      public static void main(final String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
      new JFrame() {
      private int p, v;

      @Override
      public void paint(final Graphics g) {
      super.paint(g);
      System.out.println("p " + p++);
      }

      @Override
      public void validate() {
      super.validate();
      System.out.println("v " + v++);
      }
      }.setVisible(true);
      }
      });
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      1) Disable Aero Snap.
      2) Resize the JFrame afterwards in width to trigger validation.

            bagiras Oleg Pekhovskiy (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: