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

TableView rows disappears when inside a pane and KEY_UP is pressed

XMLWordPrintable

    • x86_64
    • linux_ubuntu

      ADDITIONAL SYSTEM INFORMATION :
      Ubuntu 18.04

      A DESCRIPTION OF THE PROBLEM :
      When inside the center of a Pane (tested with AnchorPane and BorderPane) and KEY_UP is pressed, the TableView disappears. It appears again if KEY_DOWN is pressed.



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Launch the example and press KEY_UP.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      First row is focused.
      ACTUAL -
      Tableview rows disappears (except the title row).

      ---------- BEGIN SOURCE ----------
      import javafx.application.Application;
      import javafx.beans.property.SimpleStringProperty;
      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.layout.BorderPane;
      import javafx.stage.Stage;

      public class HelloFx extends Application {
          
          private TableView<Person> table = new TableView<>();
          private final ObservableList<Person> data = 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("Michael",
                                                                                                   "Brown",
                                                                                                   "michael.brown@example.com"),
                                                                                        new Person("Smith", "John", "john.smith@example.com"));
          
          @Override
          public void start(Stage stage) {
              stage.setTitle("Table View Sample");
              stage.setWidth(450);
              stage.setHeight(300);
              
              TableColumn<Person, String> firstNameCol = new TableColumn<>("First Name");
              firstNameCol.setMinWidth(100);
              firstNameCol.setCellValueFactory(v -> v.getValue().firstNameProperty());
              
              TableColumn<Person, String> lastNameCol = new TableColumn<>("Last Name");
              lastNameCol.setMinWidth(100);
              lastNameCol.setCellValueFactory(v -> v.getValue().lastNameProperty());
              
              TableColumn<Person, String> emailCol = new TableColumn<>("Email");
              emailCol.setMinWidth(200);
              emailCol.setCellValueFactory(v -> v.getValue().emailProperty());
          
            
              table.setItems(data);
              table.getColumns().addAll(firstNameCol, lastNameCol, emailCol);
          
              BorderPane borderPane = new BorderPane();
              borderPane.setCenter(table);
              
              Scene scene = new Scene(borderPane);
              stage.setScene(scene);
          
              stage.show();
          }
          
          public static class Person {
              
              private final SimpleStringProperty firstName;
              private final SimpleStringProperty lastName;
              private final SimpleStringProperty email;
              
              private Person(String fName, String lName, String email) {
                  this.firstName = new SimpleStringProperty(fName);
                  this.lastName = new SimpleStringProperty(lName);
                  this.email = new SimpleStringProperty(email);
              }
          
              public String getFirstName() {
                  return firstName.get();
              }
          
              public SimpleStringProperty firstNameProperty() {
                  return firstName;
              }
          
              public void setFirstName(String firstName) {
                  this.firstName.set(firstName);
              }
          
              public String getLastName() {
                  return lastName.get();
              }
          
              public SimpleStringProperty lastNameProperty() {
                  return lastName;
              }
          
              public void setLastName(String lastName) {
                  this.lastName.set(lastName);
              }
          
              public String getEmail() {
                  return email.get();
              }
          
              public SimpleStringProperty emailProperty() {
                  return email;
              }
          
              public void setEmail(String email) {
                  this.email.set(email);
              }
          }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Not known.

      FREQUENCY : always


            aghaisas Ajit Ghaisas
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: