This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

JTable missing column names  RSS feed

 
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?
 
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
 
Hang a left on main. Then read this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!