如何将 JRadioButton 组与模型一起使用
有没有什么方法可以将一组 JRadioButtons 与数据模型关联起来,以便更容易判断选择了哪个按钮(如果有)?
在理想的情况下,我希望将一组 N 个单选按钮与一个 enum
类关联起来,该类具有一个 NONE
值以及与每个单选按钮关联的一个值。
Is there any way to associate a group of JRadioButtons with a data model so it is easier to tell which button (if any) is selected?
In an ideal world, I would like to associate a group of N radiobuttons with an enum
class that has a NONE
value and one value associated with each radiobutton.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我解决了我自己的问题,这并不太难,所以分享并享受:
I solved my own problem, this wasn't too hard, so share and enjoy:
javax.swing.ButtonGroup
是否位于您要查找的内容http://java.sun.com/javase/6/docs/api/javax/swing/ButtonGroup.html
Is the
javax.swing.ButtonGroup
on the lines of what you're looking forhttp://java.sun.com/javase/6/docs/api/javax/swing/ButtonGroup.html