.class public Animator2

.super java/applet/Applet

.field private protected images Ljava/util/Vector;
.field private protected totalImages I
.field private protected sleepTime I
.field private protected imageName Ljava/lang/String;
.field private protected gContext Ljava/awt/Graphics;
.field private protected buffer Ljava/awt/Image;
.field private protected imageTracker Ljava/awt/MediaTracker;
.field private protected animate Ljava/lang/Thread;
.field private protected suspended Z
.field private protected width I
.field private protected height I
.field private protected sleepLabel Ljava/awt/Label;
.field private protected sleepDisplay Ljava/awt/TextField;
.field private protected sleepStuff Ljava/awt/Panel;
.field private protected c Ljoos/lib/JoosConstants;
.field private protected f Ljoos/lib/JoosIO;

.method public <init>()V
  .limit locals 1
  .limit stack 3
  aload_0
  invokenonvirtual java/applet/Applet/<init>()V
  new joos/lib/JoosConstants
  dup
  invokenonvirtual joos/lib/JoosConstants/<init>()V
  aload_0
  swap
  putfield Animator2/c Ljoos/lib/JoosConstants;
  new joos/lib/JoosIO
  dup
  invokenonvirtual joos/lib/JoosIO/<init>()V
  aload_0
  swap
  putfield Animator2/f Ljoos/lib/JoosIO;
  return
.end method

.method public getSleepTime()I
  .limit locals 1
  .limit stack 1
  aload_0
  getfield Animator2/sleepTime I
  ireturn
.end method

