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

Cannot select row in tableview when maximizing or resizing window

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8u5, 8u11, 8u20, 8u25
    • javafx
    • Windows 7 Prof, I5, I7, Intel HD graphics, Intel 4600

      When maximizing the application window that contains table, table row cannot be selected. If window is not maximized then the table allow selection.
      I have played around with different systems and different system behaves differently (providing the same hardware and settings).
      For examples,
      A. Couple I7 windows 7 prof with intel 4600 graphic cards:
        On one system, it works fine if the application is in a monitor (dual monitors) that does not have task bar. It does not work on the monitor that has task bar (when maximized). On the same system, sometime unchecking the "use small icons" checkbox in the taskbar properties will make it not work.
        On one system, changing the text size in display settings from smaller (default) to medium will break it too.
        On some other systems it works fine.

      Procedure:
      Run the following code.
      Maximize the window
      Try to select a row.


      Here is the code that I use to test:

      import javafx.application.Application;
      import javafx.beans.property.SimpleStringProperty;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.scene.Group;
      import javafx.scene.Scene;
      import javafx.scene.control.Label;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableView;
      import javafx.scene.control.cell.PropertyValueFactory;
      import javafx.scene.layout.HBox;
      import javafx.scene.text.Font;
      import javafx.stage.Stage;
       
      public class table extends Application {
          HBox root = new HBox();
          private TableView<Person> table = new TableView<Person>();
          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")
              );
       
          public static void main(String[] args) {
              launch(args);
          }
       
          @Override
          public void start(Stage stage) {
              Scene scene = new Scene(new Group());
              double weight = scene.getWidth();;
              double height=scene.getHeight();
              stage.setTitle("Table View Sample");
              stage.setWidth(weight);
              stage.setHeight(height);
              table.setEditable(true);
              TableColumn firstNameCol = new TableColumn("First Name");
              firstNameCol.setMinWidth(500);
              firstNameCol.setCellValueFactory(
                      new PropertyValueFactory<Person, String>("firstName"));
       
              TableColumn lastNameCol = new TableColumn("Last Name");
              lastNameCol.setMinWidth(500);
              lastNameCol.setCellValueFactory(
                      new PropertyValueFactory<Person, String>("lastName"));
       
              TableColumn emailCol = new TableColumn("Email");
              emailCol.setMinWidth(1000);
              emailCol.setCellValueFactory(
                      new PropertyValueFactory<Person, String>("email"));
       
              table.setItems(data);
              table.getColumns().addAll(firstNameCol, lastNameCol, emailCol);
              root.getChildren().addAll(table);
              scene = new Scene(root, weight, height, true);
              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 void setFirstName(String fName) {
                  firstName.set(fName);
              }
       
              public String getLastName() {
                  return lastName.get();
              }
       
              public void setLastName(String fName) {
                  lastName.set(fName);
              }
       
              public String getEmail() {
                  return email.get();
              }
       
              public void setEmail(String fName) {
                  email.set(fName);
              }
          }
      }

            Unassigned Unassigned
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported: