JTextArea textArea = new JTextArea("values: ")
for (int i=1; i<10; i++) {
  textArea.setText(textArea.getText() + " " + Integer.toString(i));
}

解决方案 »

  1.   

    阿猫说方法我试过了
    可以用的
    不过不知道append的方法具体细节,可以详细说说吗
    :)
      

  2.   

    appendpublic void append(String str)
    Appends the given text to the text area's current text.Parameters:str - the text to append.
    for (int i=1;i<10;i++){
       JTextArea textArea;
       textArea.append(i+"\n");//但是你知道的,它只显示最后一个数怎么样
      //让它把所有的数都显示出来
    }
      

  3.   

    感觉上那样写有点问题
    这样吧
    JTextArea jTextArea;for (int i=1;i<10;i++){
      jTextArea.append(i+"\n");//但是你知道的,它只显示最后一个数怎么样
      //让它把所有的数都显示出来
    }
      

  4.   

    Apocalypse(逍遥思辨) 的是正确的
    注意变量的作用域