本文整理匯總了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);
}