Combo box setItems from 0 to 59 how can i do this

Combo box setItems from 0 to 59 how can i do this

What did you try?

MonthWeekDay.setItems(“0”,“1”,“2”…);

will it not be too long ?

?

You can create a List and put the numbers in there. setItems also accepts collections.

So something like this:

        ComboBox<String> comboBox = new ComboBox<>();
        List<String> items = new ArrayList<>();
        for (int i = 0; i < 60; i++) {
            items.add("" + i);
        }
        comboBox.setItems(items);

Thanks a lot

This should also work

comboBox.setItems(IntStream.range(0,60).boxed())

Sorry, items are String, so

IntStream.range(0,60).mapToObj(Integer::toString)