本文整理了Java中java.awt.event.KeyEvent.getKeyLocation()
方法的一些代码示例,展示了KeyEvent.getKeyLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。KeyEvent.getKeyLocation()
方法的具体详情如下:
包路径:java.awt.event.KeyEvent
类名称:KeyEvent
方法名:getKeyLocation
暂无
代码示例来源:origin: apache/cloudstack
return (sh) ? '{' : ']';
case KeyEvent.VK_ENTER:
switch (order.event.getKeyLocation()) {
default:
case KeyEvent.KEY_LOCATION_STANDARD:
switch (order.event.getKeyLocation()) {
default:
case KeyEvent.KEY_LOCATION_LEFT:
switch (order.event.getKeyLocation()) {
default:
case KeyEvent.KEY_LOCATION_LEFT:
switch (order.event.getKeyLocation()) {
default:
case KeyEvent.KEY_LOCATION_LEFT:
switch (order.event.getKeyLocation()) {
default:
case KeyEvent.KEY_LOCATION_LEFT:
switch (order.event.getKeyLocation()) {
default:
case KeyEvent.KEY_LOCATION_LEFT:
switch (order.event.getKeyLocation()) {
default:
case KeyEvent.KEY_LOCATION_LEFT:
代码示例来源:origin: apache/cloudstack
return 27;
case KeyEvent.VK_ENTER:
switch (event.getKeyLocation()) {
default:
case KeyEvent.KEY_LOCATION_STANDARD:
switch (event.getKeyLocation()) {
default:
case KeyEvent.KEY_LOCATION_LEFT:
switch (event.getKeyLocation()) {
default:
case KeyEvent.KEY_LOCATION_LEFT:
switch (event.getKeyLocation()) {
default:
case KeyEvent.KEY_LOCATION_LEFT:
switch (event.getKeyLocation()) {
default:
case KeyEvent.KEY_LOCATION_LEFT:
代码示例来源:origin: org.netbeans.api/org-netbeans-api-visual
/**
* @see KeyEvent
*/
public int getKeyLocation() {
return event.getKeyLocation();
}
代码示例来源:origin: in.jlibs/org-netbeans-api-visual
/**
* @see KeyEvent
*/
public int getKeyLocation() {
return event.getKeyLocation();
}
代码示例来源:origin: stackoverflow.com
KeyboardFocusManager.setCurrentKeyboardFocusManager(new DefaultKeyboardFocusManager(){
public boolean dispatchKeyEvent(KeyEvent e) {
if (e.getKeyLocation() == KeyEvent.KEY_LOCATION_NUMPAD){
return true;
}
return super.dispatchKeyEvent(e);
}
});
代码示例来源:origin: com.harium.etyl/etyl
private int getKeyFromEvent(java.awt.event.KeyEvent ke) {
int code = ke.getKeyCode();
if (ke.getKeyLocation() != java.awt.event.KeyEvent.KEY_LOCATION_STANDARD) {
code += ke.getKeyLocation() * 100;
}
return code;
}
代码示例来源:origin: com.harium/etyl
private int getKeyFromEvent(java.awt.event.KeyEvent ke) {
int code = ke.getKeyCode();
if (ke.getKeyLocation() != java.awt.event.KeyEvent.KEY_LOCATION_STANDARD) {
code += ke.getKeyLocation()*100;
}
return code;
}
代码示例来源:origin: stackoverflow.com
@Override
public boolean dispatchKeyEvent(KeyEvent keyEvent) {
if (keyEvent.getKeyLocation() == KeyEvent.KEY_LOCATION_NUMPAD) {
keyEvent.consume();
return true;
}
}
代码示例来源:origin: org.piccolo2d/piccolo2d-core
/**
* Returns the location on the keyboard from which the key stroke
* originated.
*
* @return location on keyboard from which stroke originated.
*/
public int getKeyLocation() {
if (isKeyEvent()) {
final KeyEvent e = (KeyEvent) inputEvent;
return e.getKeyLocation();
}
throw new IllegalStateException("Can't get keylocation from mouse event");
}
代码示例来源:origin: nifty-gui/nifty-gui
private void handleKeyEvent(@Nonnull KeyEvent e, boolean isKeyDown) {
int newKeyCode = keyCodeConverter.convertToNiftyKeyCode(e.getKeyCode(), e.getKeyLocation());
keyboardEvents.add(new KeyboardInputEvent(newKeyCode, e
.getKeyChar(), isKeyDown, e.isShiftDown(), e.isControlDown()));
}
代码示例来源:origin: com.github.nifty-gui/nifty-java2d-renderer
private void handleKeyEvent(@Nonnull KeyEvent e, boolean isKeyDown) {
int newKeyCode = keyCodeConverter.convertToNiftyKeyCode(e.getKeyCode(), e.getKeyLocation());
keyboardEvents.add(new KeyboardInputEvent(newKeyCode, e
.getKeyChar(), isKeyDown, e.isShiftDown(), e.isControlDown()));
}
代码示例来源:origin: robo-code/robocode
public static KeyEvent cloneKeyEvent(final KeyEvent e) {
return new KeyEvent(SafeComponent.getSafeEventComponent(), e.getID(), e.getWhen(), e.getModifiersEx(),
e.getKeyCode(), e.getKeyChar(), e.getKeyLocation());
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib
/** Has to be called from AWT event thread to be properly synchronized */
public void stopBlocking() {
this.component.removeKeyListener(this);
KeyboardFocusManager kfm = KeyboardFocusManager.getCurrentKeyboardFocusManager();
while(!blockedEvents.isEmpty()) {
KeyEvent e = (KeyEvent)blockedEvents.removeFirst();
e = new KeyEvent((Component)e.getSource(), e.getID(), e.getWhen(), e.getModifiers(), e.getKeyCode(), e.getKeyChar(), e.getKeyLocation());
kfm.dispatchEvent(e);
}
}
代码示例来源:origin: com.threerings/nenya
public void windowLostFocus (WindowEvent e)
{
// un-press any keys that were left down
if (!_downKeys.isEmpty()) {
long now = System.currentTimeMillis();
for (KeyEvent down : _downKeys.values()) {
KeyEvent up = new KeyEvent(
down.getComponent(), KeyEvent.KEY_RELEASED, now,
down.getModifiers(), down.getKeyCode(), down.getKeyChar(),
down.getKeyLocation());
for (int ii = 0, nn = _listeners.size(); ii < nn; ii++) {
_listeners.get(ii).keyReleased(up);
}
}
_downKeys.clear();
}
}
代码示例来源:origin: nativelibs4java/JNAerator
@Override
public void processKeyEvent(KeyEvent evt) {
if (SystemUtils.isMacOSX()) {
int m = evt.getModifiers();
if ((m & InputEvent.META_MASK) != 0) {
m = (m & ~InputEvent.META_MASK) | InputEvent.CTRL_MASK;
evt = new KeyEvent(evt.getComponent(), evt.getID(), evt.getWhen(), m, evt.getKeyCode(), evt.getKeyChar(), evt.getKeyLocation());
if (evt.getID() == KeyEvent.KEY_TYPED) {
return;
}
}
}
super.processKeyEvent(evt);
}
代码示例来源:origin: com.nativelibs4java/jnaerator
@Override
public void processKeyEvent(KeyEvent evt) {
if (SystemUtils.isMacOSX()) {
int m = evt.getModifiers();
if ((m & InputEvent.META_MASK) != 0) {
m = (m & ~InputEvent.META_MASK) | InputEvent.CTRL_MASK;
evt = new KeyEvent(evt.getComponent(), evt.getID(), evt.getWhen(), m, evt.getKeyCode(), evt.getKeyChar(), evt.getKeyLocation());
if (evt.getID() == KeyEvent.KEY_TYPED) {
return;
}
}
}
super.processKeyEvent(evt);
}
代码示例来源:origin: nativelibs4java/JavaCL
@Override
public void processKeyEvent(KeyEvent evt) {
if (isMac()) {
int m = evt.getModifiers();
if ((m & InputEvent.META_MASK) != 0) {
m = (m & ~InputEvent.META_MASK) | InputEvent.CTRL_MASK;
evt = new KeyEvent(evt.getComponent(), evt.getID(), evt.getWhen(), m, evt.getKeyCode(), evt.getKeyChar(), evt.getKeyLocation());
if (evt.getID() == KeyEvent.KEY_TYPED)
return;
}
}
super.processKeyEvent(evt);
}
@Override
代码示例来源:origin: robo-code/robocode
public void serialize(RbSerializer serializer, ByteBuffer buffer, Object object) {
KeyPressedEvent obj = (KeyPressedEvent) object;
java.awt.event.KeyEvent src = obj.getSourceEvent();
serializer.serialize(buffer, src.getKeyChar());
serializer.serialize(buffer, src.getKeyCode());
serializer.serialize(buffer, src.getKeyLocation());
serializer.serialize(buffer, src.getID());
serializer.serialize(buffer, src.getModifiersEx());
serializer.serialize(buffer, src.getWhen());
}
代码示例来源:origin: robo-code/robocode
public void serialize(RbSerializer serializer, ByteBuffer buffer, Object object) {
KeyTypedEvent obj = (KeyTypedEvent) object;
java.awt.event.KeyEvent src = obj.getSourceEvent();
serializer.serialize(buffer, src.getKeyChar());
serializer.serialize(buffer, src.getKeyCode());
serializer.serialize(buffer, src.getKeyLocation());
serializer.serialize(buffer, src.getID());
serializer.serialize(buffer, src.getModifiersEx());
serializer.serialize(buffer, src.getWhen());
}
代码示例来源:origin: robo-code/robocode
public void serialize(RbSerializer serializer, ByteBuffer buffer, Object object) {
KeyReleasedEvent obj = (KeyReleasedEvent) object;
java.awt.event.KeyEvent src = obj.getSourceEvent();
serializer.serialize(buffer, src.getKeyChar());
serializer.serialize(buffer, src.getKeyCode());
serializer.serialize(buffer, src.getKeyLocation());
serializer.serialize(buffer, src.getID());
serializer.serialize(buffer, src.getModifiersEx());
serializer.serialize(buffer, src.getWhen());
}
内容来源于网络,如有侵权,请联系作者删除!