JMSL Tutorial: MusicJob

We now have a subclass of MusicJob that prints a custom message on a regular schedule (see previous tutorial for source code of PrintingJob.java ).

We've put a couple of PrintingJobs in an applet so you can watch them in action.

They are running right now! Open the "Java console" in your browser and watch the messages being printed. Then examine the source code.

Next, we'll add one more refinement by rerouting JMSL.out to a TextArea so you don't have to open the Java Console to see messages being printed.

We note here that these MusicJobs have their repeat count set to high values.  You can always stop a MusicJob during its repeat cycle by calling myMusicJob.finish().  This could be called in response to a Button click, or decided algorithmically by some other class, or even decided by the MusicJob itself, in its repeat() method, for example: if (JMSLRandom.choose() < 0.01) finish();
 

You need a Java-enabled browser to view this applet.
Previous Tutorial Index Tutorial Contents Next

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