我在javaFX表视图中查看arff文件时遇到了很大的问题。我的代码:
ArffLoader loader = new ArffLoader();
loader.setFile(arff);
Instances data = loader.getDataSet();
List<TableColumn<Instance, String>> atrributes = new ArrayList<>();
for (int i = 0; i < data.numAttributes(); i++) {
atrributes.add(new TableColumn<Instance,String>` (data.attribute(i).name()));
}
List <Instance> instances = new ArrayList<>();
for (int i =0;i<data.size();i++)
{
instances.add(data.get(i));
}
ObservableList<Instance> tableContent = FXCollections.observableArrayList(instances);
table.getColumns().removeAll();
table.getColumns().addAll(atrributes);
table.setItems(tableContent);
table.setVisible(true);
列名(属性)设置正确,但竞赛不是shwon(tableContent变量)
答案 0 :(得分:0)