NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

Re: get mousecoordinates

Hi Erik,

> I have a problem with my VisADApplet. I want to set points in my display
> (displayImplJ2D) with my mouse.
> The first problem: When I use my mouse on the display, the display
> moves. How can I disable this functionality.

See http://www.ssec.wisc.edu/~billh/visad_archive/msg02758.html
for an answer.

> Second problem: How can I get the coordinates of my mouse if mousebutton
> is clicked.

You need to add a DisplayListener to your DisplayImpl, and
look for DisplayEvents with getId() equal to the appropriate 
MOUSE_PRESSED, MOUSE_PRESSED_CENTER, etc. Then call getX()
and getY() to get the mouse coordinates.

Also look into using visad/bom/PointManipulationRendererJ3D.java
which can give you mouse right-button click location in data
coordinates. You can easily construct RealTuple objects from
those coordinates.

Good luck,
Bill


  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: