swing and binary trees

I'm working on a program for class where I have a binary tree that i coded myself. When I do a print on the binary tree it steps down the tree and prints all the nodes. When it gets to a node it prints that node.

The problem arises in my main class where I create my main frame and buttons used in the program. I'm trying to make it pop up a new window that prints the data contained in the tree. I was doing this previously to the command line with System.out.println().

Is there a way to find the mainframe, attach a frame to that and print out the courses their? Is there something comparable to the println for swing? I can provide more info if needed. Thanks.

[694 byte] By [tmauti1] at [2007-9-26 7:44:49]
# 1

Put a JTextArea instance into your frame. Then build up your output into a StringBuffer class (including \n chars). To put the contents of the string buffer into the frame, just do a myTextArea.setText( sBuff.toString() );

Use the StringBuffer so that you can easily dump it to the console with System.print() as well. Try not to tie the generation of some output so tightly with the output/display mechanism.

gweedo at 2007-7-1 17:52:19 > top of Java-index,Archived Forums,Swing...