@Override
public void keyTyped(KeyEvent e) {
int ign = InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.META_DOWN_MASK;
if ((e.getModifiersEx() & ign) != 0)
return;
char c = e.getKeyChar();
if (c == '\n') {
stopEditing();
} else if (c != KeyEvent.CHAR_UNDEFINED && !Character.isISOControl(c)) {
if (pos < curText.length()) {
curText = curText.substring(0, pos) + c + curText.substring(pos);
} else {
curText += c;
}
++pos;
field.setText(curText);
}
}
TextFieldCaret.java 文件源码
java
阅读 29
收藏 0
点赞 0
评论 0
项目:Logisim
作者:
评论列表
文章目录