Add them to a ButtonGroup
.
ButtonGroup group = new ButtonGroup();
group.add(male);
group.add(female);
From the How to Use Buttons, Check Boxes, and Radio Buttons tutorial:
For each group of radio buttons, you need to create a ButtonGroup instance and add each radio button to it. The ButtonGroup takes care of unselecting the previously selected button when the user selects another button in the group.
You should generally initialize a group of radio buttons so that one is selected. However, the API doesn't enforce this rule — a group of radio buttons can have no initial selection. Once the user has made a selection, exactly one button is selected from then on.