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


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