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;
}
}
}
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;
}
}
}
- relates to
-
JDK-8089253 [TableView, Traversal, HelloTableView] Tabbing and focus problems in Table
-
- Closed
-