Abstract
I have been referencing events, of all sorts, in many of the preceding chapters. It seems like a good time to take a better look at how events are handled in Swing applications.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
- 2.
- 3.
- 4.
- 5.
The primary exception was shown in Table 6-2, where there were more than a dozen listeners for the JTextArea class.
- 6.
- 7.
It's interesting to note that, at least at the time of this writing, the version 7 java.awt.event.MouseListener Javadoc page has a bad link. The “Tutorial: Writing a Mouse Listener” link should actually point to http://docs.oracle.com/javase/tutorial/uiswing/events/mouselistener.html . This bad link has been corrected on the version 8 page.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
Initially, I mistakenly used the keyTyped(...) method, thinking that it would be the one invoked after the keystroke had been processed. But I was wrong. Fortunately, it was a trivial thing to change the name of the routine from keyTyped(...) to keyReleased(...).
- 14.
- 15.
- 16.
- 17.
Thanks to Jeff Emanuel for providing this explanation on the jython-users mailing list.
- 18.
This is why my version of the script includes a counter showing the number of events that have been encountered.
- 19.
- 20.
If you are unfamiliar with the backtic operator, it converts the expression within as a printable string. See the Jython repr() built-in function.
- 21.
- 22.
- 23.
- 24.
In spite of the fact that the Javadoc for this class doesn’t identify this fact, at least not explicitly in the “Field Summary” section.
- 25.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2015 Robert A. Gibson
About this chapter
Cite this chapter
Gibson, R.A. (2015). It’s the Event of the Year: Events in Swing Applications. In: Swing for Jython. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-0817-5_14
Download citation
DOI: https://doi.org/10.1007/978-1-4842-0817-5_14
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-0818-2
Online ISBN: 978-1-4842-0817-5
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)