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

Node as table column breaks tab traversal

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 8u45
    • javafx
    • None
    • Fedora release 20
      java version "1.8.0_45"
      Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
      (Heisenbug)

      This may or may not be a duplicate of RT-39189.

      When running the following test programm and using <Tab> to traverse the Nodes, the focus gets "caught" in button "two", i.e. when the focus is there it won't move on to button "three".

      import javafx.application.Application;
      import javafx.beans.property.SimpleStringProperty;
      import javafx.beans.property.StringProperty;
      import javafx.collections.FXCollections;
      import javafx.collections.ObservableList;
      import javafx.scene.Scene;
      import javafx.scene.control.Button;
      import javafx.scene.control.SelectionMode;
      import javafx.scene.control.TableColumn;
      import javafx.scene.control.TableView;
      import javafx.scene.control.cell.PropertyValueFactory;
      import javafx.scene.layout.VBox;
      import javafx.stage.Stage;

      public class TableViewFocusTraversal extends Application {

          ObservableList<Person> items = FXCollections.observableArrayList();
          TableView<Person> table = new TableView<Person>();

          public TableViewFocusTraversal() {
          }

          @Override
          public void start(Stage primaryStage) throws Exception {
              TableColumn<Person, String> firstNameCol = new TableColumn<Person, String>();
              firstNameCol.setCellValueFactory(new PropertyValueFactory<Person, String>("firstName"));
              firstNameCol.setGraphic(new Button("two"));
              table.getColumns().add(firstNameCol);
              table.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
              
           VBox vbox = new VBox();
              vbox.getChildren().addAll(new Button("one"), table, new Button("three"));

              Scene scene = new Scene(vbox, 400, 400);
              primaryStage.setScene(scene);
              primaryStage.show();
          }

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

          public class Person {
              private StringProperty firstName;

              public void setFirstName(String value) {
                  firstNameProperty().set(value);
              }

              public String getFirstName() {
                  return firstNameProperty().get();
              }

              public StringProperty firstNameProperty() {
                  if (firstName == null)
                      firstName = new SimpleStringProperty(this, "firstName");
                  return firstName;
              }
          }
      }

            jgiles Jonathan Giles
            rlichtenbjfx Robert Lichtenberger (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: