Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Displaying column headings in JTable  RSS feed

 
Amy Phillips
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a JTable created using the DefaultTableModel but I am unable to get it to show the column headings. I have read that if you don't supply headings the table gets the defauls of A, B etc but on mine there is just nothing. I am creating a table with no rows (they get added at runtime) and it is part of a splitpane.
I am trying to create the column headings with the code below:

I then create my table..

Can anyone see why the column names aren't being displayed? Thanks
Amy
 
Fuqiang Zhao
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should add your JTable to JScrollPane.
 
Amy Phillips
Ranch Hand
Posts: 280
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much that worked perfectly
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!