0

I am working on a Java Frame. I have created a questionnaire in which I use a number of ckeck boxes. The check boxes are labelled 1-15. I wish to collect the information on which checkboxes are selected and transfer them to a Db in MySQL.

For radiobuton, I manage this very easily because I can create a buttongroup and then :

int marital = 0  ;
if (jRadioButton3.isSelected() == true) marital = 1;
if (jRadioButton4.isSelected() == true) marital = 2;

and then on the sql side, a column will have a value 1 or 2 depending on which radio box is chosen.

However, with multiple checkboxes there is a possibility of multiple choices. Each checkbox has its own method. My question is this:

  1. How should I collect the information on which check boxes are selected. Should I transfer a vector or 15 single values?
  2. On the SQL side, should I have 15 columns or 1 column which can take a vector?

Thank you for your precise information.

Yas
  • 811
  • 4
  • 11
  • 20
  • Refer http://stackoverflow.com/questions/13348601/getting-checkbox-values-on-clicking-the-button-in-swings – Anptk Nov 03 '14 at 04:28

1 Answers1

0

No, just assign a value for each check box item.

And when you receive the value and try to insert in MySQL, then insert only the value for the button.

It will be a good approach for you.

Abrar Jahin
  • 13,970
  • 24
  • 112
  • 161