Wrapped map component and UI for scrolling demo

"Luke Lindsay" <[email protected]> Tue, 18 Dec 2001 05:56:21 -0000
Newsgroups gmane.games.freeciv.java
Message-ID <[email protected]>
I've attached a small demo that I wrote.  It consists of a component that
displays a wrapped map, an overview map, and the UI for moving about.  I
wrote it for my project, jfreerails, but thought it might also be useful for
the freeciv java client.

To see it, unzip and compile, then run:
scrollingdemo.ScrollingDemoJFrame

I did away with the scroll bars since they seem slightly nonsensical on a
wrapped map.  To move about, try clicking and dragging both maps.

I hope it is mainly self explanatory.  A couple of less obvious points in
ScrollingDemoMapView.java are: wrapping can be turned on/off for both axis's
and there is implementation of scrollToVisibleRect() (getScrollTargetRect())
that does the right thing even when the map is wrapped.  Also, the scales of
each of the maps can set when they are constructed.

I hope it is useful, if anything isn't clear let me know.

Luke
scrollingdemo.zip (application/x-zip-compressed, 7.9 KB) - not displayed