Yes, that's what objects are for and you can place any object type you want into a combo box. The toString() value of the object will be displayed as the text if the object is not itself a String. So consider how a small class like this could be used
class DormPlan {
private String name;
private int cost;
public DormPlan(String name, int cost) {
this.name = name;
this.cost = cost;
}
@Override
public String toString() {
return name + ": $" + cost + "/semester";
}
public int getCost(){
return cost;
}
}
(Edit: Example class intentionally left a little bit incomplete.)
Last edited by Ezzaral; Nov 10th, 2008 at 4:48 pm.
Moderator
Featured Poster
Reputation Points: 3239
Solved Threads: 839
Posting Genius
Offline 6,761 posts
since May 2007