-
Notifications
You must be signed in to change notification settings - Fork 1
Multiple Choice Class
Mohammad Mahfooz edited this page Mar 10, 2023
·
3 revisions
The MultipleChoiceButton
class is a custom button that extends the SelectionButton
class. It is used to represent a multiple-choice selection button.
-
MultipleChoiceButton(String text)
: Creates a newMultipleChoiceButton
with the given text.
-
void switchSelected()
: Changes the selected state of the button. If the button is being selected, it also deselects all otherSelectionButton
s in the same parent container.
MultipleChoiceButton button = new MultipleChoiceButton("Choice 1");
button.setSelected(true);
button.addActionListener(e -> {
System.out.println("Button clicked");
});