Thanks, I'll add an English interface for the game later

(for the website itself you can already select
English, German or Russian once you register there).
The URL I call from the applet is changing constantly,
because I send GET requests to my Apache module.
And I have to use GET, because then I can use
If-Modified-Since (conditional GETs) to save some
bandwith and speed the things up.
I've read
http://java.sun.com/docs/books/tutor...ntial/threads/
(thanks James, that was a good advice) and am using wait/notify now:
URL url, alive;
public void init() {
alive = new URL("http", getCodeBase().getHost(),
"/my_module?user=" + user + "&pass=" + pass +
"&event=alive");
new Thread(this).start();
}
// set the url to be fetched by the getData()
synchronized void setUrl(String event, String args) {
while (url != null) {
// wait for getData() to clear the url
wait();
url = new URL("http", getCodeBase().getHost(),
"/my_module?user=" + user + "&pass=" + pass +
"&event=" + event + "&args=" + args);
// wake up the getData()
notify();
}
}
// fetch either the url set by the setUrl(), or the alive URL
synchronized void getData() {
HttpURLConnection conn;
// wait for setUrl() or timeout in milliseconds
wait(30 * 1000);
if (url != null)
conn = (HttpURLConnection) url.openConnection();
// timeout
else
conn = (HttpURLConnection) alive.openConnection();
conn.setRequestMethod("GET");
conn.setRequestProperty("If-Modified-Since", modified);
//conn.setUseCaches(true);
if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) {
BufferedReader input = new BufferedReader(new
InputStreamReader(conn.getInputStream()));
String line;
while ((line = input.readLine()) != null) {
area.append(line + NL);
}
input.close();
// wake up setUrl()
url = null;
notify();
}
}
public void run() {
while (true)
getData();
}
(I've removed the try/catches above).
If you have a better suggestion, please let me know.
The wait/notify/threads are difficult,
I'm still not sure if I got it right
Regards
Alex