Called by the browser or applet viewer to inform this applet that it should stop its execution. Unfortunately, there are no guarantees from the Java spec when or if stop() will be called (i.e. on browser quit, or when moving between web pages), and it's not always called.
()
| 1339 | * or when moving between web pages), and it's not always called. |
| 1340 | */ |
| 1341 | public void stop() { |
| 1342 | // this used to shut down the sketch, but that code has |
| 1343 | // been moved to destroy/dispose() |
| 1344 | |
| 1345 | // if (paused) { |
| 1346 | // synchronized (pauseObject) { |
| 1347 | // try { |
| 1348 | // pauseObject.wait(); |
| 1349 | // } catch (InterruptedException e) { |
| 1350 | // // waiting for this interrupt on a start() (resume) call |
| 1351 | // } |
| 1352 | // } |
| 1353 | // } |
| 1354 | |
| 1355 | //paused = true; // causes animation thread to sleep // 3.0a5 |
| 1356 | pause(); |
| 1357 | handleMethods("pause"); |
| 1358 | // calling this down here, since it's another thread it's safer to call |
| 1359 | // pause() and the registered pause methods first. |
| 1360 | surface.pauseThread(); |
| 1361 | |
| 1362 | // actual pause will happen in the run() method |
| 1363 | |
| 1364 | // synchronized (pauseObject) { |
| 1365 | // debug("stop() calling pauseObject.wait()"); |
| 1366 | // try { |
| 1367 | // pauseObject.wait(); |
| 1368 | // } catch (InterruptedException e) { |
| 1369 | // // waiting for this interrupt on a start() (resume) call |
| 1370 | // } |
| 1371 | // } |
| 1372 | } |
| 1373 | |
| 1374 | |
| 1375 | /** |
no test coverage detected