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


Java KeyEvent.isControlDown方法代碼示例

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


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

示例1: ketEventGetModifiersExText

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
public static String ketEventGetModifiersExText(KeyEvent event) {
    StringBuffer sb = new StringBuffer();

    if (event.isControlDown()) {
        sb.append("Ctrl+");
    }
    if (event.isMetaDown()) {
        sb.append("Meta+");
    }
    if (event.isAltDown()) {
        sb.append("Alt+");
    }
    if (event.isShiftDown()) {
        sb.append("Shift+");
    }
    String text = sb.toString();
    if (text.equals("")) {
        return text;
    }
    return text.substring(0, text.length() - 1);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:22,代碼來源:OSFXUtils.java

示例2: checkModifier

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
private static String checkModifier(KeyEvent e) {
    String s = "";
    if (e.isShiftDown()) {
        s = "Shift";
    }
    if (e.isControlDown()) {
        s = "Ctrl";
    }
    if (e.isAltDown()) {
        s = "Alt";
    }
    if (e.isMetaDown()) {
        s = "Meta";
    }
    return s;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:17,代碼來源:EventQueueDeviceTest.java

示例3: buildModifiersText

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
private String buildModifiersText(KeyEvent e) {
    StringBuilder sb = new StringBuilder();
    if (e.isAltDown()) {
        sb.append("Alt+");
    }
    if (e.isControlDown()) {
        sb.append("Ctrl+");
    }
    if (e.isMetaDown()) {
        sb.append("Meta+");
    }
    if (e.isShiftDown()) {
        sb.append("Shift+");
    }
    if (sb.length() > 0) {
        sb.setLength(sb.length() - 1);
    }
    String mtext = sb.toString();
    return mtext;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:21,代碼來源:WSRecorder.java

示例4: onMessageBoxKeyPressed

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
@FXML
private void onMessageBoxKeyPressed(KeyEvent event) {
	if(KeyCode.ENTER.equals(event.getCode())) {
		if (((settings.getControlEnterToSendMessage() && event.isControlDown())
		 || (!settings.getControlEnterToSendMessage() && !event.isShiftDown()))
		 &&  !messageBox.getText().isEmpty()) {

			Room room = client.getSelectedRoom();
			if(room != null) {
				try {
					room.sendMessage(messageBox.getText());
				} catch(SdkException e) {
					System.out.printf("SdkException when trying to send a message: %s\n", e);
				}
			}
			messageBox.clear();
			event.consume();

		} else if(event.isShiftDown()) {
			messageBox.insertText(
					messageBox.getCaretPosition(),
					"\n"
			);
		}
	}
}
 
開發者ID:Gurgy,項目名稱:Cypher,代碼行數:27,代碼來源:ChatPresenter.java

示例5: recordRawKeyEvent

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
@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,代碼行數:41,代碼來源:WSRecorder.java

示例6: handle

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
@Override
public void handle(KeyEvent event) {

    TextField editor = comboBox.getEditor();
    String text = editor.getText();

    if (event.getCode() == KeyCode.RIGHT
            || event.getCode() == KeyCode.LEFT
            || event.isControlDown()
            || event.getCode() == KeyCode.HOME
            || event.getCode() == KeyCode.END
            || event.getCode() == KeyCode.TAB) {
        return;
    }
    else if(event.getCode() == KeyCode.UP) {
        caretPos = -1;
        moveCaret(text.length());
        return;
    }
    else if(event.getCode() == KeyCode.DOWN) {
        if(!comboBox.isShowing()) {
            comboBox.show();
        }
        caretPos = -1;
        moveCaret(text.length());
        return;
    }
    else if(event.getCode() == KeyCode.BACK_SPACE) {
        moveCaretToPos = true;
        caretPos = editor.getCaretPosition();
    }
    else if(event.getCode() == KeyCode.DELETE) {
        moveCaretToPos = true;
        caretPos = editor.getCaretPosition();
    }

    String upperCaseText = text.toUpperCase();
    ObservableList<T> list = FXCollections.observableArrayList(data.stream()
            .filter(s -> transform.apply(s).toUpperCase().startsWith(upperCaseText))
            .collect(Collectors.toList()));

    comboBox.setItems(list);

    if (event.getCode() == KeyCode.ENTER
            || event.getCode() == KeyCode.ESCAPE) {
        if (!list.isEmpty()) {
            comboBox.getEditor().setText(transform.apply(list.get(0)));
            comboBox.getSelectionModel().select(0);
            comboBox.hide();
        }
        else {
            comboBox.getEditor().setText(text);
        }

    }
    else {
        comboBox.getEditor().setText(text);
        if(!moveCaretToPos) {
            caretPos = -1;
        }
        moveCaret(text.length());
        if(!list.isEmpty()) {
            comboBox.show();
        }
    }

}
 
開發者ID:mbari-media-management,項目名稱:vars-annotation,代碼行數:68,代碼來源:AutoCompleteComboBoxListener.java

示例7: processKeyPressed

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
/**
 * Handle the key pressed event.
 *
 * @param event the event
 */
@FXThread
protected void processKeyPressed(@NotNull final KeyEvent event) {

    final KeyCode code = event.getCode();

    if (code == KeyCode.S && event.isControlDown() && isDirty()) {
        save();
    } else if (handleKeyActionImpl(code, true, event.isControlDown(), event.isShiftDown(), false)) {
        event.consume();
    }
}
 
開發者ID:JavaSaBr,項目名稱:jmonkeybuilder,代碼行數:17,代碼來源:AbstractFileEditor.java

示例8: handle

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
@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,代碼行數:43,代碼來源:TextAreaReadline.java

示例9: isModifiers

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
public static boolean isModifiers(KeyEvent e) {
    if (e.isAltDown() || e.isControlDown() || e.isMetaDown() || e.isShiftDown()) {
        return true;
    }
    return false;
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:7,代碼來源:OSFXUtils.java

示例10: getModifiers

import javafx.scene.input.KeyEvent; //導入方法依賴的package包/類
private boolean getModifiers(KeyEvent e) {
    return e.isAltDown() || e.isControlDown() || e.isMetaDown() || e.isShiftDown();
}
 
開發者ID:TypingDNA,項目名稱:TypingDnaRecorder-Java,代碼行數:4,代碼來源:Controller.java


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