Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Reading the contents of JTextArea

  Asked By: Kenneth    Date: Feb 21    Category: Java    Views: 1111
  

I know that you can I assign a DocumentListener and an ActionListener
to a JTextArea.

I know there are standard methods that must be defined when you
implement document listener.

I want to be able to make a scrollable panel that has a large text
area that I can redirect STDOUT and STDERR and read text typed into
this JPanel.

I saw an example that used PipedStreams for STDOUT and STDERR and
made them threads but it has to be an easier way to "print" those
streams to a JPanel without making them PipedStreams.

Any suggestions?

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Alan Palmer     Answered On: Feb 21

Go to:

cvs.sourceforge.net/.../anthonyed\
en/lib/io/JTextAreaWriter.java?rev=1.4&content-type=text/vnd.viewcvs-markup

for an example  of a class which implements a Writer where all data sent to the
writer gets inserted into a JTextArea. You could apply the concepts within to
create a PrintStream instead and then use System.setOut() and System.setErr() to
force it to use your PrintStream instead.

Is this what you want or did I misunderstand your question?

 
Answer #2    Answered By: Guadalupe Rogers     Answered On: Feb 21

No thats what I want to do but I want all streams STDOUT, STDERR and
STDIN.

I know the first two are easily done.

The last is the tricky one.

I will go to the link you gave me and check it out.

 
Answer #3    Answered By: Gustavo Taylor     Answered On: Feb 21

As far as I know there is no easy way that I know of to read  STDIN and have the
data written to the JTextArea other than with PipedStreams.

 
Didn't find what you were looking for? Find more on Reading the contents of JTextArea Or get search suggestion and latest updates.




Tagged: