请问是否使用getText()来取得?如果是,那么是在监听器中才能获取还是在其他什么地方可以获取?谢谢。

解决方案 »

  1.   

    JTextArea ta = new JTextArea();这样任何时候调用ta.getText()就能获取ta里面当前的数据
      

  2.   

    但我却无论如何也得不到。不知道为什么。我的代码是: JTextArea textArea=new JTextArea();String shell = textArea.getText();但是shell得不到这个值。
      

  3.   

    你的 textArea 里面没有值吧
      

  4.   

    www.source520.com     免费免注册80G源码书籍下载
      

  5.   

    import java.io.*;
    public class test { public static void main(String[] args) throws IOException {

    BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
    System.out.println(stdin.readLine());
    }

    }