JList not responding to listModel.addElement(
问题 I have a JList in my Java Swing application and when a user clicks a button, the list clears and the contents reset as follows: public void reset(ArrayList<String> content) { listModel.removeAllElements(); System.out.println(content.size()); for(int i = 0; i < content.size(); i++) { listModel.addElement(content.get(i)); System.out.println("Added element " + content.get(i)); } } The list is initialized as follows listModel = new DefaultListModel(); list = new JList(listModel); However there is