.method public init()V
  .limit locals 2
  .limit stack 7
  aload_0
  invokevirtual Animator2/processHTMLParameters()V
  aload_0
  getfield Animator2/totalImages I
  iconst_0
  if_icmpeq true_2
  iconst_0
  goto stop_3
  true_2:
  iconst_1
  stop_3:
  dup
  ifne true_1
  pop
  aload_0
  getfield Animator2/imageName Ljava/lang/String;
  aconst_null
  if_acmpeq true_4
  iconst_0
  goto stop_5
  true_4:
  iconst_1
  stop_5:
  true_1:
  ifeq stop_0
  aload_0
  ldc "Invalid parameters"
  invokevirtual java/applet/Applet/showStatus(Ljava/lang/String;)V
  aload_0
  invokevirtual java/applet/Applet/destroy()V
  stop_0:
  new java/util/Vector
  dup
  aload_0
  getfield Animator2/totalImages I
  iconst_1
  invokenonvirtual java/util/Vector/<init>(II)V
  aload_0
  swap
  putfield Animator2/images Ljava/util/Vector;
  new java/awt/MediaTracker
  dup
  aload_0
  invokenonvirtual java/awt/MediaTracker/<init>(Ljava/awt/Component;)V
  aload_0
  swap
  putfield Animator2/imageTracker Ljava/awt/MediaTracker;
  iconst_0
  istore_1
  start_6:
  iload_1
  aload_0
  getfield Animator2/totalImages I
  if_icmpge stop_7
  aload_0
  getfield Animator2/images Ljava/util/Vector;
  aload_0
  aload_0
  invokevirtual java/applet/Applet/getDocumentBase()Ljava/net/URL;
  ldc "images/"
  aload_0
  getfield Animator2/imageName Ljava/lang/String;
  dup
  ifnonnull stop_17
  pop
  ldc "null"
  stop_17:
  invokevirtual java/lang/String/concat(Ljava/lang/String;)Ljava/lang/String;
  dup
  ifnonnull stop_13
  pop
  ldc "null"
  stop_13:
  new java/lang/Integer
  dup
  iload_1
  invokenonvirtual java/lang/Integer/<init>(I)V
  invokevirtual java/lang/Integer/toString()Ljava/lang/String;
  invokevirtual java/lang/String/concat(Ljava/lang/String;)Ljava/lang/String;
  dup
  ifnonnull stop_11
  pop
  ldc "null"
  stop_11:
  ldc ".gif"
  invokevirtual java/lang/String/concat(Ljava/lang/String;)Ljava/lang/String;
  invokevirtual java/applet/Applet/getImage(Ljava/net/URL;Ljava/lang/String;)Ljava/awt/Image;
  invokevirtual java/util/Vector/addElement(Ljava/lang/Object;)V
  aload_0
  getfield Animator2/imageTracker Ljava/awt/MediaTracker;
  aload_0
  getfield Animator2/images Ljava/util/Vector;
  iload_1
  invokevirtual java/util/Vector/elementAt(I)Ljava/lang/Object;
  checkcast java/awt/Image
  iload_1
  invokevirtual java/awt/MediaTracker/addImage(Ljava/awt/Image;I)V
  iinc 1 1
  goto start_6
  stop_7:
  new joos/lib/JoosMediaTracker
  dup
  aload_0
  getfield Animator2/imageTracker Ljava/awt/MediaTracker;
  invokenonvirtual joos/lib/JoosMediaTracker/<init>(Ljava/awt/MediaTracker;)V
  iconst_0
  invokevirtual joos/lib/JoosMediaTracker/waitForID(I)Z
  pop
  aload_0
  getfield Animator2/images Ljava/util/Vector;
  iconst_0
  invokevirtual java/util/Vector/elementAt(I)Ljava/lang/Object;
  checkcast java/awt/Image
  aload_0
  invokevirtual java/awt/Image/getWidth(Ljava/awt/image/ImageObserver;)I
  aload_0
  swap
  putfield Animator2/width I
  aload_0
  getfield Animator2/images Ljava/util/Vector;
  iconst_0
  invokevirtual java/util/Vector/elementAt(I)Ljava/lang/Object;
  checkcast java/awt/Image
  aload_0
  invokevirtual java/awt/Image/getHeight(Ljava/awt/image/ImageObserver;)I
  aload_0
  swap
  putfield Animator2/height I
  aload_0
  aload_0
  getfield Animator2/width I
  aload_0
  getfield Animator2/height I
  ldc 30
  iadd
  invokevirtual java/applet/Applet/resize(II)V
  aload_0
  aload_0
  getfield Animator2/width I
  aload_0
  getfield Animator2/height I
  invokevirtual java/awt/Component/createImage(II)Ljava/awt/Image;
  aload_0
  swap
  putfield Animator2/buffer Ljava/awt/Image;
  aload_0
  getfield Animator2/buffer Ljava/awt/Image;
  invokevirtual java/awt/Image/getGraphics()Ljava/awt/Graphics;
  aload_0
  swap
  putfield Animator2/gContext Ljava/awt/Graphics;
  aload_0
  getfield Animator2/gContext Ljava/awt/Graphics;
  aload_0
  getfield Animator2/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/white()Ljava/awt/Color;
  invokevirtual java/awt/Graphics/setColor(Ljava/awt/Color;)V
  aload_0
  getfield Animator2/gContext Ljava/awt/Graphics;
  iconst_0
  iconst_0
  ldc 160
  ldc 80
  invokevirtual java/awt/Graphics/fillRect(IIII)V
  aload_0
  new java/awt/BorderLayout
  dup
  ldc 10
  ldc 10
  invokenonvirtual java/awt/BorderLayout/<init>(II)V
  invokevirtual java/awt/Container/setLayout(Ljava/awt/LayoutManager;)V
  new java/awt/Label
  dup
  ldc "Sleep time"
  aload_0
  getfield Animator2/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/LABEL_CENTER()I
  invokenonvirtual java/awt/Label/<init>(Ljava/lang/String;I)V
  aload_0
  swap
  putfield Animator2/sleepLabel Ljava/awt/Label;
  new java/awt/TextField
  dup
  ldc ""
  iconst_5
  invokenonvirtual java/awt/TextField/<init>(Ljava/lang/String;I)V
  aload_0
  swap
  putfield Animator2/sleepDisplay Ljava/awt/TextField;
  aload_0
  getfield Animator2/sleepDisplay Ljava/awt/TextField;
  new java/lang/Integer
  dup
  aload_0
  getfield Animator2/sleepTime I
  invokenonvirtual java/lang/Integer/<init>(I)V
  invokevirtual java/lang/Integer/toString()Ljava/lang/String;
  invokevirtual java/awt/TextComponent/setText(Ljava/lang/String;)V
  new java/awt/Panel
  dup
  invokenonvirtual java/awt/Panel/<init>()V
  aload_0
  swap
  putfield Animator2/sleepStuff Ljava/awt/Panel;
  aload_0
  getfield Animator2/sleepStuff Ljava/awt/Panel;
  aload_0
  getfield Animator2/sleepLabel Ljava/awt/Label;
  invokevirtual java/awt/Container/add(Ljava/awt/Component;)Ljava/awt/Component;
  pop
  aload_0
  getfield Animator2/sleepStuff Ljava/awt/Panel;
  aload_0
  getfield Animator2/sleepDisplay Ljava/awt/TextField;
  invokevirtual java/awt/Container/add(Ljava/awt/Component;)Ljava/awt/Component;
  pop
  new joos/lib/JoosContainer
  dup
  aload_0
  invokenonvirtual joos/lib/JoosContainer/<init>(Ljava/awt/Container;)V
  ldc "South"
  aload_0
  getfield Animator2/sleepStuff Ljava/awt/Panel;
  invokevirtual joos/lib/JoosContainer/addString(Ljava/lang/String;Ljava/awt/Component;)Ljava/awt/Component;
  pop
  return
.end method

