• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable missing column names

 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using AbstractTableModel to populate a simple JTable. I am really appreciating the separation of model and view that this affords. The example from Sun works great and shows the column names.
I followed that code very closely to build my own and it works except that the column names don't show up. One difference is that I am using a form built with the IntelliJ IDEA GUI builder (which is awesome, by the way)
I implement the AbstractTableModel method getColumnName(int col) and a call to System.out.println() shows that the method is indeed called, but the row for column names won't show up.
Any hints?
 
maggie woo
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, not sure how you've got it implemented. the TableDemo.java has the table in a JScrollPane, which automatically shows the columns. If you don't put it in a JScrollPane, you have to do something to make the columns show up... I don't know how to do this myself because I always take the expedient of putting my JTable in a JScrollPane....
Regards,
Maggie
 
Tim McGuire
Ranch Hand
Posts: 820
IntelliJ IDE Tomcat Server VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes!
That worked. Thanks Maggie
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!