Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+18 votes

I'm trying to make adding/removing on our map a choice via radio buttons, however whenever I call with their toggle group I get errors. In the initialize() method I call:

addButton.setToggleGroup(editGroup);
removeButton.setToggleGroup(editGroup);

But when I call editGroup.getSelectedToggle() it messes up. I'm making sure one of them is selected, so I'm not sure what I'm doing wrong here.

asked in CSC305 Fall 2022 by (1 point)
+3

Are you getting an error message, or does it just not work?

Is your initialize method being called at all -- check by putting a println statement in it.

1 Answer

+7 votes

is the editGroup is a variable type Group() or ToggleGroup()?
also, is the addButton and removeButton is ToggleButton?
Cuz it should be ToggleGroup() and ToggleButton to work together

answered by (1 point)
...