JMSL Tutorial: MusicJob

Redirecting Text output with JMSL.out

We don’t want to open the Java console every time we print something, so let’s take a quick detour and see how we can redirect text output to a TextArea.

JMSL has a handy class called JMSL.out that supports printing.  Any class that implements JMSL’s STDOutFunction interface can be plugged in to receive Strings printed by JMSL.out.

It's as easy as building a class that implements:

 print(String)
 println()
 println(String)


For these examples, we define TextAreaSTDOut which prints to a TextArea. See the TextAreaSTDOut source here.

Below, an applet prints "Hello JMSL" to a TextArea. Have a look at the source for this applet.

You need a Java-enabled browser to view this applet.
Next, we'll revisit our PrintingJobs, and have them print their messages to a TextArea.
 



  (C) 1997 Phil Burk and Nick Didkovsky, All Rights Reserved
  JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom.