GWT 应用程序中表格单元格中的控件单击的事件类型是什么?当用户执行此操作时,我想基本上改变背景的颜色。
我的这部分代码基本上看起来像:
public void onBrowserEvent(Event event) {
Element td = getEventTargetCell(event);
if (td == null) return;
Element tr = DOM.getParent(td);
System.out.println("Event " + Event.getCurrentEvent());
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEDOWN: {
//DOM.setStyleAttribute(td, "backgroundColor", "#ffce00");
onRowClick(tr);
break;
}
case Event.ONMOUSEUP: {
//DOM.setStyleAttribute(td, "backgroundColor", "#ffffff");
break;
}
case Event.ONMOUSEOVER: {
//DOM.setStyleAttribute(td, "backgroundColor", "#ffce00");
onRowRollover(tr);
break;
}
case Event.ONMOUSEOUT: {
//DOM.setStyleAttribute(td, "backgroundColor","#ffffff");
break;
}
/*case Event.ONCLICK: {
DOM.setStyleAttribute(td, "backgroundColor", "#ffce00");
break;
}*/
case Event.ONDBLCLICK: {
//DOM.setStyleAttribute(td, "backgroundColor", "#ffffff");
break;
}
case Event.KEYEVENTS: {
//DOM.setStyleAttribute(td, "backgroundColor", "#ffce00");
break;
}
case Event.ONFOCUS: {
//DOM.setStyleAttribute(td, "backgroundColor", "#ffce00");
break;
}
/*case Event. {
DOM.setStyleAttribute(td, "backgroundColor", "#ffce00");
break;
}*/
}
}
我需要做什么才能捕捉到这个事件?