顺道看看这个帖子
http://community.csdn.net/Expert/topic/3402/3402601.xml?temp=.140011

解决方案 »

  1.   

    wo ye xiang zhi dao 
    ni zhi dao le gao shu wo 
    xie le 
    ha ha!!
      

  2.   

    String strTmp = txt.getText();
    String strValue = null;
    int intStart = txt.getSelectionStart();
    strValue = strTmp.substring(0, intStart);
    strValue += i + "";
    strValue += strTmp.substring(intStart);
    txt.setText(strValue);
    txt.setSelectionStart(intStart + 1);
    txt.setSelectionEnd(intStart + 1);
    i ++;
    txt.requestFocus();
      

  3.   

    在java中使用监视器(ActionListener),然后再用StringTokenizer来分析字符串就可以来实现你想要的功能了