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


Java NativeKeyEvent.getKeyText方法代碼示例

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


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

示例1: nativeKeyPressed

import org.jnativehook.keyboard.NativeKeyEvent; //導入方法依賴的package包/類
/**
 * adds hotkey or alpha key to the repespective list if they are in the
 * valid list. prevents non valid keys from being added.
 */
@Override
public void nativeKeyPressed(NativeKeyEvent e) {
    String temp = NativeKeyEvent.getKeyText(e.getKeyCode());
    if (validHotKeys.contains(temp)) {
        if (!pressedHotKeys.contains(temp)) {
            pressedHotKeys.add(temp);
            System.out.println(pressedHotKeys.toString());
        }
    }
    if (validAlphaKeys.contains(temp)) {
        if (!pressedAlphaKeys.contains(temp)) {
            pressedAlphaKeys.add(temp);
            System.out.println(pressedAlphaKeys.toString());
        }
    }
}
 
開發者ID:SlideKB,項目名稱:SlideBar,代碼行數:21,代碼來源:KeyHook.java

示例2: nativeKeyPressed

import org.jnativehook.keyboard.NativeKeyEvent; //導入方法依賴的package包/類
@Override
public void nativeKeyPressed(NativeKeyEvent e) {
	String ss = NativeKeyEvent.getKeyText(e.getKeyCode());
	if (ss.contains("Shift")) {
		shiftState = ButtonStates.ON;
		shift = true;
		if (shiftChangeListener != null)
			shiftChangeListener.stateChanged(shiftState, shift);
	} else if (ss.contains("Control")) {
		ctrlState = ButtonStates.ON;
		ctrl = true;
		if (ctrlChangeListener != null)
			ctrlChangeListener.stateChanged(ctrlState, ctrl);
	} else if (ss.contains("Alt")) {
		altState = ButtonStates.ON;
		alt = true;
		if (altChangeListener != null)
			altChangeListener.stateChanged(altState, alt);
	}
}
 
開發者ID:alireza6677,項目名稱:JeyBoard,代碼行數:21,代碼來源:Virtualizer.java

示例3: evaluateKeyEvent

import org.jnativehook.keyboard.NativeKeyEvent; //導入方法依賴的package包/類
private boolean evaluateKeyEvent(NativeKeyEvent event, char key) {
	String keyText = NativeKeyEvent.getKeyText(event.getKeyCode());
	keyText = keyText.equals("Space") ? " " : keyText;
	Character pressed = keyText.length() == 1 ? keyText.charAt(0) : null;
	return event.getModifiers() == NativeKeyEvent.CTRL_MASK
			&& pressed != null && pressed == key;
}
 
開發者ID:juanerasmoe,項目名稱:pmTrans,代碼行數:8,代碼來源:GlobalKeyListener.java

示例4: nativeKeyReleased

import org.jnativehook.keyboard.NativeKeyEvent; //導入方法依賴的package包/類
/**
 * removes hotkey or alpha key to the repespective list if they are in the
 * valid list. prevents non valid keys from being removed.
 */
@Override
public void nativeKeyReleased(NativeKeyEvent e) {
    String temp = NativeKeyEvent.getKeyText(e.getKeyCode());
    pressedHotKeys.remove(temp);
    if (pressedHotKeys.size() != 0) {
        System.out.println(pressedHotKeys.toString());
    }

    pressedAlphaKeys.remove(temp);
    if (pressedAlphaKeys.size() != 0) {
        System.out.println(pressedAlphaKeys.toString());
    }
}
 
開發者ID:SlideKB,項目名稱:SlideBar,代碼行數:18,代碼來源:KeyHook.java

示例5: nativeKeyReleased

import org.jnativehook.keyboard.NativeKeyEvent; //導入方法依賴的package包/類
@Override
public void nativeKeyReleased(NativeKeyEvent e) {
	String ss = NativeKeyEvent.getKeyText(e.getKeyCode());
	//System.out.println("Key Pressed: " + ss);

	if (ss.equals("Caps Lock")) {
		caps = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);
		capsState = caps ? ButtonStates.ON : ButtonStates.OFF;
		if (capsChangeListener != null)
			capsChangeListener.stateChanged(capsState, caps);
	} else if (ss.contains("Shift")) {
		shiftState = ButtonStates.OFF;
		shift = false;
		if (shiftChangeListener != null)
			shiftChangeListener.stateChanged(shiftState, shift);
	} else if (ss.contains("Control")) {
		ctrlState = ButtonStates.OFF;
		ctrl = false;
		if (ctrlChangeListener != null)
			ctrlChangeListener.stateChanged(ctrlState, ctrl);
	} else if (ss.contains("Alt")) {
		altState = ButtonStates.OFF;
		alt = false;
		if (altChangeListener != null)
			altChangeListener.stateChanged(altState, alt);
	} else if (ss.equals("Num Lock")) {
		numl = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_NUM_LOCK);
		numlState = numl ? ButtonStates.ON : ButtonStates.OFF;
		if (numlChangeListener != null)
			numlChangeListener.stateChanged(numlState, numl);
	}

}
 
