This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JCombo problem

 
Steven Broadbent
Ranch Hand
Posts: 400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ken Krebs
Ranch Hand
Posts: 451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Steven Broadbent
Ranch Hand
Posts: 400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks , just what I needed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic