> In a simple 2D plotter built with visad, I'd like to detect which
> line (or lines) the mouse is over. I have registered a DisplayListener
> on the Display, but I am uncertain how to do two things:
> - detect mouse motion events (now I just get MOUSE_PRESSED and RELEASEd)
> - figure out which line the mouse is over
> - display a small tooltip-like tranisent window on top of the display,
> announcing the name of the line.
> Tips on any of these points will be most welcome!
You need to extend visad.MouseHelper to process mouse move
events in a similar way that it processes mouse right
button click events, then extend your MouseBehaviorJ*D
(either J2D or J3D) to use your extension of MouseHelper.
for a basic explanation of at least how to extend. Note
the findRay() method of MouseBehaviorJ*D will compute
a Ray in 3-D coordinates from a mouse screen location,
then you need to invert ScalarMap scalings and any
CoordinateSstems, as in visad.DataRenderer.drag_direct().
Its all a bit complex, I'm afraid.
If your users were willing to click right mouse buttons
on Data depictions, you could just use
visad.bom.PickManipulationRendererJ3D (asssuming you
are doing 2-D in a DisplayImplJ3D).