Re: labeling within the display + getting cursor points.

Hi Tolga,

> Yes, I have missed that paragraph at the end of section 1. The fact that I 
> have a 2-button mouse and I hardly ever press 2 buttons at
> the same time prevented me from discovering this feature accidentally. Is 
> there a way to turn this display to ON at all times? And how
> can I change the coordinates of those text labels?

Have a look at the following message from Unidata's VisAD-List archive:

Bill's answer is at

from which I got this excerpt:

> In order to print different Strings in the upper left corner,
> in your extension of, override
> the implemention of:
>   public void setCursorStringVector()
> (which is in visad/ to create a Vector
> of Strings you do want, and then call:
>   public void setCursorStringVector(Vector vect)
> to actually set the Strings on the screen.

> About getCursor(), here's what I use:
>         display.addDisplayListener(new DisplayListener() {
>             public void displayChanged(DisplayEvent e) {
>                 if(e.getId() == DisplayEvent.MOUSE_PRESSED_LEFT) {
>                     double[] coords = displayRenderer.getCursor();
>                     System.out.println("x : " + coords[0] + "  y : " + 
> coords[1]);
>                 }                
>             }
>         });
> with no luck. Even when you drag it around, it's still 0.0, 0.0 . I went over 
> the VisAD source to see how the labels are printed, but
> could not find it. Can you tell me which class handles it?

_From Bill's answers, I'd say it's


according to your favourite display.

By the way, the list archive is available under

and includes a search engine. It's worth having a look there before
posting your question to the list, although the logic dictates the
opposite: Questions posted to the list are often answered faster than I
can find the answer in the archives ;-)

> Thanks a bunch,

Your're welcome.


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