use of org.apache.pivot.collections.ArrayList in project pivot by apache.
the class RepeatableListButtons method initialize.
@Override
public void initialize(Map<String, Object> namespace, URL location, Resources resources) {
colorListButton = (ListButton) namespace.get("colorListButton");
checkboxBoxPane = (BoxPane) namespace.get("checkboxBoxPane");
ButtonStateListener buttonStateListener = new ButtonStateListener() {
@Override
public void stateChanged(Button button, State previousState) {
if (button.isSelected()) {
selectedCount++;
} else {
selectedCount--;
}
applyColorAction.setEnabled(selectedCount > 0);
}
};
ArrayList<String> numbers = new ArrayList<>("One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten");
for (String number : numbers) {
Checkbox checkbox = new Checkbox(number);
checkbox.getButtonStateListeners().add(buttonStateListener);
checkboxBoxPane.add(checkbox);
}
}
Aggregations