I'm wondering how to print out ALL the items within a JComboBox. I have no idea how to go about doing this. I know how to print out whatever item is selected. I just need it to where when I press a button, it prints out every option in the JComboBox.
I know it's an old question, but I found it easier to skip the ComboBoxModel.
String items = new String[]{"Rock", "Paper", "Scissors"};
JComboBox<String> comboBox = new JComboBox<>(items);
int size = comboBox.getItemCount();
for (int i = 0; i < size; i++) {
String item = comboBox.getItemAt(i);
System.out.println("Item at " + i + " = " + item);
}