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


Java KeyEvent.KEY_PRESSED屬性代碼示例

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


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

示例1: addToList

private static void addToList(KeyEvent e) {
    final StringBuilder sb = new StringBuilder();
    if (e.getEventType() == KeyEvent.KEY_PRESSED) {
        sb.append(checkModifier(e) + " pressed " + e.getCode());
    }
    if (e.getEventType() == KeyEvent.KEY_RELEASED) {
        sb.append(checkModifier(e) + " released " + e.getCode());
    }
    kss.add(sb.toString().trim());
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:10,代碼來源:EventQueueDeviceTest.java

示例2: recordRawKeyEvent

@Override public void recordRawKeyEvent(RFXComponent r, KeyEvent e) {
    JSONObject event = new JSONObject();
    event.put("type", "key_raw");
    KeyCode keyCode = e.getCode();
    if (keyCode.isModifierKey()) {
        return;
    }
    if ((keyCode.isFunctionKey() || keyCode.isArrowKey() || keyCode.isKeypadKey() || keyCode.isMediaKey()
            || keyCode.isNavigationKey() || e.isControlDown() || e.isMetaDown() || e.isAltDown()
            || needManualRecording(keyCode)) && e.getEventType() == KeyEvent.KEY_PRESSED) {
        String mtext = buildModifiersText(e);
        event.put("modifiersEx", mtext);
        KeysMap keysMap = KeysMap.findMap(e.getCode());
        if (keysMap == KeysMap.NULL) {
            return;
        }
        String keyText;
        if (keysMap == null) {
            keyText = e.getText();
        } else {
            keyText = keysMap.toString();
        }
        event.put("keyCode", keyText);
    } else if (e.getEventType() == KeyEvent.KEY_TYPED && !e.isControlDown() && !needManualRecording(keyCode)) {
        char[] cs = e.getCharacter().toCharArray();
        if (cs.length == 0) {
            return;
        }
        for (char c : cs) {
            if (Character.isISOControl(c) && hasMapping(c)) {
                event.put("keyChar", getMapping(c));
            } else {
                event.put("keyChar", "" + c);
            }
        }
    } else {
        return;
    }
    recordEvent(r, event);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:40,代碼來源:WSRecorder.java

示例3: handle

@Override
public void handle(KeyEvent event) {
    String code = event.getCode().getName().toLowerCase();

    if(event.getEventType()==KeyEvent.KEY_PRESSED){
        press.handle(code);
    }else if(event.getEventType()==KeyEvent.KEY_RELEASED){
        release.handle(code);
    }
}
 
開發者ID:whitewoodcity,項目名稱:xbrowser,代碼行數:10,代碼來源:KeyEventHandler.java

示例4: handle

@Override public void handle(KeyEvent event) {
    if (event.getEventType() != KeyEvent.KEY_PRESSED) {
        return;
    }
    KeyCode code = event.getCode();
    switch (code) {
    case ENTER:
        positionToLastLine();
        boolean collect = false;
        if (area.getText().toString().endsWith(";")) {
            collect = true;
            area.setText(area.getText().substring(0, area.getText().length() - 1));
        }
        if (collect || event.isShiftDown()) {
            collectAction();
        } else {
            if (functionText.length() > 0) {
                collectAction();
            }
            enterAction(event);
            area.setEditable(false);
        }
        break;
    case UP:
        positionToLastLine();
        upAction(event);
        break;
    case DOWN:
        positionToLastLine();
        downAction(event);
        break;
    case LEFT:
    case D:
        if (event.isControlDown()) {
            event.consume();
            inputJoin.send(Channel.LINE, EMPTY_LINE);
        }
        break;
    default:
        break;
    }
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:42,代碼來源:TextAreaReadline.java


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