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

Display bug when reducing the size of a WebView programmatically through setMaxHeight

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 7u6
    • Fix Version/s: 8
    • Component/s: javafx
    • Labels:
    • Environment:

      Windows 7 x64
      java version "1.7.0_13"
      Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
      Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

    • Subcomponent:
      web

      Description

      When reducing the height of a WebView by using setMaxHeight, the parts of the WebView that should be hidden stay on screen as if the window was not updated. Execute the code below and click the "reduce" button for testing :

      --- begin code
      import javafx.application.Application;
      import javafx.event.EventHandler;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.input.MouseEvent;
      import javafx.scene.layout.VBox;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;

      public class Main extends Application {
          public static void main(String[] args) {
              Application.launch(Main.class);
          }
          @Override
          public void start(Stage stage) throws Exception {
              Group root = new Group();
              Scene scene = new Scene(root, 600, 650);
              VBox layout = new VBox();
              root.getChildren().add(layout);
              stage.setScene(scene);
              stage.show();
              final WebView wv = new WebView();
              wv.setMaxHeight(600);
              wv.getEngine().loadContent("<!DOCTYPE html><html><head><title>test</title></head><body style='background-color: blue'></body></html>");
              Button reduceButton = new Button("reduce");
              reduceButton.setOnMouseClicked(new EventHandler<MouseEvent>() {
                  @Override
                  public void handle(MouseEvent arg0) {
                      wv.setMaxHeight(100);
                      wv.requestFocus();
                  }
              });
              layout.getChildren().addAll(reduceButton, wv);
          }
      }
      --- end code

        Attachments

          Activity

            People

            Assignee:
            peterz Peter Zhelezniakov
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported: