Re: labeling within the display + getting cursor points.

Hi Tolga,


> Tolga Sakman wrote:
> 
> Hi,
> 
> I am trying to do what is being done in the tutorial, first image in
> \tutorial\s2\Section2.html file. P2_01.java is supposed to duplicate
> this, but it does not. The compiled code does not print labels on the
> display, and there's no code in the java file to track the location of
> the cursor within the data file.

Absolutely! In section 1 it is stated:

"By pressing and dragging with the left mouse button on the display you
can move the graph around. By shift-clicking and moving the mouse up and
down you can zoom in and out.  Pressing
and dragging the middle mouse button (on two-button mouse emulated by
simultaneously clicking both buttons) shows a cross cursor that moves
with the mouse. The values of the
RealTypes at the cursor's position are shown on the upper left corner of
the display."

So, you only get the labels by pressing the corresponding mouse buttons.
Try it with exapmle P2_01.

> I tried to use
> DisplayRenderer.getCursor() method, but all I get is 0.0 for both axes
> (I have a 2D display)
> 
> Can anybody give me a clue as to how to do these 2 tasks? Thanks.


I suppose DisplayRenderer.getCursor() will return a different value
(other than (0,0)) after you've moved the cursor about.

Cheers,

Ugo


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