本文整理汇总了Java中javafx.scene.input.KeyEvent.isShiftDown方法的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.isShiftDown方法的具体用法?Java KeyEvent.isShiftDown怎么用?Java KeyEvent.isShiftDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.input.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.isShiftDown方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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;
}
示例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;
}
示例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"
);
}
}
}
示例5: addHotkey
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
private static boolean addHotkey(KeyEvent event, String function) {
String keyCombString = "";
boolean modified = false;
if (event.isShiftDown()) {
modified = true;
keyCombString += "Shift+";
}
if (event.isAltDown()) {
modified = true;
keyCombString += "Alt+";
}
if (event.isShortcutDown()) {
modified = true;
keyCombString += "Shortcut+";
}
keyCombString += event.getCode().getName();
if (!event.getCode().isModifierKey() && modified) {
hotkeys.get(function).setHotkey(keyCombString);
try {
saveHotkeys();
} catch (ConfigurationException e) {
e.printStackTrace();
}
return true;
}
return false;
}
示例6: 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;
}
}
示例7: 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;
}
示例8: getModifiers
import javafx.scene.input.KeyEvent; //导入方法依赖的package包/类
private boolean getModifiers(KeyEvent e) {
return e.isAltDown() || e.isControlDown() || e.isMetaDown() || e.isShiftDown();
}