本文整理汇总了Java中com.google.gwt.user.client.Event.ONKEYUP属性的典型用法代码示例。如果您正苦于以下问题:Java Event.ONKEYUP属性的具体用法?Java Event.ONKEYUP怎么用?Java Event.ONKEYUP使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.gwt.user.client.Event
的用法示例。
在下文中一共展示了Event.ONKEYUP属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onBrowserEvent
@Override
public void onBrowserEvent(Event event) {
if (!isEnabled()) return;
super.onBrowserEvent(event);
if ((event.getTypeInt() & Event.KEYEVENTS) != 0) {
int type = DOM.eventGetType(event);
char keyCode = (char) event.getKeyCode();
switch (type) {
case Event.ONKEYDOWN:
if (keyCode == ' ' || keyCode == '\n' || keyCode == '\r') {
if (iDown != null) setResource(iDown);
}
break;
case Event.ONKEYUP:
if (keyCode == ' ' || keyCode == '\n' || keyCode == '\r') {
setResource(iUp);
onClick();
}
break;
}
}
}
示例2: onBrowserEvent
@Override
public void onBrowserEvent(Event event) {
super.onBrowserEvent(event);
if ((event.getTypeInt() & Event.KEYEVENTS) != 0) {
int type = DOM.eventGetType(event);
char keyCode = (char) event.getKeyCode();
switch (type) {
case Event.ONKEYUP:
if (keyCode == ' ' || keyCode == '\n' || keyCode == '\r')
onClick();
break;
}
}
}
示例3: onBrowserEvent
@Override
public void onBrowserEvent(Event event) {
if (event.getTypeInt() == Event.ONKEYUP && event.getKeyCode() == KeyCodes.KEY_SPACE) {
onClick();
}
if (event.getTypeInt() == Event.ONCLICK) {
setValue(!getValue());
}
super.onBrowserEvent(event);
}
示例4: asString
public static String asString(Event event) {
// Start with the event type string
String string = DOM.eventGetTypeString(event);
// Next type-specific fields
switch (event.getTypeInt()) {
case Event.ONKEYPRESS:
case Event.ONKEYUP:
case Event.ONKEYDOWN:
string += key(event) + modifiers(event);
break;
case Event.ONCLICK:
case Event.ONDBLCLICK:
case Event.ONMOUSEMOVE:
string += mousePoint(event) + modifiers(event);
break;
case Event.ONMOUSEDOWN:
case Event.ONMOUSEUP:
string += mousePoint(event) + mouseButtons(event) + modifiers(event);
break;
case Event.ONMOUSEOUT:
string += mousePoint(event) + modifiers(event) + " to: " + getToElement(event);
break;
case Event.ONMOUSEOVER:
string += mousePoint(event) + modifiers(event) + " from: " + getFromElement(event);
break;
case Event.ONMOUSEWHEEL:
string += " " + getMouseWheelVelocityY(event) + mousePoint(event) + modifiers(event);
break;
case Event.ONFOCUS:
case Event.ONBLUR:
case Event.ONCHANGE:
case Event.ONERROR:
case Event.ONLOAD:
case Event.ONLOSECAPTURE:
case Event.ONSCROLL:
break;
}
return string;
}
示例5: handleKeyboardEvents
@Override
protected boolean handleKeyboardEvents(Event event) {
int type = DOM.eventGetType(event);
// Synthesize clicks based on keyboard events AFTER the normal key
// handling.
if ((event.getTypeInt() & Event.KEYEVENTS) != 0) {
switch (type) {
case Event.ONKEYDOWN:
// Button should not react on shortcuts with ENTER and SPACE
if (isShortcut(event)
&& (event.getKeyCode() == KeyCodes.KEY_ENTER
|| event.getKeyCode() == KeyCodes.KEY_SPACE)) {
return true;
}
// Stop propagation when the user starts pressing a button that
// we are handling to prevent actions from getting triggered
if (event.getKeyCode() == KeyCodes.KEY_SPACE) {
isFocusing = true;
event.preventDefault();
event.stopPropagation();
return true;
} else if (event.getKeyCode() == KeyCodes.KEY_ENTER) {
isFocusing = true;
event.stopPropagation();
return true;
} else if (event.getKeyCode() == KeyCodes.KEY_DOWN) {
isFocusing = true;
event.stopPropagation();
}
break;
// CAUTION IE sometimes does not generate ONKEYPRESS for ENTER, so we override default Vaadin behavior
case Event.ONKEYUP:
if (isFocusing) {
if (event.getKeyCode() == KeyCodes.KEY_SPACE) {
isFocusing = false;
onClick();
event.stopPropagation();
event.preventDefault();
return true;
} else if (event.getKeyCode() == KeyCodes.KEY_ENTER) {
isFocusing = false;
onClick();
event.stopPropagation();
event.preventDefault();
return true;
} else if (event.getKeyCode() == KeyCodes.KEY_DOWN) {
isFocusing = false;
onClick();
event.stopPropagation();
event.preventDefault();
return true;
}
} else if (isShortcut(event)
&& (event.getKeyCode() == KeyCodes.KEY_ENTER
|| event.getKeyCode() == KeyCodes.KEY_SPACE)) {
return true;
}
break;
case Event.ONKEYPRESS: {
// Button should not react on shortcuts with ENTER and SPACE
if (isShortcut(event)
&& (event.getKeyCode() == KeyCodes.KEY_ENTER
|| event.getKeyCode() == KeyCodes.KEY_SPACE)) {
return true;
}
}
}
}
return false;
}
示例6: handleKeyboardEvents
@Override
protected boolean handleKeyboardEvents(Event event) {
int type = DOM.eventGetType(event);
// Synthesize clicks based on keyboard events AFTER the normal key
// handling.
if ((event.getTypeInt() & Event.KEYEVENTS) != 0) {
switch (type) {
case Event.ONKEYDOWN:
// Button should not react on shortcuts with ENTER and SPACE
if (isShortcut(event)
&& (event.getKeyCode() == KeyCodes.KEY_ENTER
|| event.getKeyCode() == KeyCodes.KEY_SPACE)) {
return true;
}
// Stop propagation when the user starts pressing a button that
// we are handling to prevent actions from getting triggered
if (event.getKeyCode() == KeyCodes.KEY_SPACE) {
isFocusing = true;
event.preventDefault();
event.stopPropagation();
return true;
} else if (event.getKeyCode() == KeyCodes.KEY_ENTER) {
isFocusing = true;
event.stopPropagation();
return true;
}
break;
// CAUTION IE sometimes does not generate ONKEYPRESS for ENTER, so we override default Vaadin behavior
case Event.ONKEYUP:
if (isFocusing) {
if (event.getKeyCode() == KeyCodes.KEY_SPACE) {
isFocusing = false;
onClick();
event.stopPropagation();
event.preventDefault();
return true;
} else if (event.getKeyCode() == KeyCodes.KEY_ENTER) {
isFocusing = false;
onClick();
event.stopPropagation();
event.preventDefault();
return true;
}
} else if (isShortcut(event)
&& (event.getKeyCode() == KeyCodes.KEY_ENTER
|| event.getKeyCode() == KeyCodes.KEY_SPACE)) {
return true;
}
break;
case Event.ONKEYPRESS: {
// Button should not react on shortcuts with ENTER and SPACE
if (isShortcut(event)
&& (event.getKeyCode() == KeyCodes.KEY_ENTER
|| event.getKeyCode() == KeyCodes.KEY_SPACE)) {
return true;
}
}
}
}
return false;
}