Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Re: Display question.

Hi Eric,

> I have a simple function (x,y)->z that I display with a DisplayImplJ2D and
> I would like to
> show the z value when the user press the right mouse button.
> How can I do that ?

You need to construct a DisplayListener and add it to your
DisplayImplJ2D.  In its displayChanged(DisplayEvent e)
method, if e.getId() == DisplayEvent.MOUSE_PRESSED_RIGHT,
then apply the code in the second part of the answer at:

  http://www.unidata.ucar.edu/staff/russ/visad/msg00862.html

Note also that the visad/rabin/Rain.java program accomplishes
this in a different way, by constructing a RealTuple object
and using it as a custom cursor via a DirectManipulationRenderer.
It even uses a ScalarMap to Display.Shape to make a cross-hair
cursor.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html


 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690