Filling a JList with data
问题 Does anyone have any good tutorials on how to fill a JList (within a JPanel ) with user inputted data. Specifically, I want to add people to a selected roster. Is this a matter of filling it with an ArrayList ? Any help would be much appreciated. 回答1: create a ListModel which wrapps your java.util.List (e.g. by extending AbstractListModel) configure JList to use this model create and configure a renderer to format/ display the Objects in your list as needed http://docs.oracle.com/javase