mapimage.java public method addition?

Joan Friedman webworks at world.std.com
Wed Jan 24 07:43:12 PST 2001


> A feature that I would like to add (or see added) is an X Y report of
where
the user's mouse is over the mapplet.
 <....>
> I've tried this but can't seem to find out the how to get the XY out of
the
> applet.
>Tom

I'm not familar with the maplet, but I can tell you a bit about java. You
could extend MouseMotionAdapter to capture the mouse position. The general
idea would be like this:

public class PointLabeler extends MouseMotionAdapter {
    public void mouseMoved (MouseEvent  e) {
       // get the position in pixels relative to java's default origin at
the top left corner of the innermost component containing the mouse position
       int x = e.getX();
       int y = e.getY();
       // translate position from java coordinates to map coordinates

      // display label
   }
}

Let me know if you need more help.

Joan






More information about the MapServer-users mailing list