• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTble not displaying all rows  RSS feed

 
Gary Smith
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JTable inside a JScrollPane.
The content of the JTable is based on a couple of data filters
that can be user selected during runtime. When the subsequent
model of data is pretty large the JTable will not display all of
the data even when you scroll to the bottom of the JScrollPane.
I have set a Preffered Size for the JTable in an attempt to cater for
a large data set, but this will not guarantee that all the rows of data
will be displayed.
Is there anything specific I should look at to solve this problem??
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Homer Simpson" -

Welcome to the JavaRanch! Please adjust your displayed name to meet the
JavaRanch Naming Policy.
You can change it here.

The problem is that you don't need to set preferred size on the JTable itself, but you need some way to tell the JScrollPane what size it should be when it holds the table. You can do this with the setPreferredScrollableViewportSize(Dimension size) method of JTable.

D'oh!



Thanks! and welcome to the JavaRanch!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!