Sun Java Solaris Communities My SDN Account Join SDN
 
Tutorials & Code Camps

Effective Layout Management: Magercise 2: Phone Dialing Keypad

 
Training Index

[Help | API Docs | Short Course | Magercises]

In this Magercise you will create a phone keypad full of buttons laid out with GridLayout.

Magercise 2 Prerequisites

None.

Skeleton Code

PhonePadTest.java

Tasks:

  1. Make a subclass of Panel called KeyPad. Define an array of strings containing the key labels on a phone keypad.

  2. In the constructor, set the layout to be a 4 row by 3 column grid of buttons. Create and add buttons to the container with a for loop.

Where help exists, the task numbers above are linked to the step-by-step help page.

Solution Source

PhonePadTest.java

Demonstration

Magercise 3

Short Course

About This Short Course

Copyright © 1998-1999 MageLang Institute. All Rights Reserved.