how to use JRadioButton groups with a model
问题 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. 回答1: I solved my own problem, this wasn't too hard, so share and enjoy: import java.util.EnumMap; import java.util.Map; import javax.swing.JRadioButton; public class RadioButtonGroupEnumAdapter<E extends