This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JScrollPane cuts off table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JScrollPane cuts off table" Watch "JScrollPane cuts off table" New topic
Author

JScrollPane cuts off table

mabel foo
Greenhorn

Joined: Oct 07, 2009
Posts: 8
Hi, I have a JTable inside a JScrollPane and the table gets cut off at the bottom.
The JScrollPane is inside JPanel, and JPanel is inside GridBagLayout.

The table is displayed properly if I remove JScrollPane though.



This is the code for adding JPanel into GridBagLayout.


I've tried using setBounds and setPreferredSize on JScrollPane but it doesn't work.

Please help! Thanks!
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

Change to


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2153
    
    7
You need to give a hint to the scrollPane about how big you want the viewport to be:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JScrollPane cuts off table
 
Similar Threads
Partitioning a JTable
about JTable
Problem displaying JTable inside a JScrollPane
JTable
How to flash a row in JTable?