I saw this code on this stackoverflow question at Create Java console inside a GUI panel
Whenever I compile the code though I get an error saying it can't find the symbol TextAreaOutputStream. I really want to have this work. I would really appreciate an explanation for why I can't compile this.
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class GUI{
public static void main( String [] args ) throws InterruptedException {
JFrame frame = new JFrame();
frame.add( new JLabel(" Outout" ), BorderLayout.NORTH );
JTextArea ta = new JTextArea();
TextAreaOutputStream taos = new TextAreaOutputStream( ta, 60 );
PrintStream ps = new PrintStream( taos );
System.setOut( ps );
System.setErr( ps );
frame.add( new JScrollPane( ta ) );
frame.pack();
frame.setVisible( true );
for( int i = 0 ; i < 100 ; i++ ) {
System.out.println( i );
Thread.sleep( 500 );
}
}
}