本文整理汇总了Java中java.awt.event.KeyEvent.isMetaDown方法的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.isMetaDown方法的具体用法?Java KeyEvent.isMetaDown怎么用?Java KeyEvent.isMetaDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.isMetaDown方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyReleased
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyReleased(KeyEvent event) {
if (event.isControlDown() || event.isMetaDown()) {
switch (event.getKeyCode()) {
case KeyEvent.VK_C:
// Copy
cancelEditing();
XTableUtils.copyToClipboard(table, false);
break;
case KeyEvent.VK_X:
// Cut
cancelEditing();
XTableUtils.copyToClipboard(table, true);
break;
case KeyEvent.VK_V:
// Paste
cancelEditing();
XTableUtils.pasteFromClipboard(table);
break;
default:
break;
}
}
}
示例2: keyPressed
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyEvent e) {
if (e.isAltDown() || e.isAltGraphDown() ||
e.isControlDown() || e.isMetaDown() ||
e.isShiftDown()) {
setSelectCursor();
}
}
示例3: keyReleased
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyReleased(KeyEvent e) {
if (!(e.isAltDown() || e.isAltGraphDown() ||
e.isControlDown() || e.isMetaDown() ||
e.isShiftDown())) {
unsetSelectCursor();
}
}
示例4: recordRawKeyEvent
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
@Override public void recordRawKeyEvent(RComponent r, KeyEvent e) {
JSONObject event = new JSONObject();
event.put("type", "key_raw");
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_META || keyCode == KeyEvent.VK_SHIFT || keyCode == KeyEvent.VK_ALT
|| keyCode == KeyEvent.VK_CONTROL) {
return;
}
if ((e.isActionKey() || e.isControlDown() || e.isMetaDown() || e.isAltDown()) && e.getID() == KeyEvent.KEY_PRESSED) {
String mtext = buildModifiersText(e);
event.put("modifiersEx", mtext);
KeysMap keysMap = KeysMap.findMap(e.getKeyCode());
if (keysMap == KeysMap.NULL) {
return;
}
String keyText;
if (keysMap == null) {
keyText = KeyEvent.getKeyText(e.getKeyCode());
} else {
keyText = keysMap.toString();
}
event.put("keyCode", keyText);
} else if (e.getID() == KeyEvent.KEY_TYPED && !e.isControlDown()) {
if (Character.isISOControl(e.getKeyChar()) && hasMapping(e.getKeyChar())) {
event.put("keyChar", getMapping(e.getKeyChar()));
} else {
event.put("keyChar", "" + e.getKeyChar());
}
} else {
return;
}
recordEvent(r, event);
}
示例5: keyPressed
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyPressed(KeyEvent e) {
// Windows: CTRL-S (e.isControlDown())
// MacOS: CTRL-S (e.isMetaDown())
if ((e.isControlDown() || e.isMetaDown()) && e.getKeyCode() == KeyEvent.VK_S) {
File f = selectFile();
if (f != null) {
saveTo(f);
}
}
}
示例6: keyPressed
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public void keyPressed(final KeyEvent e) {
if (!e.isMetaDown()) {
this.screen = this.screen.respondToUserInput(e, null);
this.repaint();
}
}
示例7: isSave
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
private static boolean isSave(KeyEvent ke) {
return (ke.isMetaDown() || ke.isControlDown()) && ke.getKeyCode() == KeyEvent.VK_S;
}
示例8: isControlOrMetaDown
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
/**
* Returns whether or not the control modifier is down during the event. This takes the OS into
* account, so on Mac it will check if the meta modifier is down during the event.
*
* @param e
* the event
* @return {@code true} if the control modifier is down on Windows/Linux or the meta modifier is
* down on Mac; {@code false} otherwise
*/
public static boolean isControlOrMetaDown(KeyEvent e) {
if (!IS_MAC) {
return e.isControlDown();
} else {
return e.isMetaDown();
}
}