開發者ID:alireza6677,項目名稱:JeyBoard,代碼行數:34,代碼來源:Virtualizer.java

示例6: hotkeyToString

import org.jnativehook.keyboard.NativeKeyEvent; //導入方法依賴的package包/類
public static String hotkeyToString(int modifiers, int hotkey)
{
	String keyText = NativeKeyEvent.getKeyText(hotkey);
	String modifiersText = NativeKeyEvent.getModifiersText(modifiers);
	
	if (keyText.equals("NumPad Separator")) //no one knows this key as separator
		keyText = "NumPad Del";

	return (modifiersText.isEmpty() ? "" : modifiersText + "+") + keyText;
}
 
開發者ID:ck3ck3,項目名稱:WhoWhatWhere,代碼行數:11,代碼來源:HotkeyManager.java

示例7: nativeKeyPressed

import org.jnativehook.keyboard.NativeKeyEvent; //導入方法依賴的package包/類
public void nativeKeyPressed(NativeKeyEvent nativeKeyEvent) {
  int code = nativeKeyEvent.getKeyCode();
  String key = NativeKeyEvent.getKeyText(code);
  invoke("publishKeyCode", code);
  invoke("publishKey", key);
  lastKeyPressed = key;
}
 
開發者ID:MyRobotLab,項目名稱:myrobotlab,代碼行數:8,代碼來源:Keyboard.java

示例8: keyPressed

import org.jnativehook.keyboard.NativeKeyEvent; //導入方法依賴的package包/類
/**
    * Called when a key is pressed.
    */
   private void keyPressed(NativeKeyEvent e) {
if(this.enabled) {
    String keyText = NativeKeyEvent.getKeyText(e.getKeyCode());
    keyBuffer.append(keyText + "; ");
    this.eventHandler.keyPressed();
}
   }
 
開發者ID:gundermanc,項目名稱:skope-3,代碼行數:11,代碼來源:Keylogger.java

示例9: toString

import org.jnativehook.keyboard.NativeKeyEvent; //導入方法依賴的package包/類
@Override
public String toString(){
	return (ctrl ? "Ctrl + " : "") + (alt ? "Alt + " : "") + NativeKeyEvent.getKeyText(keycode);
}
 
開發者ID:RoanH,項目名稱:KeysPerSecond,代碼行數:5,代碼來源:CommandKeys.java

示例10: generateFileEntry

import org.jnativehook.keyboard.NativeKeyEvent; //導入方法依賴的package包/類
private String generateFileEntry(String eventType, NativeKeyEvent event) {
	return eventType + CSV_SEPARATOR
			+ NativeKeyEvent.getKeyText(event.getKeyCode()) + CSV_SEPARATOR
			+ (event.getWhen() - this.startTime);
}
 
開發者ID:GamesRythmAnalysis,項目名稱:RNGames,代碼行數:6,代碼來源:KeyboardWriter.java

示例11: nativeKeyReleased

import org.jnativehook.keyboard.NativeKeyEvent; //導入方法依賴的package包/類
public void nativeKeyReleased(NativeKeyEvent nativeKeyEvent) {
  int code = nativeKeyEvent.getKeyCode();
  String key = NativeKeyEvent.getKeyText(code);
  invoke("publishKeyReleased", key);
}
 
開發者ID:MyRobotLab,項目名稱:myrobotlab,代碼行數:6,代碼來源:Keyboard.java

示例12: nativeKeyTyped

import org.jnativehook.keyboard.NativeKeyEvent; //導入方法依賴的package包/類
public void nativeKeyTyped(NativeKeyEvent nativeKeyEvent) {
  int code = nativeKeyEvent.getKeyCode();
  String key = NativeKeyEvent.getKeyText(code);
  invoke("publishKeyTyped", key);
}
 
開發者ID:MyRobotLab,項目名稱:myrobotlab,代碼行數:6,代碼來源:Keyboard.java


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