aspose file tools
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 Groovy Fundamentals video training course this week in the Groovy forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JScrollPane cuts off table" Watch "JScrollPane cuts off table" New topic

JScrollPane cuts off table

mabel foo

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: 10724

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: 2334
You need to give a hint to the scrollPane about how big you want the viewport to be:

I agree. Here's the link:
subject: JScrollPane cuts off table