This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I am trying work a combobox with an array of objects. Im passing the in the combobox constructor but its coming up with what i think is the address of the object within the elements of the array. Is there anyway to get it to printout the local variables within each objects?
here is code:
returnplayers() returns an array of player objects. I just want to displaye their names instead of "Domain.Player@2f729e" which is what i am getting atm in the combobox.
What you are seeing there is the result of calling the toString() method of the Player object. Since you haven't provided an implementation of that method, you get the default implementation provided by the Object class.
So implement a toString() method in your Player class and have it return whatever you want to see in that combo box.
Joined: Aug 19, 2012
That is sick! Cheers man will sort this madness out.