Help is available for each task.
Task 1
Make a subclass of Panel
called KeyPad
. Define
an array
of strings containing the key labels on a phone keypad.
You'll need arrays such as
String[] keys = { "1","2","3",
"4","5","6",
"7","8","9",
"*","0","#"
};
Button[] b = new Button[keys.length];
Task 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.
Use the following to set the layout:
public KeyPad() {
setLayout(new GridLayout(4,3));
...
}
Copyright © 1998-1999
MageLang Institute.
All Rights Reserved.