Results 1 to 2 of 2
Thread: Displaying println output on GUI
- 08-09-2010, 05:57 AM #1Member
- Join Date
- Aug 2010
- Rep Power
Displaying println output on GUI
I am a Java newbie. I have been writing some mini programs for personal use, although they are all command line / console apps. I have one completed program which I really want to add in GUI.
The problem is, I have used many System.out.println / System.err.println throughout the program. If I am adding in GUI elements, say a text box, how can I catch all output to console and stuff them into this text box? The last thing I want to do is go through each println and change it to a GUI-relevant line. :(
Please bare in mind I am a newbie, I would appreciate if someone can break it down and explain it down to newbie level. Some sample code would be nice. :D
P.S. There is another slightly off-topic question. It would be great if someone can give me some hints on that too. What's the quickest and simplest way to add in Swing into a command-line program and transform it to a GUI? I am in the process of doing so, but I think I am not going very far. I am taking too long and experiencing many problems here and there. I guess I have started off in the wrong direction.
- 08-09-2010, 01:34 PM #2
Look at the System setOut method. It will allow you to change System.out to another class. You could create you own class and have it put what was output by println() into a GUI component.
way to add in Swing into a command-line program and transform it to a GUI
- By ccie007 in forum New To JavaReplies: 2Last Post: 05-20-2010, 08:52 AM
- By techbossmb in forum AWT / SwingReplies: 1Last Post: 09-24-2009, 04:56 PM
- By computerboyo in forum New To JavaReplies: 2Last Post: 02-25-2009, 11:44 PM
- By wickedrahul9 in forum Advanced JavaReplies: 5Last Post: 10-18-2008, 11:06 PM
- By Rgfirefly24 in forum New To JavaReplies: 6Last Post: 04-27-2008, 08:37 PM