aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JCombo problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JCombo problem" Watch "JCombo problem" New topic
Author

JCombo problem

Steven Broadbent
Ranch Hand

Joined: Dec 10, 2002
Posts: 400
I am creating a JCombo that uses a Vector of class objects - the class is Song - but the combo shows "Song@frr343" etc which I think is the hash value.
How do I get the Combo to display the String member title of the Class Song?

Thanks


"....bigmouth strikes again, and I've got no right to take my place with the human race...."<p>SCJP 1.4
Ken Krebs
Ranch Hand

Joined: Nov 27, 2002
Posts: 451
You need to either override the toString() method in your Song class or just put the String in the combo's vector. What you are seeing is Object's default implementation which gives the class name followed by the memory address.
[ January 24, 2004: Message edited by: Ken Krebs ]

kktec<br />SCJP, SCWCD, SCJD<br />"What we observe is not nature itself, but nature exposed to our method of questioning." - Werner Heisenberg
Steven Broadbent
Ranch Hand

Joined: Dec 10, 2002
Posts: 400
Thanks , just what I needed.
 
jQuery in Action, 2nd edition
 
subject: JCombo problem