Java Exercises
Components
|
These
exercises should be carried out after working
through
the Components
Tutorials
You
should carry out both exercises.
Exercise
1: Create Components
Exercise
2: Create the Menu
Exercise
1: Create Components
Examine
the picture of the applet below. There are a number of different
components. We have two labels, two text fields and 26 buttons.
Create
an applet with all the components shown above.
Hint:
I would suggest you create a panel, add the panel to the content pane of the
applet and then add all the other components to this panel. If you
don't you will only see one component in the applet window.
You
will notice that the arrangement of your components is different. You
will learn how to control your arrangement of your components in the next tutorial
- Layout Managers.
Exercise
2: Create the Menu
The
applet also has a menu. The expanded menu looks like this:-
Hopefully
you have already created a menu like this in the Containers
exercise. If not then go and do that now.
Add
the code for creating your menu to the code you have written for the first
exercise above.
Have
fun!
|