O'Reilly logo

Ivor Horton's Beginning Java™ 2, JDK™ 5th Edition by Ivor Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

18.10. Exercises

You can download the source code for the examples in the book and the solutions to the following exercises from http://www.wrox.com.

  1. Modify Sketcher to add an Exit action for the File menu and the toolbar.

  2. Modify the Lottery applet to present the six numbers selected in ascending sequence.

  3. Replace the action listener for the selection buttons in the Lottery applet with a mouse listener and use the mousePressed() method to update the selection with a new value.

  4. Modify the Lottery applet to implement the mouse listener for a selection button as an inner class to the Lottery class.

  5. Modify the Lottery applet to implement the control buttons on a toolbar based on Action objects.

  6. Change the Lottery applet to handle the MOUSE_ENTERED and MOUSE_EXITED events within the toolbar buttons you added in the previous exercise and display a hand cursor.

  7. Add tooltips to the lucky number buttons and the toolbar buttons in the Lottery applet. (You can make the tooltip the same for each of the lucky number buttons.)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required