刷新 JList 不起作用?

发布于 2024-10-04 02:01:44 字数 319 浏览 0 评论 0原文

我在 A 类JFrame 内有一个 JList。然后,我在 B 类 中打开另一个 JFrame,它扩展 A 类。在这个类中,我 AddElement();JListJList 不会使用其中的新项目自动重绘。通过调试,我可以确定该项目已添加到模型中,但 JList 并未重绘。有谁知道我该如何解决这个问题?

编辑:我正在使用默认模型。

I've got a JList inside a JFrame in class A. I then open another JFrame in Class B which extends Class A. Inside this class I AddElement(); to the JList but the JList doesn't auto redraw with the new item in it. From debugging I can tell for sure that the item gets added to the model but the JList isn't redrawing. Does anyone know how I could fix this?

edit: I'm using the default model.

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

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

发布评论

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

评论(1

绅士风度i 2024-10-11 02:01:44

这只是一个 JList,我解决的方法是使其静态(doh!)

It was just one JList, I solved is by making it static (doh!)

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