home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 27 / IOPROG_27.ISO / SOFT / SPIRO.ZIP / AUser / Jos / javas / old / Spirograph / AnimSpiroDemo.java < prev    next >
Encoding:
Java Source  |  1998-02-03  |  1.4 KB  |  46 lines

  1. import java.awt.BorderLayout;
  2. import java.applet.Applet;
  3.  
  4. public class AnimSpiroDemo extends Applet {
  5.  
  6.     public String[][] getParameterInfo() {
  7.         String[][] info = {
  8.             // name, type, description
  9.             {"mouseUpStopsAnimation", "boolean", "If this parameter is specified, the animation stops when clicked on."},
  10.             {"I", "integer", "The number of lines in the animated spirograph."}
  11.         };
  12.         return info;
  13.     }
  14.  
  15.     public String getAppletInfo() {
  16.         return "AnimSpiroDemo\nApplet for demonstrating the AnimSpiro class\nWritten by Jos van den Oever.";
  17.     }
  18.  
  19.     public static void main(String args[]) {
  20.         toFrame();
  21.     }
  22.  
  23.     public void init() {
  24.         boolean mouseUpStopsAnimation = (getParameter("mouseUpStopsAnimation") !=  null);
  25.         int I = 100;
  26.         try {
  27.             I = Integer.parseInt(getParameter("I"));
  28.         } catch(NumberFormatException e) {
  29.         }
  30.         setLayout(new BorderLayout());
  31.  
  32.         SpiroAnim sa = new SpiroAnim(I, mouseUpStopsAnimation);
  33.         add("Center",sa);
  34.     }
  35.  
  36.     private static void toFrame() {
  37.         NormFrame f = new NormFrame("AnimSpiro");
  38.         f.setSize(200,200);
  39.         f.setLayout(new BorderLayout());
  40.         SpiroAnim sa = new SpiroAnim(true);
  41.         f.add("Center",sa);
  42.         f.show();
  43.         sa.start();
  44.     }
  45. }
  46.