• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Auto resize column of jtable

 
Devu Shah
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello everybody there,
I have almost completed my assignment but i have a problem regarding the jtable columns width.
In my design i use Abstracttablemodel for my jtable.I am using "Auto_resize_all_columns" property so as to fit all the cols in the table.
I have a method called "displayInformation()" in the model which has an vector which holds the value retrive from the database.I have used the "fireTableChanged(null)" method to refresh the data on data change.
Now the problem is that whenever an actionevent occurs like "button action" or "list selection event", my columns take
fix width and are out of the jtable viewable region. since i am using "autoresizing" the horizontal bar of the scrollbar never appears and hence i cant see my two cols.
now if i remove my "firexxx" method the table follows the autoresize policy but my table doesnt gets refresh.
Could any one help me on how to both refresh my table as wll as follow the autoresize mode.
thanks
devu.
 
SMK Reddy
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Devu
have you considered using the AbstractTableModel fireTableDataChanged trigger to notifies all listeners that, all cell values in the table's rows may have changed. instad of using
fireTableChanged event.
Regards
SMK Reddy
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic