+1 vote
in Class 12 by kratos

Write and explain two methods each of Check Box and Radio Button.

1 Answer

+5 votes
by kratos
 
Best answer

Radio Button :

(i) isSelected() returns true if the component is checked else returns false.

boolean b = < radiobutton-name > .isSelected();

(ii) setSelected() checks(true) or unchecks the radio button.

<radiobutton-name>.setSelected(boolean b);

Checkbox :

(i) isselected() returns true if the component is checked else returns false.

boolean b = <checkbox-name>.isSelected();

(ii) setSelected() checks(true) or unchecks the checkbox.

< checkbox-name >.setSelected (boolean b);

...