home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / netrexx.zip / NetRexx / NervousTexxt.nrx < prev    next >
Text File  |  1996-02-13  |  1KB  |  51 lines

  1. /*  NervousText applet in NetRexx: Test of text animation.
  2.     Algorithms, names, etc. are directly from the Java version by
  3.     Daniel Wyszynski and kwalrath, 1995
  4. */
  5. options binary
  6.  
  7. class NervousTexxt extends Applet implements Runnable
  8.  
  9.   separated = char[]
  10.   s = String
  11.   killme = Thread
  12.   threadSuspended = boolean 0
  13.  
  14.   method init
  15.     resize(300,50)
  16.     setFont(Font("TimesRoman", Font.BOLD, 30))
  17.     s = getParameter("text")
  18.     if s = null then s = "NetRexx"
  19.  
  20.     separated = char[s.length]
  21.     s.getChars(0, s.length, separated,0)
  22.  
  23.   method start
  24.     if killme \= null then return
  25.     killme = Thread(this)
  26.     killme.start
  27.  
  28.   method stop
  29.     killme = null
  30.  
  31.   method run
  32.     loop while killme \= null
  33.       Thread.sleep(100)
  34.       this.repaint
  35.     catch InterruptedException
  36.     end
  37.     killme = null
  38.  
  39.   method paint(g=Graphics)
  40.     loop i=0 to s.length-1
  41.       x_coord = int Math.random*10+15*i
  42.       y_coord = int Math.random*10+36
  43.       g.drawChars(separated, i, 1, x_coord, y_coord)
  44.     end
  45.  
  46.   method mouseDown(evt=Event, x=int, y=int) returns boolean
  47.     if threadSuspended then killme.resume
  48.                        else killme.suspend
  49.     threadSuspended = \threadSuspended
  50.     return 1
  51.