From: Robert Najlis <rnajlis_at_cs.indiana.edu>
Date: September 10, 2004 5:43:56 PM EDT
To: Don Dietrick <dietrick_at_bbn.com>, <openmap-users_at_bbn.com>
<openmap-users_at_bbn.com> <openmap-users_at_bbn.com>
Subject: layer not responding to mouse input
Hi,
I am having troubles getting a layer to respond to mouse inputs.
I have subclassed OMGraphicHandleraLayer and implemented
MapMouseListener (I even tried implementing ActionListener which had
worked for me in the past).
I don't get a response at all. I have tried many variations (at first
I had not set the consumeEvents, , setMouseModeIDsforEvents and
setMouseEventInterpreter functions, but even when I did, no change). I
also tried removing all other layers and also moving my layer to the
top, both through the gui.
Code details are provided below.
thanks a lot for your help.
-- Robert
here is how I am creating the layer and adding it to Openmap:
RepastOMLayer layer = new RepastOMLayer();
layer.setMouseEventInterpreter(new
StandardMapMouseInterpreter());
String[] mmi = new String[1];
mmi[0] = "Gestures";
layer.setMouseModeIDsForEvents(mmi);
layer.setName(title);
layer.setList(omList);
layer.setVisible(true);
layer.setConsumeEvents(true);
layer.doPrepare();
layerHandler.addLayer(layer, 0);
layerHandler.setLayers();
mapHandler.add(layer);
// layer.setVisible(true);
here is the basic code for the layer:
public class RepastOMLayer extends OMGraphicHandlerLayer implements
MapMouseListener {
public boolean mouseClicked(MouseEvent e) {
System.out.println("cliked - " );//
}
}
I don't get any response whatsoever, except for, on occasion - if I
keep clicking for a while, the following error:
java.lang.ClassCastException
at
sun.awt.datatransfer.DataTransferer.translateTransferable(DataTransferer
.java:1189)
at
apple.awt.CDataTransferer.translateTransferable(CDataTransferer.java:
125)
at sun.awt.datatransfer.DataTransferer$5.run(DataTransferer.java:2018)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:479)
at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThrea
d.java:234)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.
java:184)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:178)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:170)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
--
[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 Fri Sep 10 2004 - 17:57:38 EDT