Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » bind system.out stream to SWT text widget
bind system.out stream to SWT text widget [message #454473] Thu, 21 April 2005 13:38 Go to next message
Eclipse UserFriend
Hi,
I'm trying to figure out how I can bind the system.out stream to a swt
text widget. I've figured out that I can use System.setOut() to redirect
the stream. But now I'm stuck at trying to get it connected to a text
widget. Does anyone have any hints or code examples?!
Re: bind system.out stream to SWT text widget [message #454474 is a reply to message #454473] Thu, 21 April 2005 13:54 Go to previous messageGo to next message
Eclipse UserFriend
Eclipse does this kind of thing when you launch Java applications, so
you could poke around in the JDT plugins.

Charlie


Duncan Krebs wrote:

> Hi,
> I'm trying to figure out how I can bind the system.out stream to a swt
> text widget. I've figured out that I can use System.setOut() to redirect
> the stream. But now I'm stuck at trying to get it connected to a text
> widget. Does anyone have any hints or code examples?!
>
Re: bind system.out stream to SWT text widget [message #454477 is a reply to message #454474] Thu, 21 April 2005 17:47 Go to previous messageGo to next message
Eclipse UserFriend
Charlie thanks for the idea. I figured out it involves using PipedStreams
and multiple threads.
Re: bind system.out stream to SWT text widget [message #1844167 is a reply to message #454477] Fri, 03 September 2021 16:24 Go to previous messageGo to next message
Eclipse UserFriend
Is it possible to describe or share code for how you achieved this ?
Re: bind system.out stream to SWT text widget [message #1844245 is a reply to message #1844167] Tue, 07 September 2021 01:42 Go to previous message
Eclipse UserFriend
This is very easy to do!

First extend PrintStream as follows;

public class YourPrintStream extends PrintStream {

and implement the following methods inside this class to display your message on your SWT widget. That is, implement write() to display on your widget.

public void write(int b) {
public void write(byte[] buf, int off, int len) {
public void close() {

Finally in the beginning, instantiate this extended class and set for out and err as follows;

YourPrintStream f3 = new YourPrintStream(,,,);
System.setOut(f3);
System.setErr(f3);
Previous Topic:Breaking Change in GTK-API for x86_64 (v3.116.100) ?
Next Topic:Enable finish button on "Export" wizard
Goto Forum:
  


Current Time: Fri Aug 29 20:04:56 EDT 2025

Powered by FUDForum. Page generated in 0.03709 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top