Can an applet have multiple threads running?
Posted on 1998-06-17
Here's my basic program:
The user goes to a web page and enters his username and password into the boxes provided.
He then gets shown a calendar window, with the days of a particular month being represented as panels with a number on them.
If he clicks a panel, the program attempts to book him in, sending the booking information to the server.
The server then replies, and he is booked.
The problem that I have, though, is this:
My applet asks for U and P, loads up the calendar window, and initialises it fine. However, if I then try and get the applet to listen to its socket for incoming information about other bookings, then the calendar window freezes up after initialisation, but before painting.
My initial thought was that (contrary to my expectations) the calendar window was being initiated by the same thread that listened for input, and as painting was lower priority than direct instructions, the program was stopping at this point.
However, when I tried to put the calendar window initiation on a new thread (so that both could run in parallel, time-sharing), the window still freezes up!