Java Reference
In-Depth Information
The executable code should look like the following:
package
c3;
import
java.awt.Frame;
import
java.awt.Label;
public class
EmpFrame
extends
Frame {
Label empNameLbl =
new
Label("My First Label");
Label empStreetLbl =
new
Label("New label");
Label empCSZLbl =
new
Label("New label");
public
EmpFrame(Employee emp) {
empNameLbl.setBounds(100, 150, 150, 20);
empStreetLbl.setBounds(100, 190, 150, 20);
empCSZLbl.setBounds(100, 230, 150, 20);
empNameLbl.setText(emp.getEmpName());
empStreetLbl.setText(emp.getEmpStreet());
empCSZLbl.setText(emp.getEmpCity() + ", " + emp.getEmpState() + " " + emp.
getEmpZip());
this
.add(empNameLbl);
this
.add(empStreetLbl);
this
.add(empCSZLbl);
this
.setTitle("Employee Information");
this
.setLayout(
null
);
this
.setBounds(10, 10, 300, 300);
this
.setVisible(
true
);
}
}
9.
Save the code and run EmployeeApp.
The frame should look like Figure
3-25
.
Figure 3-25.