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


Java NativeKeyEvent.VC_ALT屬性代碼示例

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


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

示例1: nativeKeyPressed

public void nativeKeyPressed(NativeKeyEvent e) {
        int code = e.getKeyCode();
        if (code == NativeKeyEvent.VC_CONTROL) {
            ctrl = true;
            for (int keycode : F_KEYS) {
                GlobalKeyConsumer.instance.consumeKeyCode(keycode);
            }
        } else if (code == NativeKeyEvent.VC_ALT) {
            if (e.getKeyLocation() == 3) { // right alt
                GlobalKeyConsumer.instance.consumeKeyCode(NativeKeyEvent.VC_C);
                ralt = true;
            } else if (e.getKeyLocation() == 2) { // left alt

            }
        }
//        log.db(e.getRawCode() + " " + code + " " + e.getKeyLocation() + " " + NativeKeyEvent.ALT_R_MASK);
        allReleased = false;
    }
 
開發者ID:rococode,項目名稱:rensa,代碼行數:18,代碼來源:GlobalKeyListener.java

示例2: nativeKeyPressed

@Override
public void nativeKeyPressed(NativeKeyEvent nativeEvent) {
	if (nativeEvent.getKeyCode() == NativeKeyEvent.VC_CONTROL) {
		isCtrlKeyPressed = true;
	}
	if (nativeEvent.getKeyCode() == NativeKeyEvent.VC_ALT) {
		isAltKeyPressed = true;
	}
}
 
開發者ID:michaelnetter,項目名稱:dracoon-dropzone,代碼行數:9,代碼來源:DropzonePopOver.java

示例3: nativeKeyReleased

@Override
public void nativeKeyReleased(NativeKeyEvent nativeEvent) {
	if (nativeEvent.getKeyCode() == NativeKeyEvent.VC_CONTROL) {
		isCtrlKeyPressed = false;
	}
	if (nativeEvent.getKeyCode() == NativeKeyEvent.VC_ALT) {
		isAltKeyPressed = false;
	}
}
 
開發者ID:michaelnetter,項目名稱:dracoon-dropzone,代碼行數:9,代碼來源:DropzonePopOver.java

示例4: nativeKeyReleased

public void nativeKeyReleased(NativeKeyEvent e) {
    int code = e.getKeyCode();
    if (code == NativeKeyEvent.VC_CONTROL) {
        allReleased = true;
        ctrl = false;
        for (int keycode : F_KEYS) {
            GlobalKeyConsumer.instance.dontConsumeKeyCode(keycode);
        }
    } else if (code == NativeKeyEvent.VC_ALT) {
        if (e.getKeyLocation() == 3) { // right alt
            ralt = false;
            GlobalKeyConsumer.instance.dontConsumeKeyCode(NativeKeyEvent.VC_C);
        } else if (e.getKeyLocation() == 2) { // left alt
        }
    } else if (ctrl) {
        if (code == NativeKeyEvent.VC_F9) {
            MediaKeys.volumeDown();
        } else if (code == NativeKeyEvent.VC_F10) {
            MediaKeys.volumeUp();
        } else if (code == NativeKeyEvent.VC_F11) {
            MediaKeys.mute();
        } else if (code == NativeKeyEvent.VC_F8) {
            MediaKeys.play();
        } else if (code == NativeKeyEvent.VC_F7) {
            MediaKeys.next();
        } else if (code == NativeKeyEvent.VC_F6) {
            MediaKeys.prev();
        }
    } else if (ralt) {
        if (code == NativeKeyEvent.VC_C) {
            MouseControls.moveMouseToCorner();
        } else if (code == NativeKeyEvent.VC_X) {
            MouseControls.moveMouseToCenter();
        }
    }

}
 
開發者ID:rococode,項目名稱:rensa,代碼行數:37,代碼來源:GlobalKeyListener.java

示例5: consume

private void consume(NativeKeyEvent e) {
        int code = e.getKeyCode();
        if (consume.contains(code)) {
            System.out.print("Attempting to consume " + code + "[" + NativeKeyEvent.getKeyText(code) + "] event...\t");
            reflectConsume(e);
        } else if (code == NativeKeyEvent.VC_ALT) {
            if (e.getKeyLocation() == 3) { // right alt
//                log.info("Attempting to consume right alt...\t");
//                reflectConsume(e);
            }
        }
    }
 
開發者ID:rococode,項目名稱:rensa,代碼行數:12,代碼來源:GlobalKeyConsumer.java

示例6: getExtendedKeyCode

/**
 * Gets the extended key code for this event, this key code
 * includes modifiers
 * @param code The original key code
 * @return The extended key code for this event
 */
