Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.

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: