|
NOTA: La traducción de esta documentación es un esfuerzo personal y voluntario, no es un documento oficial de Sun Microsystems
ni Oracle ni está patrocinado por ninguna de estas empresas. Los documentos originales (en inglés) están disponibles en:
http://java.sun.com/docs/books/tutorial/.
Dirija cualquier comentario, petición, felicitación, etc. a tutorialesjava_@RROBA_codexion.com. |
Si desea ayudar a mantener en funcionamiento esta web, colaborar con la traducción de estos documentos o necesita que se traduzca algĂșn capĂtulo en concreto puede realizar una donación directa mediante Paypal:
|
Stop! Before you let the whole world know about your applet, make sure the answer to all of the following questions is yes.
- Have you removed or disabled debugging output?
Debugging output (generally created withSystem.out.println), while useful to you, is generally confusing or annoying to users. If you need to give textual feedback to the user, try to do it inside the applet's display area or in the status area at the bottom of the window. Information on using the status area is in Displaying Short Status Strings.
- Does the applet stop running when it's offscreen?
Most applets should not use CPU resources when the browser is iconified or is displaying a page that doesn't contain the applet. If your applet code doesn't launch any threads explicitly, then you're OK.If your applet code launches any threads, then unless you have a really good excuse not to, you should implement the
stopmethod so that it stops and destroys (by setting to null) the threads you launched. For an example of implementing thestopmethod, see Threads in Applets: Examples.
- If the applet does something that might get annoying play sounds or animation, for example does it give the user a way of stopping the annoying behavior?
Be kind to your users. Give them a way to stop the applet in its tracks, without leaving the page. In an applet that otherwise doesn't respond to mouse clicks, you can do this by implementing themouseDownmethod so that a mouse click suspends or resumes the annoying thread. For example:boolean frozen = false; //an instance variable public boolean mouseDown(Event e, int x, int y) { if (frozen) { frozen = false; start(); } else { frozen = true; stop(); } return true; }