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

TableView: visual glitch at borders on horizontal scrolling

XMLWordPrintable

      The issue:
      at some values of hbar the left/right border of the table is visibly "narrowed" in the content region, as if it were partly hidden by first/last cell or row.

      To reproduce:
       - run and make sure that the vbar is not visible, the hbar is visible
          and there are enough pixels for scrolling horizontally
       - move hbar slowly (best pixel-wise) and look closely at the right border of table
       - expected: right border visible at its full width at all times
       - actual: at some values, the right border is much thinner than most of the time
       
       actually similar at left border, but harder to detect: at both sides, there's
       a detectable jitter of the border when scrolling quickly (look at the empty rows)

      The example:

      public class PlainTableViewSample extends Application {

          private Parent createContent() {
              TableView<Person> table = createPlainTable();
              BorderPane content = new BorderPane(table);
              return content;
          }

          private TableView<Person> createPlainTable() {
              TableView<Person> table = new TableView<>(Person.persons());
              table.getColumns().addAll(createColumn("firstName"),
                      createColumn("lastName"), createColumn("email"), createColumn("secondaryMail"));
              return table;
          }
          
          private TableColumn<Person, String> createColumn(String property) {
              TableColumn<Person, String> column = new TableColumn<>(property);
              column.setCellValueFactory(new PropertyValueFactory<>(property));
              return column;
          }
          @Override
          public void start(Stage stage) throws Exception {
              stage.setScene(new Scene(createContent()));
              //stage.setTitle(FXUtils.version());
              stage.show();
          }

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

          @SuppressWarnings("unused")
          private static final Logger LOG = Logger
                  .getLogger(PlainTableViewSample.class.getName());

      }


      for convenience, the data class

      /**
       * Example fx bean. Copied from tutorial with added
       * property accessors.
       */
      public class Person {
          private final SimpleStringProperty firstName;
          private final SimpleStringProperty lastName;
          private final SimpleStringProperty email;
          private final SimpleStringProperty secondaryMail;
          
          public Person(String fName, String lName) {
              this(fName, lName, "");
          }
          public Person(String fName, String lName, String email) {
              this.firstName = new SimpleStringProperty(fName);
              this.lastName = new SimpleStringProperty(lName);
              this.email = new SimpleStringProperty(email);
              this.secondaryMail = new SimpleStringProperty("xx" + email);
          }
          
          public String getFirstName() {
              return firstName.get();
          }
          public void setFirstName(String fName) {
              firstName.set(fName);
          }
          
          public StringProperty firstNameProperty() {
              return firstName;
          }
          public String getLastName() {
              return lastName.get();
          }
          public void setLastName(String fName) {
              lastName.set(fName);
          }
          
          public StringProperty lastNameProperty() {
              return lastName;
          }
          public String getEmail() {
              return email.get();
          }
          public void setEmail(String fName) {
              email.set(fName);
          }
          
          public StringProperty emailProperty() {
              return email;
          }
          
          public String getSecondaryMail() {
              return secondaryMailProperty().get();
          }
          
          public void setSecondaryMail(String mail) {
              secondaryMailProperty().set(mail);
          }
          public StringProperty secondaryMailProperty() {
              return secondaryMail;
          }
          
          @Override
          public String toString() {
              return getLastName() + ", " + getFirstName();
          }
          public static ObservableList<Person> persons() {
              return FXCollections.observableArrayList(
                      new Person("Jacob", "Smith", "jacob.smith@example.com"),
                      new Person("Isabella", "Johnson", "isabella.johnson@example.com"),
                      new Person("Ethan", "Williams", "ethan.williams@example.com"),
                      new Person("Emma", "Jones", "emma.jones@example.com"),
                      new Person("Lucinda", "Micheals", "lucinda.micheals@example.com"),
                      new Person("Michael", "Brown", "michael.brown@example.com"),
                      new Person("Barbara", "Pope", "barbara.pope@example.com"),
                      new Person("Penelope", "Rooster", "penelope.rooster@example.com"),
                      new Person("Raphael", "Adamson", "raphael.adamson@example.com"));
              
          }
      }

            mhanl Marius Hanl
            fastegal Jeanette Winzenburg
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: