I'm still learning swing and sockets both, so bear with me. To learn I'm making a chat client/server system. Right now, I'm working on the client. My classes are
- Main (With the main method) code link
- Window (Sets up Swing components) code link
- ActLis(Handles all component action listeners from Window) code link
- SocketManager(Manages my sockets) code link
I set up a SocketManager
object in Main
when the program runs, but then when ActLis
needs to use that socket to send a message
I don't know of a good way to get it from Main
. Is what I'm doing completely ineffective and there is a better way to set it up, or is there a way to get my SocketManager
object from my Main
class that I don't know? (I realize there are other problems in my code, but I'm just trying to get sockets to work for a start, I'm having a hard time with them.)