Hi all,
i need some help with code snippets that supports how to pass on a string
from the domain to be be shown on the screen when a mouse is pressed, let's
say for instancec, when a mouse is click show the name of this object on the
screen.it gat to do with the display renderer but i am not sure how to do
that since i haven't done that before.i got the code below from Bill
decribing it but i need a little detail to it.
thanks,
Isaac
public void setCursorStringVector()
(which is in visad/DisplayRenderer.java) 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.
/** Listens for left mouse clicks in the display. */
public void displayChanged(DisplayEvent e) {
int id = e.getId();
int x = e.getX();
int y = e.getY();
if (id == DisplayEvent.MOUSE_RELEASED_LEFT) {
// get domain coordinates of mouse click
double[] coords = cursorToDomain(pixelToCursor(x, y));
// deal with coordinates accordingly
}
}