• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

JTable not showing data

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
Thanks

 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Not so fast naughty spawn! I want you to know about
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic