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.

Get Ivor Horton's Beginning Java™ 2, JDK™ 5th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.