[FreeCiv-Java] Wrapped map component and UI for scrolling demo
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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
Description: Zip compressed data
- [FreeCiv-Java] Wrapped map component and UI for scrolling demo,
Luke Lindsay <=
|
|