我在setCellvalueFactory上得到了无效的指针例外

发布于 2025-02-04 14:18:31 字数 1490 浏览 2 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

桃酥萝莉 2025-02-11 14:18:31

这是引发您错误的行:

InvestorIDColumn.setCellValueFactory(new PropertyValueFactory<Investor, Integer>("investor_id"));

将此数据成员声明为,

@FXML
TableColumn<Investor, Integer> InvestorIDColumn;

但在调用您的初始化方法时,它似乎没有值(尚未)。要解决此问题,您将需要初始化此数据成员(如果null状态无效),或者您可以检查它是否是null,并且只有调用setCellvalueFactory如果不是null

也许投资者ID列为XML中的某些记录是空的。

This is the line which throws your error:

InvestorIDColumn.setCellValueFactory(new PropertyValueFactory<Investor, Integer>("investor_id"));

This data member is declared as

@FXML
TableColumn<Investor, Integer> InvestorIDColumn;

but seemingly it does not have a value (yet) when your initialize method is being called. To solve this issue you will need to either initialize this data member (if a null state is invalid), or you can check whether it's null and only call setCellValueFactory if it's not null.

Maybe the investor id column is empty for some records in your XML.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文