By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,538 Members | 1,130 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,538 IT Pros & Developers. It's quick & easy.

Passing a container Class into a frame?

P: n/a
Hope someone can help, for an assignment i was given a starter application
package, with that starter package i had to create some employee classes and
test harnesses. below iv pasted my Container class, which holds a company
eomployee class , the Company class and the Data holding class. I am
somehow trying to pass the container class into the preset frame as seen in
the attached file (Jdeveloper package file)
hope someone can give some ideas, or examples i can work with.
thanks in advance.

Company Class:

public class Company extends Employee {

private String jobTitle;
private String startDate;
private String leavingDate;
private double salary;

public Company(String aName, String aAddress, String aEmail,
String aTelephone, String aTelExt, String aJobTitle ,String
aStartDate, String aLeavingDate
, double aSalary){

super();
this.name = aName;
this.address = aAddress;
this.email = aEmail;
this.telephone = aTelephone;
this.telExt = aTelExt;
this.jobTitle = aJobTitle;
this.startDate = aStartDate;
this.leavingDate = aLeavingDate;
this.salary = aSalary;
}

public String toString(){
return ("Name : "+ name + " -\n Address: " + address
+ "-\n Email: " + email + "-\n Telephone: "
+ telephone + "-\n ID:" + idNo + "-\n Jobtitle: "
+ jobTitle + "-\n StartDate: " + startDate + "-\n Leaving Date: "
+ leavingDate + "-\n Salary: " + salary);
}
}

Container Class:

public class CompanyContainerClass extends Object {

private static Vector company = new Vector();

public int getItemCount(){
return company.size();
}

public Company getString(int index){
return (Company)company.elementAt(index);
}

public void addString(Company newString){
company.add(newString);
}

public void addElement(Company newString){
company.addElement(newString);
}
}

Data Holding Class/ pass to container :

public class CompanyDataClass extends Object {
public static CompanyContainerClass c = new CompanyContainerClass();
public static void buildCompanyObjects() {

Company company1 = new Company(

"Shaun Marshall"
,"East Kilbride"
,"sh************@blueyonder.co.uk"
,"265461"
,"229"
,"Chef De Parte"
,"06/10/02"
," "
,13500d);

Company company2 = new Company(
"Donald Duck"
,"33Boat Pond"
,"do****@duckland.com"
,"236699"
,"221"
,"Security"
,"11/04/00"
,"23/02/03"
,8500d);

Company company3 = new Company(
"George Bush"
,"The White House"
,"ge***@thewhiteouse.com"
,"02699 555"
,"666"
,"Diplamatic Ambasidor"
,"01/01/99"
," "
,21000d );

Company company4 = new Company(
"Lorna Marshall"
,"Appleby Close"
,"lo************@ntl.com"
,"265461"
,"369"
,"Facilities Manager"
,"01/03/01"
," "
,23000d);

c.addString(company1); // Company objects are referenced by the
c.addString(company2); // CompanyContainerClass
c.addString(company3);
c.addString(company4);

for (int i = 0 ; i < c.getItemCount(); i ++) {
System.out.println(c.getString(i));
}// prints all items in the Container

Jul 17 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.