• Post Reply Bookmark Topic Watch Topic
  • New Topic

Blank cells in JTable

 
Mayur Gosalia
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to retrieve values from database using getValueAt(int row, int column), but i have cells in the table which are blank(null), hence it is throwing nullpointerexception, when i convert the object to string. Is there a good way of populating the blank cells for the selected row without having to type If statement and checking if the cell is blank? I have 8 column or more, so having a series of if and else if 8 times seems tideous. Could you guys help?

Thanks
 
Paul Clapham
Sheriff
Posts: 21892
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it were me I would just set up the empty cells (have them contain empty strings instead of nulls) at the same time as I set up the non-empty cells. But if that isn't a possibility, then I don't see why you couldn't just use loops to set the null cells to empty strings.
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops.

-- deleted --
 
Mayur Gosalia
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok i will try. thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!