• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Problem with JTable and AbstractTableModel in UrlyBird

 
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Anne Crace
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
A lot of people cry when they cut onions. The trick is not to form an emotional bond. This tiny ad told me:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic