> Swing app.
>
> It's a tutorial. So when someone selects two
> checkboxes from a possible 4, i would ideally like to
> tell them before submitting the answers.
>
> Regards,
In that case, you could just check when the user submits the answers. If 2 of the buttons are checked, then go ahead, otherwise, do something else.
> I would extend the ButtonGroup class to make it allow
> any arbitrary number of selections instead of 1. It
I thought of this but it might be tricky: if you have 2 selections checked and someone clicks on a third, which of the 2 gets turned off? I'm sure you could solve this with a LIFO or FIFO policy, but IMO I think disabling the other checkboxes is a cleaner solution.
> > I would extend the ButtonGroup class to make it
> allow
> > any arbitrary number of selections instead of 1.
> It
>
> I thought of this but it might be tricky: if you have
> 2 selections checked and someone clicks on a third,
> which of the 2 gets turned off? I'm sure you could
> solve this with a LIFO or FIFO policy, but IMO I
> think disabling the other checkboxes is a cleaner
> solution.
You wouldn't have to uncheck one of them when the third was checked. You could just disallow the third selection, either by unchecking it when there are already two selections, or by disabling the other boxes when there are two selections. From a user perspective, I think the second option is better, since it gives visual feedback as to why the third box can't be selected.