• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable problem: not visible

 
f. nikita thomas
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i can't seem to get this example working. the code is as follows:

the problem is that the JTable area of the Image greys, but no data. i'm probably just real tired... any help will be greatly appreciated. thanks.

n
[ December 09, 2008: Message edited by: f. nikita thomas ]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
comment out the try/catch for this
dbTableModel dbtm = new dbTableModel(....
and change this
JTable b = new JTable(dbtm);
to
JTable b = new JTable(5,3);

recompile, rerun - is the table OK now?
 
f. nikita thomas
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay. yours worked. now why? i 'think' that i wrote the TableModel() correctly. i'll run some tests and get back to you.
 
f. nikita thomas
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
added some System.out()'s for debugging; when i do:

System.out.println(dbtm.getColumnName(0));

i get the appropriate column from the result set. has anyone seen this before? i'm stumped over this one.

n
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there's something in dbTableModel that is affecting the painting.
try hard-coding some date in dbTableModel and see if that's OK.

work backwards until you find the culprit.

it could be a simple threading issue - you don't start the app in the EDT,
try starting the app this way

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!