|
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:
|
Use this lessons tables, the component how-to sections and the event listeners how-to sections to complete these questions and exercises.
1. What listener would you implement to be notified when a particular component has appeared on screen? What method tells you this information?
2. What listener would you implement to be notified when the user has finished editing a text field by pressing Enter? What listener would you implement to be notified as each character is typed into a text field? Note that you should not implement a general- purpose key listener, but a listener specific to text.
3. What listener would you implement to be notified when a spinners value has changed? How would you get the spinners new value?
4. The default behavior for the focus subsystem is to consume the focus traversal keys, such as Tab and Shift Tab. Say you want to prevent this from happening in one of your applications components. How would you accomplish this?
Check your answers.1. Take the
Beeper.javaexample and add a text field. Implement it so that when the user has finishing entering data, the system beeps.
2. Take the
Beeper.javaexample and add a selectable component that allows the user to enter a number from 1 to 10. For example, you can use a combo box, a set of radio buttons, or a spinner. Implement it so that when the user has selected the number, the system beeps that many times.