Best Algorithm for Preferred Size of Dynamically Growing jTable

  • Thread starter Haircuts Are Important
  • Start date
H

Haircuts Are Important

I once had to build a large jTable and I noticed that after the table
became large things weren't shown in the table.

I forgot how I fixed it.

Question: Is there some preferred way to adjust the size of a
dynamically growing jTable.

I'm using new Courier Font because I want the characters to be the
same width.

Thanks,
 
E

Eric Sosman

I once had to build a large jTable and I noticed that after the table
became large things weren't shown in the table.

I forgot how I fixed it.

Question: Is there some preferred way to adjust the size of a
dynamically growing jTable.

A common practice is to put the JTable in a JScrollPane and
let the user decide how much screen real estate it should have.
In addition, you might try setPreferredScrollableViewportSize(),
although I don't know off-hand whether this does anything for a
JTable that's already displayed (if it doesn't, I imagine a call
to revalidate() might help).
I'm using new Courier Font because I want the characters to be the
same width.

Although this may affect the actual sizes, I doubt it makes
a difference in how readjustment happens.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top