This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Problem with JTable and AbstractTableModel in UrlyBird Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Problem with JTable and AbstractTableModel in UrlyBird" Watch "Problem with JTable and AbstractTableModel in UrlyBird" New topic
Author

Problem with JTable and AbstractTableModel in UrlyBird

Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
After spending a couple days trying to populate my TableModel ( I extended AbstractTableModel ), it is populated, but with things like this: [Ljava.lang.String;@159e154 . I am thinking it is an address. I am using class structure similar to Andrews, so I have ArrayList of String[], ArrayList of HotelRooms where HotelRooms is Value Object with setters/getters for all column fields. I am using Eclipse and ran through the debugger. I'm sure the records are all in there, and there are Strings in there for all the fields. The table has 29 different instances of the Ljava.lang.Strings in there so I'm sure I'm real close. I'm also getting A, B, C...etc. (7 of them, correct number) for my column headers. I tried using toString() on my model and a couple other places but couldn't do it. Any help would be greatly appreciated. It's probably something simple, I'm just blind from looking at it for so long


SCJP, SCJD
Anne Crace
Ranch Hand

Joined: Aug 29, 2005
Posts: 223
Fixed it. Pretty stupid, really. The problem with the colums was this: I didn't have this method in my TableModel


The other problem (addresses appearing instead of actual values) was in the return value of this method.


I had "return field" without [column]. Duhh. Just glad I figured it out
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Problem with JTable and AbstractTableModel in UrlyBird
 
Similar Threads
Set data from arraylist into jtable
JSF div tags
how to retreive a value in a Jtable ?
JTable Column Size
NX: Set JTable columns display in different sizes