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

JTable won't revalidate,refresh,etc...  RSS feed

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys : I know that JTable overrides revalidate and refresh... But is there a way to absolutely, positively, force an ENTIRE revalidation/repaint of a table ? Ive tried calling the tableModel.fire* methods and thats not working for me.
Please help Im desperate...
[ April 09, 2008: Message edited by: Bear Bibeault ]
 
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
Originally posted by jay vas:
H..., force an ENTIRE revalidation/repaint of a table ?


I wonder why you want to do that. The paint is optimized to repaint only the specific region that needs to be updated. For e.g. you got a JTable displaying some data. Say something changes some values in the 3rd row (which is visible). The paint method will only update that region.

Perhaps you can post your "update" code so we can figure out why your fireTable... is not working.
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't manually update... I'm just changing the contents of the model ...
Shouldnt this be automatically handled ?
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am, however, calling this code to fire a refresh...

 
Brian Cole
Author
Ranch Hand
Posts: 935
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by jay vas:
I am, however, calling this code to fire a refresh...



Is there a reason you want to create the TableModelEvent yourself
instead of using one of the other fireTableXxxx methods?

What happens if you try

((AbstractTableModel)this.getModel()).fireTableDataChanged() ?
 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That doesnt compile on my machine ? evidently fireTableChanged requires
some Arguements...
 
Bj�rn Kaidel
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, fireTableDataChanged() doesn't require any argument at all. And it should do exactly what you want to do.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!