你首先将JFrame frame 通过参数的形式传到你处理的类
假设你的frame下应该有
JEditorPane jEditorPane1=new JEditorPane();
然后你在需要
System.out.println("...");输出信息的地方换成
frame.jEditorPane1.setText(frame.jEditorPane1.getText()+"\n"+"....");

解决方案 »

  1.   

    呵呵,楼上这个办法稍微麻烦了一点。重新定向System.out输出流,因为System.out本身就是一个PrintStream输出流,使用其他的输出流包装这个输出流,然后定向到JEditorPane的显示里边。这样就可以了。
      

  2.   

    to mercury1231(非典时期的爱情) 
    我能把它包装起来,但我想不同怎么定向??
    请指教,谢谢。
      

  3.   

    JEditorPane有这个read的方法,动动脑筋,试一下吧。
    另外如果你的程序涉及到多线程的话,有可能会稍稍复杂一点,取决于具体的情况。
    还是你自己想吧:)有问题再大家讨论好了。
    read
    public void read(InputStream in,
                     Object desc)
              throws IOExceptionThis method initializes from a stream. If the kit is set to be of type HTMLEditorKit, and the desc parameter is an HTMLDocument, then it invokes the HTMLEditorKit to initiate the read. Otherwise it calls the superclass method which loads the model as plain text. Parameters:
    in - the stream from which to read
    desc - an object describing the stream 
    Throws: 
    IOException - as thrown by the stream being used to initialize
    See Also:
    JTextComponent.read(java.io.Reader, java.lang.Object), JTextComponent.setDocument(javax.swing.text.Document)
      

  4.   

    还有PipedInputStream/PipedOutputStream哦,这才发现好像这个办法不一定简单:)
    好处是你可以多了解点东西 :0