Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help on JTable and TableModel

 
HanMing Low
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'd like some advice on my following problem.
I've created my Client GUI based on a JTable connected to a TableModel.
The dataset of the TableModel is actually a Vector populate by my Controller.
It works fine if the initial set up to the Data Source is fine.
However, if the initial setup of my Data Source fails. e.g. the remote server fails.
The JTable will connects to a TableModel with 0 columns and 0 rows. (which is expected)
However, when it subsequently connected to the data source successfully, the JTable does not show the data when I did a fireTableDataChanged on the TableModel.
I'm not sure if my debugging prove the source of the problem.
As the initial setup fails, there is 0 columns, thus, even after the data is populated, the column structure register by the JTable when it is created is still 0, thus, it refuses to refresh the data.
Is this correct?
I'd apprecitate any advice to solve the problem.
Thanks a lot!!!

Han Ming
 
HanMing Low
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Me again.
Sorry, I think the TableModel did get the data refreshed, as I trace that the TableModel did call and get the columnName and columnCount correctly.
It seem that initially when I
new JTable(TableModel);
where this TableModel is 0 column and 0 rows
later, when the TableModel is updated, the JTable is not update even if the TableModel fireTableDataChanged is called.
Thanks in advance for any advice.
Cheers.

Han Ming
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic