December
1999 QUESTION 4 Total Marks: 15 Marks |
Click here to access
other questions
SUGGESTED SOLUTIONS |
A Frame
is a derived class of the AWT component Window .Frames inherit
from the Component class,and therefore components can be added using
the add method.
|
|||||||
(a) |
Define a class,called MyFrame
which implements a frame by extending the Frame superclass.Your class
should contain a constructor which creates the frame with a named
title bar.In addition to this,include in your declaration a protected
button b a protected checkbox group cg and a protected checkbox c
.
And the following
marking scheme should be used:
|
[5] | |||||
(b) |
Write a method,called MyButton
,the signature of which is given below,which is a member of your MyFrame
class.The method should take two String parameters x and y
,and allocate the button b ,such that it is added to your frame,and
has title x and the action command y .Your method should also ensure
that the button is set up with the frames action listener component.
And the following
marking scheme should be used:
|
[5] |
|||||
(c) |
Write a method,called MyCheckBox
,the signature of which is given below,which is a member of your MyFrame
class.The method should take a single String parameter x , and add
to your frame f the check box c ,such that it has title x ,initial
value true and is a member of the check box group cg .
And the following
marking scheme should be used: |
[5] |