TreeTableView
을 JDK 8
으로 실험했습니다. 내 프로그램을 가져오고 작동 한 후에, 나는 스크롤했을 때 행이 텅 빈 상태가되는 문제를 발견했다. 셀의 가시성 재설정, 업데이트, 업데이트 될 때 다시 그리기, 또는 열의 가시성 재설정 등 모든 것을 시도했습니다. 다음은 트리 애트리뷰트를 스크롤 할 때 행이 공백으로 표시되지만 테이블 뷰의 경우에는 그렇지 않다는 것을 보여주기 위해 작성한 테스트 애플릿입니다.스크롤 할 때 JavaFX TreeTableView 행이 사라졌습니다.
public class TableViewTest extends Application{
private TreeTableView treeTable = new TreeTableView();
private TableView regularTable = new TableView();
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
final ObservableList<Person> data = FXCollections.observableArrayList(
new Person("Jacob", "Smith", "[email protected]"),
new Person("Isabella", "Johnson", "[email protected]"),
new Person("Ethan", "Williams", "[email protected]"),
new Person("Emma", "Jones", "[email protected]"),
new Person("Michael", "Brown", "[email protected]"),
new Person("Jacob", "Smith", "[email protected]"),
new Person("Isabella", "Johnson", "[email protected]"),
new Person("Ethan", "Williams", "[email protected]"),
new Person("Emma", "Jones", "[email protected]"),
new Person("Michael", "Brown", "[email protected]"),
new Person("Jacob", "Smith", "[email protected]"),
new Person("Isabella", "Johnson", "[email protected]"),
new Person("Ethan", "Williams", "[email protected]"),
new Person("Emma", "Jones", "[email protected]"),
new Person("Michael", "Brown", "[email protected]"),
new Person("Jacob", "Smith", "[email protected]"),
new Person("Isabella", "Johnson", "[email protected]"),
new Person("Ethan", "Williams", "[email protected]"),
new Person("Emma", "Jones", "[email protected]"),
new Person("Michael", "Brown", "[email protected]"),
new Person("Jacob", "Smith", "[email protected]"),
new Person("Isabella", "Johnson", "[email protected].com"),
new Person("Ethan", "Williams", "[email protected]"),
new Person("Emma", "Jones", "[email protected]"),
new Person("Michael", "Brown", "[email protected]"),
new Person("Jacob", "Smith", "[email protected]"),
new Person("Isabella", "Johnson", "[email protected]"),
new Person("Ethan", "Williams", "[email protected]"),
new Person("Emma", "Jones", "[email protected]"),
new Person("Michael", "Brown", "[email protected]"),
new Person("Jacob", "Smith", "[email protected]"),
new Person("Isabella", "Johnson", "[email protected]"),
new Person("Ethan", "Williams", "[email protected]"),
new Person("Emma", "Jones", "[email protected]"),
new Person("Michael", "Brown", "[email protected]"),
new Person("Jacob", "Smith", "[email protected]"),
new Person("Isabella", "Johnson", "[email protected]"),
new Person("Ethan", "Williams", "[email protected]"),
new Person("Emma", "Jones", "[email protected]"),
new Person("Michael", "Brown", "[email protected]")
);
// REGULAR TABLE -------------------------------------------------------------------------
Scene tableScene = new Scene(new Group());
Stage tableStage = new Stage();
tableStage.setTitle("Table View Sample");
tableStage.setWidth(300);
tableStage.setHeight(500);
tableStage.show();
regularTable.getItems().addAll(data);
regularTable.setEditable(true);
TableColumn regularFirstNameCol = new TableColumn("First Name");
TableColumn regularLastNameCol = new TableColumn("Last Name");
TableColumn regularEmailCol = new TableColumn("Email");
regularFirstNameCol.setCellValueFactory(new PropertyValueFactory<Person, String>("firstName"));
regularLastNameCol.setCellValueFactory(new PropertyValueFactory<Person, String>("lastName"));
regularEmailCol.setCellValueFactory(new PropertyValueFactory<Person, String>("email"));
regularTable.getColumns().addAll(regularFirstNameCol, regularLastNameCol, regularEmailCol);
final VBox vbox1 = new VBox();
vbox1.setSpacing(5);
vbox1.setPadding(new Insets(10, 0, 0, 10));
vbox1.getChildren().addAll(regularTable);
((Group) tableScene.getRoot()).getChildren().addAll(vbox1);
tableStage.setScene(tableScene);
// TREE TABLE ----------------------------------------------------------------------------------------------------------------------
Scene scene = new Scene(new Group());
stage.setTitle("Tree Table Sample");
stage.setWidth(300);
stage.setHeight(500);
final Label label = new Label("Address Book");
label.setFont(new Font("Arial", 20));
treeTable.setEditable(true);
TreeTableColumn firstNameCol = new TreeTableColumn("First Name");
TreeTableColumn lastNameCol = new TreeTableColumn("Last Name");
TreeTableColumn emailCol = new TreeTableColumn("Email");
treeTable.getColumns().addAll(firstNameCol, lastNameCol, emailCol);
final VBox vbox = new VBox();
vbox.setSpacing(5);
vbox.setPadding(new Insets(10, 0, 0, 10));
vbox.getChildren().addAll(label, treeTable);
((Group) scene.getRoot()).getChildren().addAll(vbox);
stage.setScene(scene);
firstNameCol.setCellValueFactory(new TreeItemPropertyValueFactory<Person,String>("firstName"));
lastNameCol.setCellValueFactory(new TreeItemPropertyValueFactory<Person,String>("lastName"));
emailCol.setCellValueFactory(new TreeItemPropertyValueFactory<Person,String>("email"));
TreeItem<Person> root = new TreeItem<Person>(new Person("TEST", "TEST", "TEST"));
treeTable.setRoot(root);
treeTable.setShowRoot(true);
root.setExpanded(true);
for (Person person : data){
TreeItem<Person> p = new TreeItem<Person>(person);
root.getChildren().add(p);
}
stage.show();
}
아무도 이것에 대한 수정/솔루션을 알고 있나요, 또는이가 TreeTableView
알려진 버그?
편집 : 난 그냥이 예
https://wikis.oracle.com/display/OpenJDK/TreeTableView+API+Examples
를 사용하여이 시도하고 나는 여전히 회칠 인/누락 된 행의 동일한 문제를 얻는다.
어떤 jdk8 빌드를 사용합니까? –
어떤 빌드를 사용하고 있는지 확실하지 않습니다. (확인하는 방법이 있습니까?) 도움이된다면 8/8/13에 다운로드했습니다. – thatjavaguy09
java -version은 8.0-b ###과 같은 결과를 출력합니다. ### ... –