Java Reference
In-Depth Information
5.
List the following steps in order to create a frame such that an error message will not be
generated:
A.
Add the Frames' components
B.
Create a Frame object and assign it to a variable
C.
Define the location
D.
Define the size
E.
Define the title
F.
Import the java.awt.Frame class
G.
Make the Frame visible
H.
Set layout property to null
6.
What are AWT and Swing?
7.
What are setters and getters?
8.
Explain inheritance and why it is a benefit.
9.
Would a frame and a label most likely be related through specialization or composition?
Review Exercise
In this exercise, you will modify the Shipment application to display the shipment information in a frame. Like
the Employee application, you will create a new frame and have ShipmentApp pass a Shipment object with all the
pertinent information.
1.
In the ReviewEx project, create a new package called c3.
2.
Select the ShipmentApp and Shipment classes in ReviewEx.c2, then copy and paste them
into c3.
In c3/Shipment:
Change the five String variables to private.
3.
4.
Delete the display method.
5.
Save the code and verify that there are no errors.
6.
Using RAD, generate setters and getters for the five private variables.
7.
Change the Shipment constructor so that the five setters are used to set the values of the
five private variables to the parameter values.
8.
Save the Shipment source and verify that there are no errors on the Shipment class.
9.
Create a new class in c3 called ShipFrame, identify its superclass as java.awt.Frame, and do
not have RAD generate any stubs.
 
Search WWH ::




Custom Search