For my first java project, I'm attempting to develop my own instant messenger type program. I have my client and server sockets set up ok and the server can accept multiple clients. My next step is to try and send private messages to selected clients. What I am trying to do is when a client connects to the server, the clients name, port and ip address will be displayed in a JList on my gui. I have my JList on my gui but my problem comes with trying to update the list when a new client is connected.
I have several classes...
MyClient.java: creates client gui and sends connection to MyServer.java
MyServer.java: This is my server. It accepts connection from client and creates a ConnectionHandler to handle each connection by each client.
UsersGroup.java: This class maintains info about the clients. Adds User objects to a vector to keep track of which clients are online.
Users.java: Stores info about each client, e.g. ip address, port
ConnectionHandler.java: An instance is created to handle each client connection. Details about client are stored in a UsersGroup object. And monitors msgs incoming to server.
IncomingChat.java: This class monitors the input to the client from the server and displays the message to MyClients gui.
Does anyone have any idea how I would go about this??? If you need to view any of the code, let me know. I thought posting all those classes would be a bit much but if it's needed just let me know
Thanks for that but I was hoping someone could lend a hand with how to get the info about the current clients back to be displayed on the gui. i.e how to get the instances of the Users objects stored in the UsersGroup object back to MyClient class. I hope this makes sense and that I'm explaining it properly