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