當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyPressEvent.getUnicodeCharCode方法代碼示例

本文整理匯總了Java中com.google.gwt.event.dom.client.KeyPressEvent.getUnicodeCharCode方法的典型用法代碼示例。如果您正苦於以下問題:Java KeyPressEvent.getUnicodeCharCode方法的具體用法?Java KeyPressEvent.getUnicodeCharCode怎麽用?Java KeyPressEvent.getUnicodeCharCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.gwt.event.dom.client.KeyPressEvent的用法示例。


在下文中一共展示了KeyPressEvent.getUnicodeCharCode方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onKeyPress

import com.google.gwt.event.dom.client.KeyPressEvent; //導入方法依賴的package包/類
@Override
public void onKeyPress(KeyPressEvent event) {
	try {
		int code = event.getUnicodeCharCode(); 
		if (code == '\u002B')
			pageView.zoomIn();
		else if (code == '\u2212' || code == '\u2010' || code == '\u002D')
			pageView.zoomOut();
		else if (code == '\u2212' || code == '\u2010' || code == '\u002D')
			pageView.zoomOut();
		//else if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_PAGEDOWN)
		//	selectNextObject();
		//else if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_PAGEUP)
		//	selectPreviousObject();
		//else
		//	Window.alert(""+code);
	} catch (Exception exc) {
		logManager.logError(ERROR_UNSPECIFIED, "Error in onKeyPress()");
		exc.printStackTrace();
	}
}
 
開發者ID:PRImA-Research-Lab,項目名稱:prima-aletheia-web-emop,代碼行數:22,代碼來源:WebLayoutEditor.java

示例2: Code

import com.google.gwt.event.dom.client.KeyPressEvent; //導入方法依賴的package包/類
@SuppressWarnings("rawtypes")
public Code(KeyEvent event){
	if (event != null){
		if (event instanceof KeyPressEvent){
			kP_Event = (KeyPressEvent)event;
		} else if (event instanceof KeyDownEvent){
			kD_Event = (KeyDownEvent)event;
		}
		isCtrlDown = event.isControlKeyDown();
		isAltDown = event.isAltKeyDown();
		isShiftDown  = event.isShiftKeyDown();
	}
	int temp = 0;
	if (kP_Event != null){
		charCode = kP_Event.getUnicodeCharCode();
	} else if (kD_Event != null){
		temp = keyCode = kD_Event.getNativeKeyCode();
	} 
	isFunctionKey = false;
	for (int k : keyCodes){
		if (temp == k) {
			isFunctionKey = true;
			break;
		}
	}
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:27,代碼來源:Code.java

示例3: toMask

import com.google.gwt.event.dom.client.KeyPressEvent; //導入方法依賴的package包/類
static int toMask(KeyPressEvent event) {
  int mask = event.getUnicodeCharCode();
  if (mask == 0) {
    mask = event.getNativeEvent().getKeyCode();
  }
  if (event.isControlKeyDown()) {
    mask |= KeyCommand.M_CTRL;
  }
  if (event.isMetaKeyDown()) {
    mask |= KeyCommand.M_META;
  }
  return mask;
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:14,代碼來源:KeyCommandSet.java

示例4: hasEnterKeyBeenPressed

import com.google.gwt.event.dom.client.KeyPressEvent; //導入方法依賴的package包/類
public static boolean hasEnterKeyBeenPressed(KeyPressEvent event) {
		//GWT BUG: http://code.google.com/p/google-web-toolkit/issues/detail?id=5558
		int unicode = event.getUnicodeCharCode();
		char code = event.getCharCode(); 
		NativeEvent nativeEvent = event.getNativeEvent();
		int keyCode = nativeEvent.getKeyCode();
//		AtomTools.log(Level.FINER, "login_passwordbox_keyPress; UnicodeCharCode=\""+unicode+"\" ; keyCode=\""+ keyCode +" ; CharCode=\""+String.valueOf(code)+"\"<endofline>", this);
		//if(event.getCharCode() == KeyCodes.KEY_ENTER) {
		
		if(code == '\n' || code == '\r' || (unicode == 0 && keyCode == 13)) {
			return true;
		}
		return false;
	}
 
開發者ID:fhcampuswien,項目名稱:atom,代碼行數:15,代碼來源:ClientTools.java

示例5: Code

import com.google.gwt.event.dom.client.KeyPressEvent; //導入方法依賴的package包/類
/**
 * The Code(KeyEvent event) constructor takes a generic KeyEvent and decides whether
 * it is a KeyPressEvent or KeyDownEvent. Any relevant information about the event
 * is extracted and stored in class variables
 * @param event generic KeyEvent
 */
@SuppressWarnings("unchecked")
public Code(KeyEvent event){
	if (event != null){
		if (event instanceof KeyPressEvent){
			kP_Event = (KeyPressEvent)event;
		} else if (event instanceof KeyDownEvent){
			kD_Event = (KeyDownEvent)event;
		}
		isCtrlDown = event.isControlKeyDown();
		isAltDown = event.isAltKeyDown();
		isShiftDown  = event.isShiftKeyDown();
	}
	
	if (kP_Event != null){
		charCode = kP_Event.getUnicodeCharCode();
	} else if (kD_Event != null){
		keyCode = kD_Event.getNativeKeyCode();
	} 
	
	isFunctionKey = false;
	for (int k : keyCodes){
		if (keyCode == k) {
			isFunctionKey = true;
			break;
		}
	}
}
 
開發者ID:qoswork,項目名稱:opennmszh,代碼行數:34,代碼來源:Code.java

示例6: getKeyCode

import com.google.gwt.event.dom.client.KeyPressEvent; //導入方法依賴的package包/類
private static int getKeyCode(final KeyPressEvent event) {
  final int code = event.getUnicodeCharCode();
  if (code != 0) {
    return code;
  }
  // According to bug #5558, this might confuse '(' and 'down arrow'.
  return event.getNativeEvent().getKeyCode();
}
 
開發者ID:tsuna,項目名稱:droopy,代碼行數:9,代碼來源:EventsHandler.java


注:本文中的com.google.gwt.event.dom.client.KeyPressEvent.getUnicodeCharCode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。