• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting the column headers and refill the data later by DbUtils

 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


This was done in the constructor, later when a button is pressed, I do,
jTable2.setModel(DbUtils.resultSetToTableModel(db.getSalesByCustomerID(id)));

I made sure that the two models column names matched.
But initially no headers were shown
Thanks
Jack

 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And the problem you are facing is....?
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:And the problem you are facing is....?


Ha ha forgot, my problem is how can I make the table headers appear initially?
Thanks in advance
Jack
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What is DbUtils and what does resultSetToTableModel return?
In other words, TellTheDetails and post your SSCCE
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:
What is DbUtils and what does resultSetToTableModel return?
In other words, TellTheDetails and post your SSCCE


Hi
Hello, resultSetToTableModel maps a simple ResultSet to a JTable. Column by Column.
http://technojeeves.com/joomla/index.php/free/59-resultset-to-tablemodel
 
m Korbel
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you would need to play with




ResutlSetTableModel == http://stackoverflow.com/q/17846079/714968 (somewhere on net are various type of, search for ... which suits your needs)
 
Rob Camick
Ranch Hand
Posts: 2699
10
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
resultSetToTableModel maps a simple ResultSet to a JTable. Column by Column.


Then you should see a table header if that class works properly. We can't help you debug 3rd party classes if they don't do their job properly.

Invoking the setModel(...) method is all you need to do to refresh data in the table. Of course this method will replace your initial DefaultTableModel including the column names and not just the data.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!