This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jtable and vectors

 
David Shepherd
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
vColumnNames.add("Style");
Vector vData = new Vector();
Vector vStuff= new Vector();
vStuff.add("vector");
vData.add(vStuff);
System.out.println("the vector value " + vColumnNames.firstElement().toString());
DefaultTableModel x = new DefaultTableModel(vData,vColumnNames);
JTable tblMap = new JTable(x);
 
selvas kumars
Ranch Hand
Posts: 115
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

hi,
try out this...
getContentPane().add(table.getTableHeader(),BorderLayout.NORTH);
getContentPane().add(table);
silva.
 
David Shepherd
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Silva.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic