填充Javafx TableView
我在tableview中使用的一列有问题。
最初,此列用于显示我拥有的一种数据:
usageTab.setCellValueFactory(new PropertyValueFactory<ResearchData, String>("lusage"));
我想更改此列中显示的数据,因此我更改了FXML文件中的列名,然后写了这篇文章:
systemeTab.setCellValueFactory(new PropertyValueFactory<ResearchData, String>("lSysteme"));
我的ResearchData类是这样编码的:
public class ResearchData {
public int getRang() {
return rang;
}
public void setRang(int rang) {
this.rang = rang;
public String getLusage() {
return lusage;
}
public void setLusage(String lusage) {
this.lusage = lusage;
}
public String getlSysteme() {
return lSysteme;
}
public void setlSysteme(String lSysteme) {
this.lSysteme = lSysteme;
private int rang;
private String lusage;
private String lSysteme;
public ResearchData(int rang,
String lusage,
String lSysteme) {
this.rang= rang;
this.lusage= lusage;
this.lSysteme=lSysteme;
}
}
(我只保留了响应,Lusage和Lsysteme,但是我还有很多其他类似的变量)。
当我启动该程序时,在表观视图中,每个列都正确显示了Systeme One除外,并且我有此错误消息:
juin 10, 2022 10:55:35 AM javafx.scene.control.cell.PropertyValueFactory getCellDataReflectively
WARNING: Can not retrieve property 'lSysteme' in PropertyValueFactory: javafx.scene.control.cell.PropertyValueFactory@106b20b1 with provided class type: class codejava.ResearchData
java.lang.IllegalStateException: Cannot read from unreadable property lSysteme
我可以使用Getter打印系统数据,并且对应于我编写的一条。
你能帮助我吗?
I have a problem with one of the columns I use in a tableview.
This column was initially used to show one type of data I have :
usageTab.setCellValueFactory(new PropertyValueFactory<ResearchData, String>("lusage"));
I wanted to change the data that is shown in this column, so I changed the column name in my FXML file and I wrote this :
systemeTab.setCellValueFactory(new PropertyValueFactory<ResearchData, String>("lSysteme"));
My ResearchData class is coded like this :
public class ResearchData {
public int getRang() {
return rang;
}
public void setRang(int rang) {
this.rang = rang;
public String getLusage() {
return lusage;
}
public void setLusage(String lusage) {
this.lusage = lusage;
}
public String getlSysteme() {
return lSysteme;
}
public void setlSysteme(String lSysteme) {
this.lSysteme = lSysteme;
private int rang;
private String lusage;
private String lSysteme;
public ResearchData(int rang,
String lusage,
String lSysteme) {
this.rang= rang;
this.lusage= lusage;
this.lSysteme=lSysteme;
}
}
(I only kept rang, lusage and lSysteme, but I have a lot of other variables written exactly like this).
When I launch the program, in the tableview, every column is displayed correctly except for the Systeme one, and I have this error message :
juin 10, 2022 10:55:35 AM javafx.scene.control.cell.PropertyValueFactory getCellDataReflectively
WARNING: Can not retrieve property 'lSysteme' in PropertyValueFactory: javafx.scene.control.cell.PropertyValueFactory@106b20b1 with provided class type: class codejava.ResearchData
java.lang.IllegalStateException: Cannot read from unreadable property lSysteme
I can print the Systeme data with the getter, and it corresponds to the one I have written.
Can you help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我只需要
替换
I just had to replace
with