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

17.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. Create an application with a square window in the center of the screen that is half the height of the screen by deriving your own window class from JFrame.

  2. Add six buttons to the application in the previous example in a vertical column on the left side of the application window.

  3. Add a menu bar containing the items File, Edit, Window, and Help.

  4. Add a drop-down menu for Edit containing two groups of items of your own choice with a separator between them.

  5. Add another item to the Edit drop-down menu, which itself has a drop-down menu, and provide accelerators for the items in the menu.

  6. Here's an exercise to tickle the brain cells—use a SpringLayout to obtain the button arrangement shown in Figure 17-48 in an application window.

Figure 17.48. Figure 17-48

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