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

Wrong computeWidth in GridPane

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8, 9, 10, openjfx11
    • Fix Version/s: tbd
    • Component/s: javafx
    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      generic

      Description

      A DESCRIPTION OF THE PROBLEM :
      The width of the gridpane is wider than it's content. The red border should be the same size as the black gridlines.

      Remarks:
      The span of the last child of the gridpane seems the cause without span it's seems ok.
      If the first text is shorter for example ""TEXT" instead of "TEXT__SPAN___ON___4___Column " the problem also disapear

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      launch the attached sample app

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      the red border shouldn't be wider

      ---------- BEGIN SOURCE ----------
      /**
       *
       * @author cfischer
       */
      public class GridPaneComputeWidthBug extends Application {

          @Override
          public void start(Stage primaryStage) {
              final GridPane gridPane = new GridPane();
              gridPane.setGridLinesVisible(true);
              gridPane.setStyle("-fx-border-color : red;");

              final Text text1 = new Text();
              text1.setText("TEXT__SPAN___ON___4___Column ");
              gridPane.add(text1, 0, 0, 4, 1);

              final Text text2 = new Text();
              text2.setText(" col4 ");
              gridPane.add(text2, 4, 0, 1, 1);

              gridPane.add(new Text(" col0 "), 0, 1);

              final Text text3 = new Text();
              text3.setText(" col1 ");
              gridPane.add(text3, 1, 1);

              gridPane.add(new Text(" col2 "), 2, 1);

              final Text text4 = new Text();
              text4.setText(" SPAN_ON_COL3_4");
              gridPane.add(text4, 3, 1, 2, 1); //BUG if SPAN 2 work with span 1

              final VBox vBox = new VBox(gridPane);
              vBox.setFillWidth(false);
              StackPane root = new StackPane(vBox);

              Scene scene = new Scene(root, 600, 250);
              primaryStage.setTitle("GridPane bug");
              primaryStage.setScene(scene);
              primaryStage.show();
          }

          /**
           * @param args the command line arguments
           */
          public static void main(String[] args) {
              launch(args);
          }

      }
      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Activity

            People

            • Assignee:
              arapte Ambarish Rapte
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: