Results 1 to 2 of 2
  1. #1
    SCCY is offline Member
    Join Date
    Aug 2010
    Posts
    1
    Rep Power
    0

    Default Displaying println output on GUI

    Hello all,

    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

    Thank you!

    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.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    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
    Replace console input with a text component to receive user input.

Similar Threads

  1. Println VS system.out.println
    By ccie007 in forum New To Java
    Replies: 2
    Last Post: 05-20-2010, 08:52 AM
  2. displaying a formatted output on a jTextField
    By techbossmb in forum AWT / Swing
    Replies: 1
    Last Post: 09-24-2009, 04:56 PM
  3. Java, output string, getting correct output? HELP!
    By computerboyo in forum New To Java
    Replies: 2
    Last Post: 02-25-2009, 11:44 PM
  4. difference between system.out.println() & out.println()
    By wickedrahul9 in forum Advanced Java
    Replies: 5
    Last Post: 10-18-2008, 11:06 PM
  5. No output displaying
    By Rgfirefly24 in forum New To Java
    Replies: 6
    Last Post: 04-27-2008, 08:37 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •