This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Auto resize column of jtable

 
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.
 
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
 
    Bookmark Topic Watch Topic
  • New Topic