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

Blurred ComboBox when printing JavaFX WebView

    XMLWordPrintable

Details

    • web
    • x86_64
    • windows_10

    Description

      A DESCRIPTION OF THE PROBLEM :
      When a ComboBox is displayed in a JavaFX WebView and a print is triggered, the ComboBox will be blurred on the printed page.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Start the attached source code and click "print"

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Button and ComboBox are printed sharp
      ACTUAL -
      Button is ok. ComboBox is blurred.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.event.ActionEvent;
      import javafx.event.EventHandler;
      import javafx.geometry.Insets;
      import javafx.geometry.Pos;
      import javafx.print.PrinterJob;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.layout.GridPane;
      import javafx.scene.web.WebView;
      import javafx.stage.Stage;

      public class PrintWebview extends Application {
          public static void main(String[] args) {
      launch(args);
          }

          @Override
          public void start(Stage stage) {
      stage.setTitle("Print Webview");

      GridPane grid = new GridPane();
      grid.setAlignment(Pos.CENTER);
      grid.setHgap(10);
      grid.setVgap(10);

      final WebView webview = new WebView();
      webview.getEngine().loadContent("<html>"
      + " <button type=\"button\">Button</button> "
      + "<select size=\"1\"><option>Entry 1</option><option>Entry 2</option></select>"
      + "</html>");

      grid.add(webview, 1, 2, 3, 1);

      Button print = new Button("print");
      print.setOnAction(new EventHandler<ActionEvent>() {
      @Override
      public void handle(ActionEvent event) {
      PrinterJob job = PrinterJob.createPrinterJob();
      if (job != null) {
      webview.getEngine().print(job);
      job.endJob();
      }
      }
      });
      grid.add(print, 3, 1);

      Scene scene = new Scene(grid, 300, 275);
      stage.setScene(scene);
      stage.show();
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


      Attachments

        Activity

          People

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: