Here my quesion is i am passing String(rowData) to the method (addMatrixToTable) of SolutionCompatibilityMatrix,it can displaying some object code like abc@54432 but not the actual string value.how to resolve this problem ??? its an urgent!!!
What parameters does the addMatrixToTable method take? You have to pass that type of argument. If it is a String, which appears unlikely, you would have to pass the String in exactly the correct format.
Joined: Jul 07, 2008
hi i am passing String parameters to addMatrixToTable() mehtod but it returns in object format not in exact string format, uhave already told to override toString() of Object class.can you give me the code how to override toString() method belongs to my program.
On a side but related note for you moving forward, a lot of swing components will require the toString() method to be overriden in order for it to display correctly in the widget. This is a real PITA if you are using a domain model that wasn't really written specifically for Swing and your existing toString() methods are already written but not friendly enough for Swing components.
In these cases you can do what I have had to do and write a model wrapper around your object to be used. So for example, Say I have a Person class and its toString() method returns a bunch of junk I don't want displayed. So I'll write class like this...
And then I'll use that object, instead of Person, to place in a JList, for example.
DefaultListCellRenderer seems like overkill unless you need to present the data different that just a simple String, doesn't it? For example, adding an image or changing the foreground/background color of a cell? Of course, in those cases, I would use DefaultListCellRenderer but othewrise a simple wrapper class is, well, simpler.