本文整理匯總了Java中com.badlogic.gdx.Input.Keys.COLON屬性的典型用法代碼示例。如果您正苦於以下問題:Java Keys.COLON屬性的具體用法?Java Keys.COLON怎麽用?Java Keys.COLON使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類com.badlogic.gdx.Input.Keys
的用法示例。
在下文中一共展示了Keys.COLON屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: keyPressed
@Override
public void keyPressed(int key)
{
// if this input box is NOT selected, just do nothing
if (!_selected || !_state) return;
switch (key)
{
case Keys.RIGHT:
++_curserPos;
_curserPos %= (_text.length() + 1);
break;
case Keys.LEFT:
_curserPos--;
if (_curserPos < 0) _curserPos = _text.length();
break;
case Keys.SHIFT_LEFT:
case Keys.SHIFT_RIGHT:
_shift = true;
break;
case Keys.SPACE:
charTyped(' ');
break;
case Keys.PERIOD:
charTyped('.');
break;
case Keys.COMMA:
charTyped(',');
break;
case Keys.SEMICOLON:
charTyped(';');
break;
case Keys.COLON:
charTyped(':');
break;
case Keys.MINUS:
charTyped('-');
break;
case Keys.BACKSPACE:
if (_curserPos > 0)
{
_text = _text.substring(0, _curserPos - 1) + _text.substring(_curserPos, _text.length());
_curserPos--;
}
break;
case Keys.ENTER:
case Keys.ESCAPE:
METRO.__setSelectedInput(null);
break;
}
// for ranges:
if (key >= Keys.A && key <= Keys.Z)
{
charTyped(_shift ? (char) (36 + key) : (char) (68 + key));
}
else if (key >= Keys.NUM_0 && key <= Keys.NUM_9)
{
charTyped((char) (key + 41));
}
// if length of string in pixel is greater than the width of the field, delete last added character
if (Draw.getStringSize(_text).width > _area.width)
{
_text = _text.substring(0, _curserPos - 1) + _text.substring(_curserPos, _text.length());
_curserPos--;
}
}