Hello,
I have a Layer that works as expected, except for the part where I
want to display "Hello"
when the mouse is clicked. The mouseClicked method below prints "button"
on the console, but the OMText is not displayed on the map.
I have successfully changed the color of an existing OMGraphic
in another mouse even method, but I can't seem to add an OMGraphic to my
omgraphic list.
Can somebody give a tip on how to make the OMText be displayed?
Code snippet:
public class UnitLocationLayer extends Layer
implements MapMouseListener {
... do stuff
public boolean mouseClicked(MouseEvent e) {
OMGraphic obj = omgraphics.findClosest(e.getX(), e.getY(), 4);
if (obj != null) {
System.out.println("button");
// Display information
OMText textLabel = new OMText(30f, -80f, "Hello", MText.JUSTIFY_CENTER);
textLabel.setVisible(true);
// omgraphics is the global OMGraphicsList
omgraphics.add(textLabel);
repaint();
}
...
}
Thanks.
-Thomas
--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Mar 22 2005 - 14:07:34 EST