file file=新文件(“wyniki_testu.txt”);
try {
BufferedReader br = new BufferedReader(new FileReader(file));
String firstLine = br.readLine().trim();
TableColumn kol1 = new TableColumn("Wynik");
kol1.setCellValueFactory(new PropertyValueFactory<>("wynik"));
TableColumn kol2 = new TableColumn("Data");
kol2.setCellValueFactory(new PropertyValueFactory<>("Data"));
tabela.getColumns().addAll(kol1, kol2);
Object[] tableLines = br.lines().toArray();
for(int i = 0; i < tableLines.length; i++)
{
String line = tableLines[i].toString().trim();
String[] dataRow = line.split("/");
tabela.getItems().add(dataRow);
}
} catch (Exception ex) {
}
文件中的数据如下所示:
wynik data
3 / 2020-11-21
5 / 2020-11-22
10 / 2020-11-22
我写了这个代码,但不是工作,有空表只有空列。如何修复?
暂无答案!
目前还没有任何答案,快来回答吧!