This is probably a really simple thing, but I don't know how to implement the following.
package mods.client.resultSelector;
import com.google.gwt.event.dom.client.MouseDownEvent;
import com.google.gwt.event.dom.client.MouseDownHandler;
import com.google.gwt.user.client.ui.AbsolutePanel;
import com.google.gwt.user.client.ui.Composite;
public class MousyAbsolutePanel extends Composite implements MouseDownHandler {
AbsolutePanel abs = new AbsolutePanel();
public MousyAbsolutePanel(int width){
System.out.println("MousyAbsolutePanel being created with width:" + width);
initWidget(abs);
abs.setWidth(String.valueOf(width));
abs.setHeight("100%");
abs.setStyleName("mousyAbsolutePanel");
}
public void onMouseDown(MouseDownEvent event) {
System.out.println("onMouseDown()");
}
}
I want to have what is effectively a absolutePanel that can accept mouse events. However, within the Composite object I don't know how to tie the the handler I have written (the onMouseDown() thing) with the abs variable. To put it succinctly, I want the abs AbsolutePanel to respond when it is clicked upon, but AbsolutePanels do not naturally accept click events. How do I go about doing this?
Apologies in advance if this is stupid simple, but I just don't quite know how to implement this behavior, and I have not seen it mentioned in the searches I have done.