Shrinking Scroll Pane Bugfix
smee, build 14a
This is a bugfix for build 14 which fixes the problem with the viewport scrollpane shrinking to a pinpoint when the map is larger than can fit in the viewport window. This was occurring only in the 1.5 JDK from my testing, but apparently some others have experienced the same under 1.6! At any rate, it's all better now.
The additional code is inside the MapViewport constructor where the scroll pane is created. I turn the instantiation into a temporary inner class and override getPreferredSize() to return the size of the map at the current zoom if it can fit within the viewport window, and otherwise to return the size of the viewport window.
As I was telling Kildorf, I don't know why the scroll pane shrinks in terror when it grows too large to fit inside the viewport window. It makes more sense that, as I have observed in my tests with 1.6, it should simply grow to fill all available space.
Admittedly, I am no Swing guru, particularly when it comes to GridBagLayout. I leverage this layout for the sole purpose of its default centering behavior of components within each grid cell, both horizontally and vertically, without modifying their preferred sizes... or so I thought!