Use ListModel if you want to change the content of a JList dynamically.
DefaultListModel listModel = new DefaultListModel();
JList list = new JList(listModel);
listModel.addElement("item");
listModel.addElement("another item");
4
solved Java Chat Client.. using .add methood [closed]