Class CheckBoxListener
java.lang.Object
it.polimi.ingsw.Client.GUI.Listeners.CheckBoxListener
- All Implemented Interfaces:
ItemListener
,EventListener
Listener responsible for restricting the maximum number of checkboxes that can be selected
-
Field Summary
Modifier and TypeFieldDescriptionprivate final JCheckBox[]
"listened" checkboxesprivate final int
limit of selectable checkboxesprivate int
Selected checkboxes -
Constructor Summary
ConstructorDescriptionCheckBoxListener
(int limit, JCheckBox[] checkBoxes) Create a new checkBoxListener -
Method Summary
Modifier and TypeMethodDescriptionvoid
As soon as one checkbox has been selected, verify that selected checkBoxes are less than maximum
-
Field Details
-
maxCheckBoxesSelectable
private final int maxCheckBoxesSelectablelimit of selectable checkboxes -
checkBoxes
"listened" checkboxes -
selectionCounter
private int selectionCounterSelected checkboxes
-
-
Constructor Details
-
CheckBoxListener
Create a new checkBoxListener- Parameters:
limit
- maximum number of selectable checkBoxescheckBoxes
- checkboxes that will be listened by this listener
-
-
Method Details
-
itemStateChanged
As soon as one checkbox has been selected, verify that selected checkBoxes are less than maximum- Specified by:
itemStateChanged
in interfaceItemListener
- Parameters:
e
- the event to be processed
-