LWUIT使得TextField也能够在触屏手机下点击时出现输入编辑
解决方法:
在TextField源码上 加上editString();函数:
public void pointerReleased(int x, int y) {
// unlike text area the text field supports shifting the cursor with the touch screen
editString();
String text = getText();
int textLength = text.length();
int position = 0;
Font f = getStyle().getFont();
x -= getAbsoluteX();
for(int iter = 0 ; iter < textLength ; iter++) {
int width = f.substringWidth(text, 0, iter);
if(x > width) {
position = iter;
} else {
break;
}
}
if(position == textLength - 1) {
if(f.stringWidth(text) < x) {
position = textLength;
}
}
setCursorPosition(position);
repaint();
}
或者官方的解决方法:http://forums.java.net/jive/thread.jspa?threadID=52716