http://java.sun.com/j2se/1.3.0/docs/api/javax/swing/text/class-use/Document.html

解决方案 »

  1.   

    JTextArea ta = new JTextArea();
        EditorKit kit = new DefaultEditorKit();
        Document doc = ta.getDocument();
        Reader reader = new FileReader(filename);
        kit.read(reader, doc, 0);
      

  2.   

    JTextArea本身有getDocument
    public Document getDocument()
    Fetches the model associated with the editor. This is primarily for the UI to get at the minimal amount of state required to be a text editor. Subclasses will return the actual type of the model which will typically be something that extends Document. Returns:
    the model
      

  3.   

    http://java.sun.com/docs/books/tutorial/uiswing/components/simpletext.html#textarea
      

  4.   

    JTextArea继承了javax.swing.JTextComponent的geDocument()
    和setDocumetn(Document doc)方法,可以用这两个方法。
      

  5.   

    我还不是太明白你的意思,我想说得是JTextArea和Document已经关联了(用的getDocument方法),但是不通过JTextArea可不可以改变Document的内容,由于Document的内容改变了,而使JTextArea的内容也改变?
      

  6.   

    安装个java web start 看看里面的例子 swing ui demos , 有源代码。