I'm trying to make a GUI that includes several split panes, and am finding that the movement of the divider seems to depend on how fast you resize the window.
In a configuration with a left-right JSplitPane with a panel weighting of 0.5, i.e the divider is supposed to stay in the middle: if you grab the right or left side of the frame and drag it slowly, only that half of the splitpane changes size. If you drag it faster, the divider moves (although not as much as it should to keep the divider centred).
I'm running on Windows 7 x64 - does anyone else get this problem?
As a guess, what might be happening is that if you only move 1 pixel before a repaint, it can't resize both sides by half a pixel, so it just resizes one half. Then you move another pixel and it resizes the same half again.
I get the same behaviour on JDK6 on XP. I would say your guess as to the cause is reasonable. I don't see any solution since the code can't just divide the space evenly because the user may manually have moved the divide.
Happens with the splits in the NetBeans IDE GUI as well. If you have the Projects window above the Navigator window and resize the screen vertically a bit, then back to the original size, the location of the split will be different.
If the bug is due to my guess, the solution would be easy: either have a variable that remembers which half the half pixel was awarded to last time, or (equivalently) store the divider position as a float. If a user changes the position, it will only be by whole pixels.
subject: Weird JSplitPane behaviour on frame resize (bug?)