• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

jtable

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i hava a frame with a refresh button. refresh simply resubmits the current query and updates the table with new info if it is available. well..., my refresh button works, except when i refresh, my columns got to a smaller widht that may be one character long. and if i submit a query the data on the table doesn't change. it leaves all of the data, but because my first query was the default that gets eveything, it only makes those in the new query available to view it's info on the textarea on the other side of my split pane. any suggestions how i can get this info to look and work correctly.
 
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know how you can fix the column problem. Basically, the first time you update the table the column widths are adjusted correctly, but any subsequent update to the table resizes the columns to the uncorrect width, right?
So, here's what you do:
after you update your table model with new data, immediately do the following...
for( int i = 0; i < table.getColumnCount(); i++)
table.sizeColumnsToFit( i);

You may have to initialize your table with a call to the following...
table.setAutoResizeMode( JTable.AUTO_RESIZE_ALL_COLUMNS);
Let me know if that works, email me, I dont check this board much anymore
SAF
 
It was the best of times. It was the worst of times. It was a tiny ad.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic