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

GTK3: warning when running getGraphics methods of BufferedImage

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Linux Mint 19
      java version "11" 2018-09-25
      Java(TM) SE Runtime Environment 18.9 (build 11+28)
      Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)
      JavaFx 11

      A DESCRIPTION OF THE PROBLEM :
      The call of the getGraphics method of BufferedImage in a JavaFx application generates the well-known warning:
      (java:7297): Gdk-WARNING **: 08:31:22.870: XSetErrorHandler() called with a GDK error trap pushed. Don't do that.


      REGRESSION : Last worked in version 10.0.2

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the source code to see the warning in the console

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Not having a warning
      ACTUAL -
      A warning

      ---------- BEGIN SOURCE ----------
      import java.awt.image.BufferedImage;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.stage.Stage;

      //Workaround: -Djdk.gtk.version=2 possibly related to: JDK-8156779
      public class Fx11Warning extends Application{

      @Override
      public void start(Stage stage) throws Exception {
      BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_3BYTE_BGR);
      bi.getGraphics(); //Warning
      stage.setScene(new Scene(new Button("patate"), 200, 200));
      stage.show();
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      -Djdk.gtk.version=2

      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: