Hi:
I would like to find out the panel of a xyplot matrix where a mouse clicked.
I know this functionality is already bundled in trellis.focus but I can't
use it because I am coding a stand alone application in Java using with
GDCanvas as a graphics device.
I tried calling trellis.focus from Java with:
re.eval("t = trellis.focus()"));
However it did not work for an embedded GDCanvas. The above call to the
trellis.focus() returns null no matter where I click.
(Side note: the functionality must be implemented in the GDCanvas because
trellis.focus does work correctly in JGR)
I wish to handle all the user GUI events in Java to evaluate different
commands in an Rengine.
With a GDCanvas, it's straightforward to get the x y position of a mouse
click with the standard e.getX() and e.getY()
So my handler would look like:
public void mouseClicked(MouseEvent e) {
System.out.println("Clicked" + e.getX() + " " + e.getY());
System.out.println(re.eval("t = trellis.focus()"));
System.out.println(re.eval("t"));
// I would update the panel here ...
}
I am only using Java because:
- I am proficient in Java GUI programmer
- It is multiplatform
Another way of posing the question is:
Given the coordinates from grid.location how can I find out the plane of an
xyplot matrix where the user clicked.
I have tried to figure out how to do it from code using trellis.clickFocus,
but I have have only been playing with R for a week, so I am quite lost
reading R code.
I tried to look up to in the code of JGR and came out emplty handed.
This is my first post so I hope I did not break any rules ...
Thanks !
Daniel
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel