Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

"Console" widget using pure SWT?

Thread view: 
Steve - 01 Feb 2006 18:54 GMT
    I'm building a small GUI front-end for a command-line utility.  I
need the front-end to run the command-line utility in a background
thread... piping the output to a GUI widget, and piping any user
input from that widget back to the utility.  Basically, I need to
mimic a simple command-prompt console in a GUI widget.

    I know that the full-blown Eclipse framework has utility classes
for doing this sort of thing.  However, my needs aren't so
feature-rich, and I'm really hoping to avoid having to ship with the
entire Eclipse framework.  I would prefer limiting my dependencies
to vanilla SWT if possible, maybe even compiling the app natively
with GCJ for deployment.

    Has anyone seen any applications or code examples of such a
console-passthrough widget in SWT?  Thanks in advance!
Tris Orendorff - 01 Feb 2006 22:01 GMT
>      I'm building a small GUI front-end for a command-line utility.  I
> need the front-end to run the command-line utility in a background
> thread... piping the output to a GUI widget, and piping any user
> input from that widget back to the utility.  Basically, I need to
> mimic a simple command-prompt console in a GUI widget.

Look at Runtime.getRuntime.exec(), Process.getOutputStream(),
Process.getErrorStream() and Process.setInputStream().
Steve - 01 Feb 2006 22:55 GMT
> Look at Runtime.getRuntime.exec(), Process.getOutputStream(),
> Process.getErrorStream() and Process.setInputStream().

    Well, that's obviously how I would tie the external process into
the widget.  However, what's missing is the widget itself... one
that can smoothly handle the the input and output issues simultaneously.

    Since making that original post, I've made some headway by
borrowing the JConsole class from the BeanShell project, and
tweaking it from Swing to using SwingWT (SWT under the covers).
There are still other issues to overcome, but this looks promising.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.