Java Reference
In-Depth Information
This means that the Shipment Options frame will be displayed when that option is selected from the Application
Options frame
10.
In Shipment, create a new null Constructor.
11.
In Shipment, create a Constructor that receives a
String
variable called sNum by adding
the following code:
public
Shipment(String sNum) {
}
12.
Save the Shipment source code.
13.
In EnterShipInfo, add a constructor that expects a Shipment variable called ship and a
String
variable called func. In addition, invoke the null constructor.
The code should look like the following:
public
EnterShipInfo(Shipment ship, String func) {
this
();
}
By accepting a Shipment object, EnterShipInfo will be easier for other classes to use.
14.
In EnterShipNum, add the ActionListener to the Submit button and add the following
statement to create a class
private String
variable called function.
private
String function;
Since we will change EnterShipNum to perform deletes and updates, the user selected function needs to be
passed to EnterShipNum and stored in this class level variable.
Change EnterShipNum's constructor so that a
String
variable called func is received and
the class variable function is set to func.
15.
The source code should look like the following:
public
EnterShipNum(String func) {
super
();
initialize();
function = func;
}
16.
Change EnterShipNum's actionPerformed such that:
A
String
variable called sNum is created
a.
b.
The shipment number is retrieved from the text field and assigned to sNum
c.
A shipment object is created for the shipment number and assigned to a variable called
shipment