当前位置: 首页>>代码示例>>Java>>正文


Java KeyInputEvent.setConsumed方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:InputSystemJme.java

示例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
        }
    }
}
 
开发者ID:jMonkeyEngine-Contributions,项目名称:Lemur,代码行数:23,代码来源:TextEntryComponent.java

示例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;
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:12,代码来源:TextField.java

示例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();
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:8,代码来源:GUIExplorerAppState.java

示例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();
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:14,代码来源:TextField.java

示例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();
    }
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:16,代码来源:Table.java

示例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;
    });
}
 
开发者ID:TripleSnail,项目名称:Arkhados,代码行数:34,代码来源:KeySetter.java

示例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();
		}
	}
}
 
开发者ID:rockfireredmoon,项目名称:icetone,代码行数:47,代码来源:BaseScreen.java

示例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();
    }
}
 
开发者ID:meltzow,项目名称:tonegodgui,代码行数:60,代码来源:Table.java


注:本文中的com.jme3.input.event.KeyInputEvent.setConsumed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。