javaswingarraylistjcombobox

How do I populate a JComboBox with an ArrayList?


I need to populate a JComboBox with an ArrayList. Is there any way to do this?


Solution

  • Use the toArray() method of the ArrayList class and pass it into the constructor of the JComboBox

    See the JavaDoc and tutorial for more info.