包含两列的图像具有值,而其他三列则没有值
public void mainWork(){
studentNameCol.setCellValueFactory(new PropertyValueFactory<shortListed, String>("tcStudentName"));
studentIdCol.setCellValueFactory(new PropertyValueFactory<shortListed, String>("tcStudentID"));
bookNameCol.setCellValueFactory(new PropertyValueFactory<statisticsInfo,String>("tcBookName"));
bookIdCol.setCellValueFactory(new PropertyValueFactory<shortListed, String>("tcBookID"));
dateCol.setCellValueFactory(new PropertyValueFactory<statisticsInfo,String>("tcIssueDate"));
studentTable.setItems(getInfo());
}
我正在用javafx和场景构建器制作一个图书馆管理系统,并用数据库中的数据填充TableView的列时,我注意到有些列正在填充,而有些则没有。我打印的值认为这是数据库错误,但很好。一切都很完美,只是我看不到某些表中的某些值,我在代码中附加了gui表的图片。
public ObservableList<statisticsInfo> getInfo(){
ObservableList<statisticsInfo> data = FXCollections.observableArrayList();
try {
pst=con.prepareStatement("select * from adminrgistrationinfo.issuebook");
ResultSet rs = pst.executeQuery();
while (rs.next()){
data.add(new statisticsInfo(rs.getString(4),rs.getString(3),rs.getString(2),rs.getString(1),rs.getString(5)));
System.out.println(rs.getString(4)+rs.getString(3)+rs.getString(2)+rs.getString(1)+rs.getString(5));
}
}
catch (Exception e){
JOptionPane.showMessageDialog(null,e.getMessage());
}
return data;
}