Java: Checkbox value to Vector

If CheckBox is selected  True will be added in the Vector    if CheckBox is not selected  False will be added.

Sometimes we may need in java programming to do such code where  if any CheckBox is selected than  True should need to be added in the Vector  in the same way, if  CheckBox is not selected then False will be added in Vector.

Here is the code snippet by which you can solve the problem described  above.

Vector data=new Vector();

 data.add((chkbox_buyer_name.isSelected()?”true”:”false”)+””);

 data.add((chkbox_item_number.isSelected()?”true”:”false”)+””);

 data.add((cb_order_number.isSelected()?”true”:”false”)+””);

 data.add((chkbox_style_number.isSelected()?”true”:”false”)+””);

 data.add((chkbox_style_description.isSelected()?”true”:”false”)+””);

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: