I have a Client_manager named CM that return an arrayList.
public class Client_Manager {
private static Client_Manager self = null;
private ArrayList<Client_Thread> clientList;
public Client_Manager() {
self = this;
this.clientList = new ArrayList<>();
}
public static Client_Manager getInstance()
{
if(self == null)
self = new Client_Manager();
return self;
}
public void addClientThread(Client_Thread client)
{
this.clientList.add(client);
}
public Client getClientAt(int index)
{
return this.clientList.get(index).getOwner();
}
public void removeClient(int index)
{
this.clientList.remove(index);
}
public ArrayList<Client> getClientList() {
ArrayList<Client> ar = new ArrayList<>();
for(int count1 = 0; count1 < clientList.size(); count1++)
{
ar.add(clientList.get(count1).getOwner());
}
return ar;
}
}
and Jlist named 'showClient'. What i am trying to do is get the arraylist from CM.(CM.getClientList) to show up in the jlist showClient. Furthurmore, i want it update the changes every time CM get new clients. How should i begin? first time assignment with swing.
Need someone to point me to the right direction either documents or an examples. ...