Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 17:38 Go to next message
Duncan Krebs is currently offline Duncan KrebsFriend
Messages: 79
Registered: July 2009
Member
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 17:54 Go to previous messageGo to next message
Charlie Surface is currently offline Charlie SurfaceFriend
Messages: 40
Registered: July 2009
Member
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 21:47 Go to previous messageGo to next message
Duncan Krebs is currently offline Duncan KrebsFriend
Messages: 79
Registered: July 2009
Member
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 20:24 Go to previous messageGo to next message
Gerry Matte is currently offline Gerry MatteFriend
Messages: 11
Registered: March 2014
Location: Nanaimo, BC, Canada
Junior Member
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 05:42 Go to previous message
Martin J is currently offline Martin JFriend
Messages: 50
Registered: August 2015
Member
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: Sat Dec 07 18:11:36 GMT 2024

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

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

Back to the top