创建具有三个相关列表的 JDialog
我是一名经验不足的 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
关于
JList
和它的选择侦听器应该足以让您开始。The definite tutorial on
JList
and its selection listener should be enough to get you started.正如 Geoffrey Cheng 所建议的,
JList
是一个很好的选择。作为替代方案,您还可以查看JComboBox
; 此处有一个两层示例。任一组件都可以添加到JOptionPane
中,如此处所示。As suggested by Geoffrey Zheng,
JList
is an excellent choice. As an alternative, you might also look atJComboBox
; there's a two-tier example here. Either component can be added toJOptionPane
, as shown here.