|
Consider an instant message GUI (note: this is not exactly what i'm writing, but the best description I can give). There is an input box for typing messages to another computer (JTextField) and an output field for recieving (JTextArea).
The problem I'm having is that my theory on writing this started with the idea that someone would send a message, and then recieve a message, which obviously is not that case, as sometimes you'll send 4 messages before you recieve one, and vice versa. If I let the program "hang" until it recieves a message it locks up the GUI until it recieves said message, making it impossible to input anything. Is there any way around this, specifically two seperate chunks of code running at the same time, allowing two seperate things to be happening?
I've tried googling, but this isn't the easiest thing to describe in a short string.
|