Resizing JScrollPanes
843805Oct 9 2006 — edited Oct 12 2006Hi,
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.