当前位置: 首页>>代码示例>>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;未经允许,请勿转载。