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

Window only renders partly when Gtk3 is used

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Java:
      openjdk version "11" 2018-09-25
      OpenJDK Runtime Environment 18.9 (build 11+28)
      OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

      OS: elementary OS 5.0 Juno (Ubuntu 18.04 LTS)
      JavaFX Version: 12-ea+4


      A DESCRIPTION OF THE PROBLEM :
      When rendering a Stage only a small part is actually displayed. Here a screenshot: https://i.stack.imgur.com/iLpeY.png
      This seams related to the Window Manager and/or Gtk.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the provided code.
      On the provided JDK/JavaFX version on elementary OS.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The window should be rendered correctly with Controls to resize the window and the right Size.
      ACTUAL -
      Only a small part of the window actually gets displayed with NO Controls to resize the window.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.fxml.FXMLLoader;
      import javafx.scene.Scene;
      import javafx.scene.layout.AnchorPane;
      import javafx.stage.Stage;

      import java.io.ByteArrayInputStream;
      import java.io.IOException;

      public class App extends Application {

          public static void main(String[] args) {
              launch();
          }
          @Override
          public void start(Stage primaryStage) throws IOException {
              FXMLLoader loader = new FXMLLoader();
              AnchorPane pane = loader.load(new ByteArrayInputStream(fxmlContent.getBytes()));
              primaryStage.setScene(new Scene(pane));
              primaryStage.sizeToScene();
              primaryStage.setResizable(false);

              primaryStage.show();
          }
          public static String fxmlContent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                  "\n" +
                  "<?import javafx.scene.control.Label?>\n" +
                  "<?import javafx.scene.control.ListView?>\n" +
                  "<?import javafx.scene.image.ImageView?>\n" +
                  "<?import javafx.scene.layout.AnchorPane?>\n" +
                  "<?import javafx.scene.layout.Pane?>\n" +
                  "<?import javafx.scene.text.Font?>\n" +
                  "\n" +
                  "<AnchorPane prefHeight=\"450.0\" prefWidth=\"650.0\" xmlns=\"http://javafx.com/javafx/10.0.1\" xmlns:fx=\"http://javafx.com/fxml/1\">\n" +
                  " <children>\n" +
                  " <Pane layoutX=\"234.0\" prefHeight=\"450.0\" prefWidth=\"650.0\" AnchorPane.bottomAnchor=\"0.0\" AnchorPane.leftAnchor=\"0.0\" AnchorPane.rightAnchor=\"0.0\" AnchorPane.topAnchor=\"0.0\">\n" +
                  " <children>\n" +
                  " <ListView fx:id=\"projectsList\" prefHeight=\"450.0\" prefWidth=\"235.0\" />\n" +
                  " <ImageView fx:id=\"iconImage\" fitHeight=\"150.0\" fitWidth=\"148.0\" layoutX=\"367.0\" layoutY=\"31.0\" pickOnBounds=\"true\" preserveRatio=\"true\" />\n" +
                  " <Label fx:id=\"createNewProject\" layoutX=\"366.0\" layoutY=\"181.0\" text=\"Label 1\">\n" +
                  " <font>\n" +
                  " <Font size=\"18.0\" />\n" +
                  " </font></Label>\n" +
                  " <Label fx:id=\"importProject\" layoutX=\"414.0\" layoutY=\"208.0\" text=\"Label 2\">\n" +
                  " <font>\n" +
                  " <Font size=\"18.0\" />\n" +
                  " </font></Label>\n" +
                  " <Label fx:id=\"settings\" layoutX=\"409.0\" layoutY=\"235.0\" text=\"Label 3\">\n" +
                  " <font>\n" +
                  " <Font size=\"18.0\" />\n" +
                  " </font>\n" +
                  " </Label>\n" +
                  " <Label fx:id=\"versionLabel\" layoutX=\"245.0\" layoutY=\"419.0\" prefHeight=\"17.0\" prefWidth=\"391.0\" text=\"\" />\n" +
                  " <Label fx:id=\"aboutLabel\" layoutX=\"245.0\" layoutY=\"401.0\" text=\"Label 4\">\n" +
                  " <font>\n" +
                  " <Font size=\"14.0\" />\n" +
                  " </font>\n" +
                  " </Label>\n" +
                  " </children>\n" +
                  " </Pane>\n" +
                  " </children>\n" +
                  "</AnchorPane>\n";
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      A half way working solution is to call: stage.initStyle(StageStyle.UNDECORATED), since that does not require the window is rendered correctly, but without Controls to resize.

      The only completely working method i was able to find is to set the JVM option -Djdk.gtk.version=2

      FREQUENCY : always


        Attachments

        1. 9058527.png
          9058527.png
          57 kB
        2. App.java
          3 kB

          Activity

            People

            • Assignee:
              pbansal Pankaj Bansal
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: