本文整理汇总了Java中com.jme3.input.event.KeyInputEvent.setConsumed方法的典型用法代码示例。如果您正苦于以下问题:Java KeyInputEvent.setConsumed方法的具体用法?Java KeyInputEvent.setConsumed怎么用?Java KeyInputEvent.setConsumed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jme3.input.event.KeyInputEvent
的用法示例。
在下文中一共展示了KeyInputEvent.setConsumed方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onKeyEventQueued
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
private void onKeyEventQueued(KeyInputEvent evt, NiftyInputConsumer nic) {
int code = evt.getKeyCode();
if (code == KeyInput.KEY_LSHIFT || code == KeyInput.KEY_RSHIFT) {
shiftDown = evt.isPressed();
} else if (code == KeyInput.KEY_LCONTROL || code == KeyInput.KEY_RCONTROL) {
ctrlDown = evt.isPressed();
}
KeyboardInputEvent keyEvt = new KeyboardInputEvent(code,
evt.getKeyChar(),
evt.isPressed(),
shiftDown,
ctrlDown);
if (nic.processKeyboardEvent(keyEvt)){
evt.setConsumed();
}
}
示例2: onKeyEvent
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void onKeyEvent( KeyInputEvent evt ) {
ModifiedKeyInputEvent mEvt = (ModifiedKeyInputEvent)evt;
if( mEvt.isPressed() ) {
KeyAction key = mEvt.toKeyAction(); //new KeyAction(code, (control?KeyAction.CONTROL_DOWN:0), (shift?KeyAction.SHIFT_DOWN:0) );
KeyActionListener handler = actionMap.get(key);
if( handler != null ) {
handler.keyAction(TextEntryComponent.this, key);
evt.setConsumed();
return;
}
// Making sure that no matter what, certain
// characters never make it directly to the
// document
if( evt.getKeyChar() >= 32 ) {
model.insert(evt.getKeyChar());
evt.setConsumed();
//resetText(); ...should be automatic now
}
}
}
示例3: onKeyRelease
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
public void onKeyRelease(KeyInputEvent evt) {
switch (evt.getKeyCode()) {
case KeyInput.KEY_ESCAPE:
case KeyInput.KEY_RETURN:
case KeyInput.KEY_TAB:
break;
default:
evt.setConsumed();
break;
}
}
示例4: onKeyEvent
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void onKeyEvent(KeyInputEvent evt) {
if (evt.getKeyCode() == KeyInput.KEY_ESCAPE && evt.isReleased()) {
endPick();
evt.setConsumed();
}
}
示例5: onKeyRelease
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void onKeyRelease(KeyInputEvent evt) {
if (evt.getKeyCode() == KeyInput.KEY_LCONTROL || evt.getKeyCode() == KeyInput.KEY_RCONTROL) {
ctrl = false;
} else if (evt.getKeyCode() == KeyInput.KEY_LSHIFT || evt.getKeyCode() == KeyInput.KEY_RSHIFT) {
shift = false;
} else if (evt.getKeyCode() == KeyInput.KEY_LMENU || evt.getKeyCode() == KeyInput.KEY_RMENU) {
alt = false;
} else if (evt.getKeyCode() == KeyInput.KEY_LMETA || evt.getKeyCode() == KeyInput.KEY_RMETA) {
meta = false;
}
evt.setConsumed();
}
示例6: onKeyPress
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void onKeyPress(KeyInputEvent evt) {
if (enableKeyboardNavigation) {
if (selectionMode.equals(SelectionMode.NONE)) {
return;
}
if (evt.getKeyCode() == KeyInput.KEY_LCONTROL || evt.getKeyCode() == KeyInput.KEY_RCONTROL) {
ctrl = true;
} else if (evt.getKeyCode() == KeyInput.KEY_LSHIFT || evt.getKeyCode() == KeyInput.KEY_RSHIFT) {
shift = true;
}
evt.setConsumed();
}
}
示例7: onKeyEvent
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void onKeyEvent(KeyInputEvent evt) {
if (currentInputName == null || currentKeyButton == null) {
return;
}
if (evt.getKeyCode() == KeyInput.KEY_ESCAPE) {
evt.setConsumed();
return;
}
inputManager.removeRawInputListener(this);
KeyTrigger trigger = new KeyTrigger(evt.getKeyCode());
inputManager.deleteMapping(currentInputName);
inputManager.addMapping(currentInputName, trigger);
inputSettings.saveInput(currentInputName, trigger);
try {
app.getContext().getSettings().save(ClientMain.PREFERENCES_KEY);
} catch (BackingStoreException ex) {
Logger.getLogger(KeySetter.class.getName())
.log(Level.WARNING, "Failed to save settings", ex);
}
final String keyChar =
Character.toString(evt.getKeyChar()).toUpperCase();
evt.setConsumed();
app.enqueue(() -> {
currentKeyButton.setText(keyChar);
currentKeyButton = null;
currentInputName = null;
return null;
});
}
示例8: onKeyEvent
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void onKeyEvent(KeyInputEvent evt) {
if (evt.getKeyCode() == KeyInput.KEY_LSHIFT || evt.getKeyCode() == KeyInput.KEY_RSHIFT) {
if (evt.isPressed())
keyboardModifiers |= KeyboardUIEvent.SHIFT_MASK;
else
keyboardModifiers &= ~KeyboardUIEvent.SHIFT_MASK;
}
if (evt.getKeyCode() == KeyInput.KEY_LCONTROL || evt.getKeyCode() == KeyInput.KEY_RCONTROL) {
if (evt.isPressed())
keyboardModifiers |= KeyboardUIEvent.CTRL_MASK;
else
keyboardModifiers &= ~KeyboardUIEvent.CTRL_MASK;
}
if (evt.getKeyCode() == KeyInput.KEY_LMENU || evt.getKeyCode() == KeyInput.KEY_RMENU) {
if (evt.isPressed())
keyboardModifiers |= KeyboardUIEvent.ALT_MASK;
else
keyboardModifiers &= ~KeyboardUIEvent.ALT_MASK;
}
if (keyboardFocus != null) {
if (keyboardFocus.getParent() != null && keyboardFocus.isVisible()) {
KeyboardUIEvent kevt = new KeyboardUIEvent(evt, keyboardModifiers, keyboardFocus);
keyboardFocus.keyEvent(kevt);
if (kevt.isConsumed()) {
evt.setConsumed();
return;
}
}
if (evt.getKeyCode() == KeyInput.KEY_ESCAPE) {
resetKeyboardFocus(null);
evt.setConsumed();
}
}
if (evt.getKeyCode() == KeyInput.KEY_TAB && evt.isPressed()) {
if (focusForm != null) {
if ((keyboardModifiers & KeyboardUIEvent.SHIFT_MASK) == 0)
focusForm.tabNext();
else
focusForm.tabPrev();
}
}
}
示例9: onKeyRelease
import com.jme3.input.event.KeyInputEvent; //导入方法依赖的package包/类
@Override
public void onKeyRelease(KeyInputEvent evt) {
if (enableKeyboardNavigation) {
if (selectionMode.equals(SelectionMode.NONE)) {
return;
}
int newRow = -1;
if (evt.getKeyCode() == KeyInput.KEY_LCONTROL || evt.getKeyCode() == KeyInput.KEY_RCONTROL) {
ctrl = false;
} else if (evt.getKeyCode() == KeyInput.KEY_LSHIFT || evt.getKeyCode() == KeyInput.KEY_RSHIFT) {
shift = false;
} else if (evt.getKeyCode() == KeyInput.KEY_SPACE) {
if (!selectionMode.equals(SelectionMode.NONE)) {
List<TableRow> selRows = getSelectedRows();
if (!selRows.isEmpty()) {
selRows.get(0).setExpanded(!selRows.get(0).isExpanded());
}
}
} else if (evt.getKeyCode() == KeyInput.KEY_A && ctrl && selectionMode.isEnabled()) {
selectAll();
} else {
if (evt.getKeyCode() == KeyInput.KEY_LEFT) {
newRow = selectLeft(evt);
} else if (evt.getKeyCode() == KeyInput.KEY_RIGHT) {
newRow = selectRight(evt);
} else if (evt.getKeyCode() == KeyInput.KEY_DOWN) {
newRow = selectDown(evt);
} else if (evt.getKeyCode() == KeyInput.KEY_UP) {
newRow = selectUp(evt);
}
if (newRow == -1) {
// Return now se we don't consume
return;
}
}
final List<TableRow> allRows = getAllRows();
// If new row is selected, scroll to it
if (newRow >= 0 && newRow < allRows.size()) {
TableRow row = allRows.get(newRow);
final float scrolledAmount = getScrolledAmount();
final float viewPortHeight = getViewPortSize().y;
final float maxY = scrolledAmount + viewPortHeight;
final float rowY = getScrollableHeight() - row.getY() - row.getHeight() - (headersVisible ? headerHeight : 0) + tablePadding;
final float rowBottom = rowY + row.getHeight();
if (rowBottom >= maxY) {
scrollYBy(rowBottom - maxY);
setScrollThumb();
} else if (rowY < scrolledAmount) {
scrollYBy(rowY - scrolledAmount);
setScrollThumb();
}
}
evt.setConsumed();
}
}