.method public start()V
  .limit locals 1
  .limit stack 8
  aload_0
  getfield Animator2/gContext Ljava/awt/Graphics;
  aload_0
  getfield Animator2/images Ljava/util/Vector;
  iconst_0
  invokevirtual java/util/Vector/elementAt(I)Ljava/lang/Object;
  checkcast java/awt/Image
  iconst_0
  iconst_0
  aload_0
  invokevirtual java/awt/Graphics/drawImage(Ljava/awt/Image;IILjava/awt/image/ImageObserver;)Z
  pop
  aload_0
  getfield Animator2/animate Ljava/lang/Thread;
  aconst_null
  if_acmpne stop_0
  new java/lang/Thread
  dup
  new Animator2Run
  dup
  aload_0
  aload_0
  getfield Animator2/images Ljava/util/Vector;
  aload_0
  getfield Animator2/imageTracker Ljava/awt/MediaTracker;
  aload_0
  getfield Animator2/gContext Ljava/awt/Graphics;
  invokenonvirtual Animator2Run/<init>(LAnimator2;Ljava/util/Vector;Ljava/awt/MediaTracker;Ljava/awt/Graphics;)V
  invokenonvirtual java/lang/Thread/<init>(Ljava/lang/Runnable;)V
  aload_0
  swap
  putfield Animator2/animate Ljava/lang/Thread;
  aload_0
  getfield Animator2/animate Ljava/lang/Thread;
  invokevirtual java/lang/Thread/start()V
  stop_0:
  return
.end method

.method public stop()V
  .limit locals 1
  .limit stack 3
  aload_0
  getfield Animator2/animate Ljava/lang/Thread;
  aconst_null
  if_acmpeq stop_0
  aload_0
  getfield Animator2/animate Ljava/lang/Thread;
  invokevirtual java/lang/Thread/stop()V
  aload_0
  aconst_null
  putfield Animator2/animate Ljava/lang/Thread;
  stop_0:
  return
.end method

.method public paint(Ljava/awt/Graphics;)V
  .limit locals 2
  .limit stack 5
  aload_1
  aload_0
  getfield Animator2/buffer Ljava/awt/Image;
  iconst_0
  iconst_0
  aload_0
  invokevirtual java/awt/Graphics/drawImage(Ljava/awt/Image;IILjava/awt/image/ImageObserver;)Z
  pop
  return
.end method

.method public update(Ljava/awt/Graphics;)V
  .limit locals 2
  .limit stack 2
  aload_0
  aload_1
  invokevirtual Animator2/paint(Ljava/awt/Graphics;)V
  return
.end method

.method public action(Ljava/awt/Event;Ljava/lang/Object;)Z
  .limit locals 3
  .limit stack 3
  new joos/lib/JoosString
  dup
  aload_2
  invokevirtual java/lang/Object/toString()Ljava/lang/String;
  invokenonvirtual joos/lib/JoosString/<init>(Ljava/lang/String;)V
  invokevirtual joos/lib/JoosString/string2Int()I
  aload_0
  swap
  putfield Animator2/sleepTime I
  iconst_1
  ireturn
.end method

.method public mouseDown(Ljava/awt/Event;II)Z
  .limit locals 4
  .limit stack 3
  aload_0
  getfield Animator2/suspended Z
  ifeq else_0
  aload_0
  getfield Animator2/animate Ljava/lang/Thread;
  invokevirtual java/lang/Thread/resume()V
  aload_0
  iconst_0
  putfield Animator2/suspended Z
  goto stop_1
  else_0:
  aload_0
  getfield Animator2/animate Ljava/lang/Thread;
  invokevirtual java/lang/Thread/suspend()V
  aload_0
  iconst_1
  putfield Animator2/suspended Z
  stop_1:
  iconst_1
  ireturn
.end method

.method public processHTMLParameters()V
  .limit locals 2
  .limit stack 3
  aload_0
  ldc "sleeptime"
  invokevirtual java/applet/Applet/getParameter(Ljava/lang/String;)Ljava/lang/String;
  astore_1
  aload_1
  aconst_null
  if_acmpne else_0
  aload_0
  ldc 50
  putfield Animator2/sleepTime I
  goto stop_1
  else_0:
  new joos/lib/JoosString
  dup
  aload_1
  invokenonvirtual joos/lib/JoosString/<init>(Ljava/lang/String;)V
  invokevirtual joos/lib/JoosString/string2Int()I
  aload_0
  swap
  putfield Animator2/sleepTime I
  stop_1:
  aload_0
  ldc "imagename"
  invokevirtual java/applet/Applet/getParameter(Ljava/lang/String;)Ljava/lang/String;
  aload_0
  swap
  putfield Animator2/imageName Ljava/lang/String;
  aload_0
  ldc "totalimages"
  invokevirtual java/applet/Applet/getParameter(Ljava/lang/String;)Ljava/lang/String;
  astore_1
  aload_1
  aconst_null
  if_acmpne else_4
  aload_0
  iconst_0
  putfield Animator2/totalImages I
  return
  else_4:
  new joos/lib/JoosString
  dup
  aload_1
  invokenonvirtual joos/lib/JoosString/<init>(Ljava/lang/String;)V
  invokevirtual joos/lib/JoosString/string2Int()I
  aload_0
  swap
  putfield Animator2/totalImages I
  return
.end method