private static final int getExtendedKeyCode(int code, boolean shift, boolean ctrl, boolean alt){
	if(code == NativeKeyEvent.VC_SHIFT || code == NativeKeyEvent.VC_CONTROL || code == NativeKeyEvent.VC_ALT){
		return code;
	}else{
		return code + (shift ? 100000 : 0) + (ctrl ? 10000 : 0) + (alt ? 1000 : 0);
	}
}
 
開發者ID:RoanH,項目名稱:KeysPerSecond,代碼行數:13,代碼來源:Main.java

示例7: pressEvent

/**
 * Called when a key is pressed
 * @param event The event that occurred
 */
private static final void pressEvent(NativeInputEvent nevent){
	Integer code = getExtendedKeyCode(nevent);
	if(config.trackAll && !keys.containsKey(code)){
		if(nevent instanceof NativeKeyEvent){
			keys.put(code, new Key(KeyInformation.getKeyName(NativeKeyEvent.getKeyText(((NativeKeyEvent)nevent).getKeyCode()), ((NativeKeyEvent)nevent).getKeyCode(), CommandKeys.isAltDown, CommandKeys.isCtrlDown, CommandKeys.isShiftDown)));
		}else{
			keys.put(code, new Key("M" + ((NativeMouseEvent)nevent).getButton()));
		}
	}
	if(!suspended && keys.containsKey(code)){
		Key key = keys.get(code);
		key.keyPressed();
		if(config.enableModifiers){
			if(key.alt && keys.containsKey(NativeKeyEvent.VC_ALT)){
				keys.get(NativeKeyEvent.VC_ALT).keyReleased();
			}
			if(key.ctrl && keys.containsKey(NativeKeyEvent.VC_CONTROL)){
				keys.get(NativeKeyEvent.VC_CONTROL).keyReleased();
			}
			if(key.shift && keys.containsKey(NativeKeyEvent.VC_SHIFT)){
				keys.get(NativeKeyEvent.VC_SHIFT).keyReleased();
			}
		}
	}
	if(nevent instanceof NativeKeyEvent){
		NativeKeyEvent event = (NativeKeyEvent)nevent;
		if(!CommandKeys.isAltDown){
			CommandKeys.isAltDown = event.getKeyCode() == NativeKeyEvent.VC_ALT;
		}
		if(!CommandKeys.isCtrlDown){
			CommandKeys.isCtrlDown = event.getKeyCode() == NativeKeyEvent.VC_CONTROL;
		}
		if(!CommandKeys.isShiftDown){
			CommandKeys.isShiftDown = event.getKeyCode() == NativeKeyEvent.VC_SHIFT;
		}
		lastevent = event;
		if(config.CP.matches(event.getKeyCode())){
			resetStats();
		}else if(config.CU.matches(event.getKeyCode())){
			exit();
		}else if(config.CI.matches(event.getKeyCode())){
			resetTotals();
		}else if(config.CY.matches(event.getKeyCode())){
			if(frame.getContentPane().getComponentCount() != 0){
				frame.setVisible(!frame.isVisible());
			}
		}else if(config.CT.matches(event.getKeyCode())){
			suspended = !suspended;
			Menu.pause.setSelected(suspended);
		}else if(config.CR.matches(event.getKeyCode())){
			double oldScale = config.size;
			config.reloadConfig();
			Menu.resetData(oldScale);
		}
	}
}
 
開發者ID:RoanH,項目名稱:KeysPerSecond,代碼行數:60,代碼來源:Main.java

示例8: KeyInformation

/**
 * Constructs a new KeyInformation
 * object with the given information
 * @param name The name of the key
 * @param code The virtual key code of the key
 * @param Whether or not alt is down
 * @param Whether or not ctrl is down
 * @param Whether or not shift is down
 * @param Whether or not this is a mouse button
 * @see #name
 * @see #keycode 
 */
private KeyInformation(String name, int code, boolean alt, boolean ctrl, boolean shift, boolean mouse){
	if(!(code == NativeKeyEvent.VC_SHIFT || code == NativeKeyEvent.VC_CONTROL || code == NativeKeyEvent.VC_ALT)){
		this.alt = alt;
		this.ctrl = ctrl;
		this.shift = shift;
	}
	this.name = mouse ? name : getKeyName(name, code, this.alt, this.ctrl, this.shift);
	this.keycode = mouse ? code : getExtendedKeyCode(code, shift, ctrl, alt);
}
 
開發者ID:RoanH,項目名稱:KeysPerSecond,代碼行數:21,代碼來源:Main.java


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