wl

Unnamed repository; edit this file 'description' to name the repository.
git clone https://logand.com/git/wl.git/
Log | Files | Refs | LICENSE

swing9.l (571B)


      1 # implements http://rosettacode.org/wiki/Animation#Java.2FSwing
      2 # TODO implement 'rot' and 'do'
      3 
      4 (load "swing.l")
      5 
      6 (de mouse (E)
      7    (when (= "mouseClicked" E)
      8       (println E)
      9       #(setq Dir (if (= 1 Dir) 12 1))
     10       ) )
     11 
     12 (de timer (E)
     13    (println E)
     14    #(L 'setText (pack (do Dir (rot Text))))
     15    )
     16 
     17 (setq
     18    Dir 1
     19    Text (chop "Hello World! ")
     20    F (jnew JFrame "Animation")
     21    L (jnew JLabel (pack Text))
     22    A (jproxy NIL 'timer ActionListener) )
     23 
     24 (L 'addMouseListener (jproxy NIL 'mouse MouseListener))
     25 (F 'add L)
     26 (F 'pack)
     27 (F 'show)
     28 ((jnew Timer 200 A) 'start)