Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Resizing JScrollPanes

843805Oct 9 2006 — edited Oct 12 2006
Hi,

I have a JFrame with three JPanels running horizontally. The first two are
in JScrollPanes.

The JScollPanes are resizable when the program is running. I am using a
gridbaglayout so I use the JScrollPanes' setPreferredSize function to set
the sizes, and the frame's validate function to update the display.

My problem is that the JScrollPane resizing works most of the time,
but not all the time. However, after a resize when the display isn't
updated correctly, if I then change the size of my main frame slightly
with my mouse, the display is updated and my scroll panes are then shown
resized correctly.

Does the approach I am taking to resize my JScrollPanes sound sensible?

I have tried putting the call to validate in a SwingUtilities invokeLater
run function, along with a call to repaint, just to see if that made any
difference, but it doesn't. The problem persists.

Any help appreciated.

Regards,

Paul.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 9 2006
Added on Oct 9 2006
6 comments
70 views