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

Visual glitch / layout issue when setting pref height of table column headers

    Details

    • Subcomponent:
    • Introduced In Build:
      b139
    • Introduced In Version:
      9
    • CPU:
      generic
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :
      java version "9"
      Java(TM) SE Runtime Environment (build 9+181)
      Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      macOS Sierra, 10.12.6

      A DESCRIPTION OF THE PROBLEM :
      The layout of table and tree table view column headers becomes messed up when specifying a preferred height for the column headers inside a stylesheet.

      REGRESSION. Last worked in version 8u144

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_144"
      Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
      Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run this application. Make sure the stylesheet.css file is in the same location.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The five column headers created by the test application should be simply taller than their default height. They should be as tall as the value specified via -fx-pref-height inside the stylesheet.
      ACTUAL -
      The column headers do have the specified new height but in addition one can see a blank column header above spanning all five columns. It almost looks like a parent column header.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableView;
      import javafx.stage.Stage;

      public class TableViewBug extends Application {

          @Override
          public void start(Stage primaryStage) throws Exception {

              TableView<String> tableView = new TableView<>();
              for (int i = 0; i < 5; i++) {
                  TableColumn<String, String> column = new TableColumn<>("Col " + i);
                  tableView.getColumns().add(column);
              }

              Scene scene = new Scene(tableView);
              scene.getStylesheets().add(TableViewBug.class.getResource("style.css").toExternalForm());

              primaryStage.setScene(scene);
              primaryStage.setWidth(500);
              primaryStage.setHeight(400);
              primaryStage.centerOnScreen();
              primaryStage.show();
          }

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

      --------------------------- Stylesheet ---------------------------

      .column-header {
          -fx-pref-height: 100px;
      }
      ---------- END SOURCE ----------

        Attachments

        1. fixed_visual_glitch.jpg
          fixed_visual_glitch.jpg
          24 kB
        2. style.css
          0.0 kB
        3. TableViewBug.java
          1.0 kB
        4. visual_glitch.jpg
          visual_glitch.jpg
          25 kB

          Issue Links

            Activity

              People

              • Assignee:
                aghaisas Ajit Ghaisas
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: