/** MJToot07.java Launch a couple of PrintingJobs, who print their messages to JMSL.out (which is redefined to print to a TextArea). PrintingJob is a subclass of MusicJob, which was given new functionality by overriding repeat(). * @author Phil Burk and Nick Didkovsky */ /* * (C) 1997 Phil Burk and Nick Didkovsky, All Rights Reserved * JMSL is based upon HMSL (C) Phil Burk, Larry Polansky and David Rosenboom. */ package jmsltutorial; import java.awt.TextArea; import com.softsynth.jmsl.DefaultMusicClock; import com.softsynth.jmsl.JMSL; public class MJToot07 extends java.applet.Applet { PrintingJob spot; PrintingJob puff; TextArea myTextArea; /* Build our PrintingJobs when applet initializes, send JMSL's STDOut to a TextArea */ public void init() { // initialize the TextArea with 20 rows, 50 columns myTextArea = new TextArea(20, 50); // Add the TextArea to the applet's layout add(myTextArea); // Hand this TextArea to a new TextAreaSTDOut, and use it for JMSL.out JMSL.setSTDOut(new TextAreaSTDOut(myTextArea)); // initialize a couple of printing jobs spot = new PrintingJob("Bow-wow"); puff = new PrintingJob("Meow"); // set their durations spot.setRepeatPause(2.0); puff.setRepeatPause(1.0); // set their repeat counts spot.setRepeats(50); puff.setRepeats(100); } /* When applet starts up, launch them */ public void start() { JMSL.clock = new DefaultMusicClock(); spot.launch(JMSL.now()); puff.launch(JMSL.now()); } /* Shut down the PrintingJobs when applet stops */ public void stop() { puff.finish(); spot.finish(); } }