File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Jtable and vectors Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Jtable and vectors" Watch "Jtable and vectors" New topic

Jtable and vectors

David Shepherd
Ranch Hand

Joined: Mar 02, 2001
Posts: 35
I am trying to use a JTable with the default table model. I am passing in a vector of vectors and a vector of Strings (for the labels). I can't get the labels to show up put I do see a little tiny box where the column headings should go (I assume). I am adding table to a scrollPane and then to a panel. I can see the data values but can't get the column names to appear
Vector vColumnNames = new Vector();
Vector vData = new Vector();
Vector vStuff= new Vector();
System.out.println("the vector value " + vColumnNames.firstElement().toString());
DefaultTableModel x = new DefaultTableModel(vData,vColumnNames);
JTable tblMap = new JTable(x);
selvas kumars
Ranch Hand

Joined: Jan 06, 2001
Posts: 115

try out this...
David Shepherd
Ranch Hand

Joined: Mar 02, 2001
Posts: 35
Thank you Silva.
I agree. Here's the link:
subject: Jtable and vectors
It's not a secret anymore!