Skip to main content
GameDev.net gamedev.net
🔒 Locked

[java] JscrollBars do not update unless resize occurs

Started by Halsafar Dec 22, 2005 at 1:34 PM 2 replies 500+ views
Original Post
Halsafar
Halsafar
Okay, in my app when the user chooses to size the grid (changing the preferred size of a JPanel which has scroll bars), the scroll bars for the grid do not change. They will only change when the window itself is resized, then the scroll bars update to there proper orientation representing the entire grid. To sum, the grid is set so big it should still have scroll bars but no scroller appears in the bar until the window is resized. Then the scroll bars become active with scrollers. Repainting the frame does nothing. Validating the frame does nothing. Any advice?
Vyper_uk
Vyper_uk
I have some code that does something similar and quickly looking through it seems that I had to revalidate() the content of the JScrollPane, in my case a JPanel the same as yours, and then repaint() the frame after that. If that doesn't work try revalidating/repainting the scroll bars or anything else till it does. I remember having a headache over this for a while :P
Halsafar
Halsafar
Nothing...
I've tried invalidating, repainting, validating, repainting... I have also tried that on both the scrollPane parent and the child drawPane it moniters...

The scrollPanes do not adjust until the JFrame is resized...

This is very frusterating...
Halsafar
Halsafar
Mission accomplished.

This is required as soon:

m_drawPane.invalidate();
m_scrollPane.invalidate();

m_drawPane.validate();
m_scrollPane.validate();


m_scrollPane is the JScrollPane which parents m_drawPane.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.