Java Reference
In-Depth Information
In actionPerformed, change if (emp.getPayRate() != -1) { to the following:
10.
if (inputError == false) {
Add the following else block to the above if :
11.
else {
inputError = false ; }
This statement resets inputError back to false because setEmployeeProperties removed the invalid value from the
text field.
12.
Save EnterEmpInfo and run as an application.
13.
Enter 39 as the pay rate value and click the Gross button.
The EnterEmpInfo frame should look like Figure 7-4 . Obviously, the message is too large to fit in the label.
We need to go back and fix that.
Figure 7-4.
14.
In Employee's setPayRate method, change the message to the following:
throw new InvalidValue("Please re-enter a pay rate " +
"between 6.50 and 35.");
15.
Save EnterEmpInfo, run as an application and verify that the message is correct.
Search WWH ::




Custom Search