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

20.7. 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. Implement a dialog initiated from a toolbar button to select the current element color.

  2. Add a menu item to the Element context menu that will display information about the element at the cursor in a dialog—what it is and its basic defining data.

  3. Display a special context menu when the cursor is over a TEXT object that provides a menu option to edit the text through a dialog.

  4. Change the implementations of the element classes to make use of the combined translate and rotate operation.

  5. Add a toolbar button to switch highlighting on and off. The same button should turn it on when it is off and vice versa, so you need to change the button label appropriately.

  6. Add a Scale menu item to the element context menu that will allow a geometric element to be scaled by dragging the mouse cursor.

  7. Implement a main menu item and a toolbar button for choosing a custom color.

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