当我按下 ESC 键时,我使用该事件显示一条消息,但它显示了两次警报。错误在哪里?
Event.addNativePreviewHandler(new Event.NativePreviewHandler() {
@Override
public void onPreviewNativeEvent(Event.NativePreviewEvent event) {
NativeEvent nativeEvent = event.getNativeEvent();
if( nativeEvent.getKeyCode() == 27){
Windows.alert("HELLO");
}
}
});