创建具有三个相关列表的 JDialog

发布于 2024-09-24 19:07:01 字数 200 浏览 0 评论 0原文

我是一名经验不足的 Java Swing 开发人员,我需要创建一个 JDialog 来显示三个不同的数据列表。用户对第一列表中的项目的选择将更新第二列表的内容,并且对第二列表中的项目的选择将更新第三列表的内容。此外,当启动对话框时,应选择所有三个列表中的第一项。

有人可以建议我一种做这样的事情的方法吗?我应该使用三个还是 JList?

提前致谢!!!!

I am an inexperienced Java Swing developer and I need to create a JDialog which displays three different lists of data. The user's selection of an item in the first list will update the content of the second list and the selection of an item in the second list will update the content of the third list. Also when the dialog is launched the first item of all three lists should be selected.

Can someone suggest me an approach to do such a thing? Should I use three or JLists?

Thanks in advance!!!!

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

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

发布评论

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

评论(2

书间行客 2024-10-01 19:07:01

关于 JList 和它的选择侦听器应该足以让您开始。

The definite tutorial on JList and its selection listener should be enough to get you started.

愿与i 2024-10-01 19:07:01

正如 Geoffrey Cheng 所建议的,JList 是一个很好的选择。作为替代方案,您还可以查看JComboBox此处有一个两层示例。任一组件都可以添加到 JOptionPane 中,如此处所示。

As suggested by Geoffrey Zheng, JList is an excellent choice. As an alternative, you might also look at JComboBox; there's a two-tier example here. Either component can be added to JOptionPane, as shown here.

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