Java Reference
In-Depth Information
public void setEmpCity(String empCity) {
this.empCity = empCity;
}
public String getEmpState() {
return empState;
}
public void setEmpState(String empState) {
this.empState = empState;
}
public String getEmpZip() {
return empZip;
}
public void setEmpZip(String empZip) {
this.empZip = empZip;
}
public Employee(String name, String street, String city,
String state, String zip) {
this.setEmpName(name);
this.setEmpStreet(street);
this.setEmpCity(city);
this.setEmpState(state);
this.setEmpZip(zip);
}
}
In the Package Explorer pane, notice the error icons. If you display the EmployeeApp source and then the error,
it will read, “The constructor Employee(String) is undefined.” The Employee source code has no errors; however, the
changes to Employee are causing an error in EmployeeApp, because we no longer have an Employee constructor that
accepts a single string as a parameter. This is another great feature of RAD—after a class (e.g., Employee) is changed,
RAD verifies that any other classes that use the class (Employee) will still work.
10.
Display the EmployeeApp source code and change the main method's first executable
statement to the following:
Employee emp = new Employee("Mary Worker", "1 Main St.",
"Enid", "OK", "77777");
11.
Save the EmployeeApp source code.
Tutorial: Adding More Labels
EmpFrame needs to be modified so that all the Employee information is displayed. Perform the following steps to the
EmpFrame source code.
1.
After the statement that creates empNameLbl, add two new statements to create labels
called empStreetLbl and empCSZLbl with the text “New label.”
 
Search WWH ::




Custom Search