本文整理汇总了Java中com.google.gwt.user.client.Event.getButton方法的典型用法代码示例。如果您正苦于以下问题:Java Event.getButton方法的具体用法?Java Event.getButton怎么用?Java Event.getButton使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.Event
的用法示例。
在下文中一共展示了Event.getButton方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: captureEvents
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
protected void captureEvents(Event event) {
event.preventDefault();
if (isEnabled() && event.getButton() == Event.BUTTON_LEFT) {
if (!dragDrop) {
dragDrop = true;
DOM.setCapture(resizeElement);
ComputedStyle cs = new ComputedStyle(getElement());
setWidth(cs.getProperty("width"));
setHeight(cs.getProperty("height"));
getTextArea().getStyle().setProperty("width", "100%");
getTextArea().getStyle().setProperty("height", "100%");
}
}
}
示例2: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
if (contextMenuHandler != null && event.getTypeInt() == Event.ONCONTEXTMENU) {
contextMenuHandler.onContextMenu(event);
return;
}
if ((event.getTypeInt() == Event.ONCLICK
|| event.getTypeInt() == Event.ONMOUSEDOWN)
&& event.getButton() != NativeEvent.BUTTON_LEFT) {
event.preventDefault();
event.stopPropagation();
return;
}
super.onBrowserEvent(event);
}
示例3: releaseCapture
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
protected void releaseCapture(Event event) {
if (event.getButton() == Event.BUTTON_LEFT && dragDrop) {
dragDrop = false;
DOM.releaseCapture(resizeElement);
if (resizeHandler != null) {
ComputedStyle cs = new ComputedStyle(getElement());
resizeHandler.sizeChanged(cs.getProperty("width"), cs.getProperty("height"));
resizeHandler.textChanged(getText());
}
}
}
示例4: mouseButtons
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
/**
* @return A string describing which mouse buttons were pressed,
* e.g., " left"
*/
private static String mouseButtons(Event event) {
if (event.getButton() == -1) {
return "";
} else {
return ((event.getButton() & Event.BUTTON_LEFT) != 0 ? " left" : "")
+ ((event.getButton() & Event.BUTTON_MIDDLE) != 0 ? " middle" : "")
+ ((event.getButton() & Event.BUTTON_RIGHT) != 0 ? " right" : "");
}
}
示例5: onBrowserEvent
import com.google.gwt.user.client.Event; //导入方法依赖的package包/类
@Override
public void onBrowserEvent(Event event) {
if (getElement() == DOM.eventGetTarget(event)) {
return;
}
SuggestionItem item = findItem(DOM.eventGetTarget(event));
switch (DOM.eventGetType(event)) {
case Event.ONMOUSEDOWN: {
if (BrowserInfo.get().isIE()) {
suggestionFieldWidget.iePreventBlur = true;
}
break;
}
case Event.ONCLICK: {
if (event.getButton() == NativeEvent.BUTTON_LEFT) {
performItemCommand(item);
}
break;
}
case Event.ONMOUSEOVER: {
if (item != null) {
selectItem(item);
}
break;
}
case Event.ONKEYDOWN: {
int keyCode = KeyCodes.maybeSwapArrowKeysForRtl(
event.getKeyCode(),
LocaleInfo.getCurrentLocale().isRTL()
);
switch (keyCode) {
case KeyCodes.KEY_UP:
selectPrevItem();
preventEvent(event);
break;
case KeyCodes.KEY_DOWN:
selectNextItem();
preventEvent(event);
break;
case KeyCodes.KEY_ESCAPE:
selectItem(null);
preventEvent(event);
break;
case KeyCodes.KEY_TAB:
selectItem(null);
break;
case KeyCodes.KEY_ENTER:
performItemCommand(item);
preventEvent(event);
break;
}
break;
}
}
super.onBrowserEvent(event);
}