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

The last row in tableView is not full visible if the tableview has only the horizontal scrollbar.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8u60
    • 8u25
    • javafx
    • Windows 7 Prof.

    Description

      If the tableview has only the horizontal scrollbar, an there are just so many rows that the rows fills the full tableview then the last row ist not full visible.


      Sample Programm.
      ------------------------------------------------

      package javafx.test;

      import java.util.ArrayList;
      import javafx.application.Application;
      import static javafx.application.Application.launch;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.scene.Scene;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableView;
      import javafx.scene.control.cell.PropertyValueFactory;
      import javafx.scene.layout.AnchorPane;
      import javafx.stage.Stage;

      public class MainApp extends Application {

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

          @Override
          public void start(Stage stage) throws Exception {
              stage.setWidth(500);
              stage.setHeight(544);

              TableView<MyRow> tableView = new TableView<>(createRows());
              tableView.getColumns().addAll(createColumns());

              AnchorPane.setTopAnchor(tableView, 0.0);
              AnchorPane.setRightAnchor(tableView, 0.0);
              AnchorPane.setLeftAnchor(tableView, 0.0);
              AnchorPane.setBottomAnchor(tableView, 0.0);

              AnchorPane root = new AnchorPane(tableView);
              Scene scene = new Scene(root);
              scene.getStylesheets().add("/styles/Styles.css");

              stage.setTitle("JavaFX and Maven");
              stage.setScene(scene);
              stage.show();
          }

          private ObservableList<MyRow> createRows() {
              ArrayList<MyRow> rows = new ArrayList<>();

              for (int i = 1; i <= 20; ++i) {
                  String c1 = String.format("r:%2d,c:%d", i, 1);
                  String c2 = String.format("r:%2d,c:%d", i, 2);
                  String c3 = String.format("r:%2d,c:%d", i, 3);
                  String c4 = String.format("r:%2d,c:%d", i, 4);
                  rows.add(new MyRow(c1, c2, c3, c4));
              }

              return FXCollections.observableList(rows);
          }

          private ArrayList<TableColumn<MyRow, String>> createColumns() {

              TableColumn<MyRow, String> c1 = new TableColumn<>();
              TableColumn<MyRow, String> c2 = new TableColumn<>();
              TableColumn<MyRow, String> c3 = new TableColumn<>();
              TableColumn<MyRow, String> c4 = new TableColumn<>();

              c1.setPrefWidth(150);
              c2.setPrefWidth(150);
              c3.setPrefWidth(150);
              c4.setPrefWidth(150);

              c1.setCellValueFactory(new PropertyValueFactory<MyRow, String>("col1"));
              c2.setCellValueFactory(new PropertyValueFactory<MyRow, String>("col2"));
              c3.setCellValueFactory(new PropertyValueFactory<MyRow, String>("col3"));
              c4.setCellValueFactory(new PropertyValueFactory<MyRow, String>("col4"));

              TableColumn<MyRow, String> groupC2AndC3 = new TableColumn<>();

              ArrayList<TableColumn<MyRow, String>> list = new ArrayList<>();
              list.add(c1);
              list.add(c2);
              list.add(c3);
              list.add(c4);
              return list;
          }

          public class MyRow {

              private String col1;
              private String col2;
              private String col3;
              private String col4;

              public MyRow() {
              }

              public MyRow(String col1, String col2, String col3, String col4) {
                  this.col1 = col1;
                  this.col2 = col2;
                  this.col3 = col3;
                  this.col4 = col4;
              }

              public String getCol1() {
                  return col1;
              }

              public void setCol1(String col1) {
                  this.col1 = col1;
              }

              public String getCol2() {
                  return col2;
              }

              public void setCol2(String col2) {
                  this.col2 = col2;
              }

              public String getCol3() {
                  return col3;
              }

              public void setCol3(String col3) {
                  this.col3 = col3;
              }

              public String getCol4() {
                  return col4;
              }

              public void setCol4(String col4) {
                  this.col4 = col4;
              }

          }

      }

      Attachments

        Issue Links

          Activity

            People

              jgiles Jonathan Giles
              duke J. Duke
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: