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

TableHeaderRow: Filler not resized on hiding menuButton

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 9
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
    • Environment:

      java9-ea-u180

      Description

      To reproduce, run the example below
      - for visualization header/fillter/corner background is blue/yellow/red
      - uncheck show-menubutton
      - expected: filler (== yellow) stretches to trailing corner
      - actual: corner region is blue, that is the header's background
      - only after resizing a column, the filler resizes to fill the corner region

      this happens only on the very first appearance with menuButton visible

      example code:

      import java.net.URL;
      import java.util.Locale;
      import javafx.application.Application;
      import javafx.collections.FXCollections;
      import javafx.scene.Parent;
      import javafx.scene.Scene;
      import javafx.scene.control.CheckBox;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableView;
      import javafx.scene.control.cell.PropertyValueFactory;
      import javafx.scene.layout.BorderPane;
      import javafx.scene.layout.HBox;
      import javafx.stage.Stage;

      public class TableHeaderMenuButtonBug extends Application {

          private Parent getContent() {
              TableView<Locale> table = new TableView<>(FXCollections.observableArrayList(
                      Locale.getAvailableLocales()));
              TableColumn<Locale, String> countryCode = new TableColumn<>("CountryCode");
              countryCode.setCellValueFactory(new PropertyValueFactory<>("country"));
              table.getColumns().addAll(countryCode);
              
              table.setTableMenuButtonVisible(true);
              CheckBox menuButtonVisible = new CheckBox("Show MenuButton");
              menuButtonVisible.selectedProperty().bindBidirectional(table.tableMenuButtonVisibleProperty());
              HBox buttons = new HBox(10, menuButtonVisible);
              BorderPane pane = new BorderPane(table);
              pane.setBottom(buttons);
              return pane;
          }

          @Override
          public void start(Stage primaryStage) throws Exception {
              primaryStage.setScene(new Scene(getContent(), 800, 400));
              URL uri = getClass().getResource("headers.css");
              primaryStage.getScene().getStylesheets().add(uri.toExternalForm());
              primaryStage.show();

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

      }

      headers.css:

      .column-header-background {
      -fx-background-color: blue;

      }
      .column-header-background > .show-hide-columns-button {
      -fx-background-color: red;

      }
      .column-header-background > .filler {
      -fx-background-color: yellow;
      }

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              fastegal Jeanette Winzenburg
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: