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

VBox.setVgrow and HBox.setHgrow corrupt following controls when window resized

    Details

    • Subcomponent:
      web
    • CPU:
      x86_64
    • OS:
      generic

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.8.0_60-ea"
        Java(TM) SE Runtime Environment (build 1.8.0_60-ea-b24)
        Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)


        ADDITIONAL OS VERSION INFORMATION :
        ver 6.1 - Windows 7 Professional, Version 6.1 (Build 7601, Service Pack 1)


        A DESCRIPTION OF THE PROBLEM :
        Using VBox.setVgrow or HBox.setHgrow causes corruption of the hover image of following controls when the window is resized larger. I have been struggling with this problem for a while so I have written and tested a small, complete example of source code below which reproduces the problem.
        In the example an HBox contains textField1 and a following button2. HBox.setHgrow is applied to textField1. When the window is resized wider (much wider) the hover image of button1 becomes corrupted and when the mouse hovers over button1 a large white square is displayed. In the same way if the window is resized taller (much taller) the hover image of button2 is corrupted because it is in a VBox and follows a browser control which has VBox.setVgrow applied to it.

        ADDITIONAL REGRESSION INFORMATION:
        The problem occurs on 8u45 and 8u60 and I have reproduced it on Windows 7 and a tablette running Windows 8. I do not know if it occurs on earlier versions.

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Run the source code application below on a computer with a large monitor (1080 x 1920 pixels). The example displays a top toolbar, a web view browser and a bottom toolbar.
        Let the example run 10-15 seconds so that the browser completes displaying www.yahoo.com.
        Once the display is stable resize the screen much bigger (you may need to resize up and down several times). At some point when you move the mouse over button1 or button2 you will see that the hover image is corrupted on one or both buttons - a large white box is displayed over the button.
        Please persist with the window resizing until the button corruption occurs - once it has occurred the button hover images stay corrupted. This problem is easily repeatable providing you persist a little.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        When you move the mouse cursor over button1 or button2 I expect to see the button highlighted normally and be able to see the button text.
        ACTUAL -
        When I move the mouse cursor over button1 or button2 (after resizing one or more times) I see a bright, white square and I do not see the button text.


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        public class GrowBug extends Application {
            
            TextField textField1;
            Button button1;
            
            @Override
            public void start(Stage primaryStage) {
                
                HBox toolBar1 = new HBox();
                textField1 = new TextField("Text Field 1");
                HBox.setHgrow(textField1,Priority.ALWAYS);
                button1 = new Button("Button 1");
                toolBar1.getChildren().addAll(textField1,button1);
                
                WebView browser = new WebView();
                browser.getEngine().load("http://www.yahoo.com");
                
                VBox root = new VBox();
                VBox.setVgrow(browser,Priority.ALWAYS);
                
                HBox toolBar2 = new HBox();
                Button button2= new Button("Button 2");
                TextField textField2= new TextField("TextField 2");
                toolBar2.getChildren().addAll(button2,textField2);
                
                root.getChildren().addAll(toolBar1,browser,toolBar2);
                
                Scene scene = new Scene(root, 1024, 800);
                primaryStage.setTitle("HBox.setHgrow and VBox.setVgrow bugs");
                primaryStage.setScene(scene);
                primaryStage.show();
            }

            public static void main(String[] args) {
                launch(args);
            }
        }

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

        CUSTOMER SUBMITTED WORKAROUND :
        Remove the HBox.setHgrow on textField1 and button1 will no longer become corrupted.
        Remove the VBox.setVgrow on the browser and button 2 will no longer become corrupted.
        You can also avoid inserting controls in an HBox or VBox AFTER a control which has setHgrow or setVgrow applied, but these workarounds are very restrictive.

          Attachments

          1. 8ga.png
            8ga.png
            627 kB
          2. button_hide_on_hover.png
            button_hide_on_hover.png
            50 kB
          3. fix-for-growbug-02.patch
            13 kB
          4. fix-for-growbug-03.patch
            13 kB
          5. hs_err_pid4608.log
            36 kB

            Issue Links

              Activity

                People

                • Assignee:
                  arajkumar Arunprasad Rajkumar
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  12 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: