0

I am creating a matrix of JRadioButtons (see image below). What I want to do is allow only one selection per row and column. Is there any way I can possibly assigned two button groups to a single button? Or is there any other suggestions how I may do this?

Description: I want the user to select one value from Highest, Normal, Least and Not Available option for Morning, Afternoon and Evening. However, I also want them to limit them to picking only one option from Morning, Afternoon and Evening for Highest, Normal, Least and Not available. So, basically, only one option needs to be selected for each row and only one option for each column, and yes, they can be the same option for the row and column.

Ideas? Suggestions?

Sid78669
  • 85
  • 1
  • 9
  • If I understand your question correctly, you just create 3 horizontal button groups. – Gilbert Le Blanc Jan 09 '15 at 21:33
  • I tried to do that but I cannot figure out how to implement multiple button groups for a single button. I'd truly appreciate if you can give me any idea on that. – Sid78669 Jan 09 '15 at 22:14

1 Answers1

0

You cannot use more than one ButtonGroup for a single JRadioButton. To solve the problem, just check for errors at click button, then display the proper error message if any error encountered.

Another smart idea is hiding per click. Handle click event for each one, so that when a radio button is selected its row and column are hidden setVisible(false) (or at least disabled setEnabled(false)).

  • I think I might do this. My concern, however, is the case where the user may want to select an option that is not disabled. – Sid78669 Jan 09 '15 at 22:16
  • Actually, I think I might switch to checkbox and anytime you select a checkbox, it's row and column gets disabled. to enable them again, just uncheck it. – Sid78669 Jan 09 '15 at 22:17