Complete.Org: Mailing Lists: Archives: freeciv-java: December 2001:
[FreeCiv-Java] Wrapped map component and UI for scrolling demo
Home

[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]
To: <freeciv-java@xxxxxxxxxxx>
Subject: [FreeCiv-Java] Wrapped map component and UI for scrolling demo
From: "Luke Lindsay" <LUKE@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 18 Dec 2001 05:56:21 -0000

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


Attachment: scrollingdemo.zip
Description: Zip compressed data


[Prev in Thread] Current Thread [Next in Thread]