my dog learned polymorphism
The moose likes Beginning Java and the fly likes JTable not showing data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "JTable not showing data" Watch "JTable not showing data" New topic

JTable not showing data

Krit Christoforou
Ranch Hand

Joined: Mar 01, 2005
Posts: 46
Hello all,
I'm trying to create a Jtable and make it load the contents of a vector after i press a button.
The problem is that the table wont display what it should, instead it remains empty.
I know that my vector is loaded because i print out its contents in the command line.

Here is some code, i hope that helps.

David Harkness
Ranch Hand

Joined: Aug 07, 2003
Posts: 1646
From the JavaDocs for the JTable(Vector rowData, Vector columnNames) constructor:
Constructs a JTable to display the values in the Vector of Vectors, rowData, with column names, columnNames.
Does your data Vector (newVect) hold Vectors of Strings, or just Strings directly?
Krit Christoforou
Ranch Hand

Joined: Mar 01, 2005
Posts: 46
Hello again david
always helpful hehe

The vector holds vectors of strings.
i changed some things in the code and got it to work. I cant get it to work with a scrollpane tho.
Here is my code:

The strange thing is that if i uncomment the scrollpane lines, the table remains empty, i cant get it to load the vector.
I agree. Here's the link:
subject: JTable not showing data
It's not a secret anymore!