.class public Imagemap

.super java/applet/Applet

.field private protected image Ljava/awt/Image;
.field private protected rects Ljava/util/Vector;
.field private protected lastrect LImagemapRectangle;
.field private protected c Ljoos/lib/JoosConstants;

.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 Imagemap/c Ljoos/lib/JoosConstants;
  return
.end method

.method public init()V
  .limit locals 3
  .limit stack 5
  aload_0
  aload_0
  invokevirtual java/applet/Applet/getDocumentBase()Ljava/net/URL;
  aload_0
  ldc "image"
  invokevirtual java/applet/Applet/getParameter(Ljava/lang/String;)Ljava/lang/String;
  invokevirtual java/applet/Applet/getImage(Ljava/net/URL;Ljava/lang/String;)Ljava/awt/Image;
  aload_0
  swap
  putfield Imagemap/image Ljava/awt/Image;
  new java/util/Vector
  dup
  ldc 10
  ldc 10
  invokenonvirtual java/util/Vector/<init>(II)V
  aload_0
  swap
  putfield Imagemap/rects Ljava/util/Vector;
  iconst_0
  istore_1
  start_0:
  aload_0
  ldc "rect"
  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;
  invokevirtual Imagemap/getRectangleParameter(Ljava/lang/String;)LImagemapRectangle;
  dup
  astore_2
  aconst_null
  if_acmpeq stop_1
  aload_0
  getfield Imagemap/rects Ljava/util/Vector;
  aload_2
  invokevirtual java/util/Vector/addElement(Ljava/lang/Object;)V
  iinc 1 1
  goto start_0
  stop_1:
  return
.end method

.method public destroy()V
  .limit locals 1
  .limit stack 1
  aload_0
  getfield Imagemap/image Ljava/awt/Image;
  invokevirtual java/awt/Image/flush()V
  return
.end method

.method public paint(Ljava/awt/Graphics;)V
  .limit locals 2
  .limit stack 5
  aload_1
  aload_0
  getfield Imagemap/image 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 Imagemap/paint(Ljava/awt/Graphics;)V
  return
.end method

.method public findrect(II)LImagemapRectangle;
  .limit locals 6
  .limit stack 3
  aconst_null
  astore 4
  iconst_0
  istore 5
  iconst_0
  istore_3
  start_0:
  iload 5
  ifeq true_3
  iconst_0
  goto stop_4
  true_3:
  iconst_1
  stop_4:
  dup
  ifeq false_2
  pop
  iload_3
  aload_0
  getfield Imagemap/rects Ljava/util/Vector;
  invokevirtual java/util/Vector/size()I
  if_icmplt true_5
  iconst_0
  goto stop_6
  true_5:
  iconst_1
  stop_6:
  false_2:
  ifeq stop_1
  aload_0
  getfield Imagemap/rects Ljava/util/Vector;
  iload_3
  invokevirtual java/util/Vector/elementAt(I)Ljava/lang/Object;
  checkcast ImagemapRectangle
  astore 4
  aload 4
  iload_1
  iload_2
  invokevirtual java/awt/Rectangle/inside(II)Z
  ifeq else_7
  iconst_1
  istore 5
  goto start_0
  else_7:
  iinc 3 1
  goto start_0
  stop_1:
  iload_3
  aload_0
  getfield Imagemap/rects Ljava/util/Vector;
  invokevirtual java/util/Vector/size()I
  if_icmpge else_9
  aload 4
  areturn
  else_9:
  aconst_null
  areturn
.end method

.method public mouseDown(Ljava/awt/Event;II)Z
  .limit locals 6
  .limit stack 5
  aload_0
  iload_2
  iload_3
  invokevirtual Imagemap/findrect(II)LImagemapRectangle;
  astore 4
  aload 4
  aconst_null
  if_acmpne stop_0
  iconst_0
  ireturn
  stop_0:
  aload_0
  invokevirtual java/awt/Component/getGraphics()Ljava/awt/Graphics;
  astore 5
  aload 5
  aload_0
  getfield Imagemap/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/red()Ljava/awt/Color;
  invokevirtual java/awt/Graphics/setXORMode(Ljava/awt/Color;)V
  aload 5
  aload 4
  invokevirtual joos/lib/JoosRectangle/x()I
  aload 4
  invokevirtual joos/lib/JoosRectangle/y()I
  aload 4
  invokevirtual joos/lib/JoosRectangle/width()I
  aload 4
  invokevirtual joos/lib/JoosRectangle/height()I
  invokevirtual java/awt/Graphics/drawRect(IIII)V
  aload_0
  aload 4
  putfield Imagemap/lastrect LImagemapRectangle;
  aload_0
  ldc "To: "
  aload 4
  invokevirtual ImagemapRectangle/url()Ljava/net/URL;
  dup
  ifnull null_5
  invokevirtual java/net/URL/toString()Ljava/lang/String;
  goto stop_6
  null_5:
  pop
  ldc "null"
  stop_6:
  invokevirtual java/lang/String/concat(Ljava/lang/String;)Ljava/lang/String;
  invokevirtual java/applet/Applet/showStatus(Ljava/lang/String;)V
  iconst_1
  ireturn
.end method

.method public mouseUp(Ljava/awt/Event;II)Z
  .limit locals 6
  .limit stack 5
  aload_0
  getfield Imagemap/lastrect LImagemapRectangle;
  aconst_null
  if_acmpeq stop_0
  aload_0
  invokevirtual java/awt/Component/getGraphics()Ljava/awt/Graphics;
  astore 5
  aload 5
  aload_0
  getfield Imagemap/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/red()Ljava/awt/Color;
  invokevirtual java/awt/Graphics/setXORMode(Ljava/awt/Color;)V
  aload 5
  aload_0
  getfield Imagemap/lastrect LImagemapRectangle;
  invokevirtual joos/lib/JoosRectangle/x()I
  aload_0
  getfield Imagemap/lastrect LImagemapRectangle;
  invokevirtual joos/lib/JoosRectangle/y()I
  aload_0
  getfield Imagemap/lastrect LImagemapRectangle;
  invokevirtual joos/lib/JoosRectangle/width()I
  aload_0
  getfield Imagemap/lastrect LImagemapRectangle;
  invokevirtual joos/lib/JoosRectangle/height()I
  invokevirtual java/awt/Graphics/drawRect(IIII)V
  aload_0
  ldc ""
  invokevirtual java/applet/Applet/showStatus(Ljava/lang/String;)V
  aload_0
  iload_2
  iload_3
  invokevirtual Imagemap/findrect(II)LImagemapRectangle;
  astore 4
  aload 4
  aconst_null
  if_acmpne true_5
  iconst_0
  goto stop_6
  true_5:
  iconst_1
  stop_6:
  dup
  ifeq false_4
  pop
  aload 4
  aload_0
  getfield Imagemap/lastrect LImagemapRectangle;
  if_acmpeq true_7
  iconst_0
  goto stop_8
  true_7:
  iconst_1
  stop_8:
  false_4:
  ifeq stop_3
  aload_0
  invokevirtual java/applet/Applet/getAppletContext()Ljava/applet/AppletContext;
  aload 4
  invokevirtual ImagemapRectangle/url()Ljava/net/URL;
  invokevirtual java/applet/AppletContext/showDocument(Ljava/net/URL;)V
  stop_3:
  aload_0
  aconst_null
  putfield Imagemap/lastrect LImagemapRectangle;
  stop_0:
  iconst_1
  ireturn
.end method

.method public getRectangleParameter(Ljava/lang/String;)LImagemapRectangle;
  .limit locals 9
  .limit stack 7
  aload_0
  aload_1
  invokevirtual java/applet/Applet/getParameter(Ljava/lang/String;)Ljava/lang/String;
  astore 7
  aload 7
  aconst_null
  if_acmpne stop_0
  aconst_null
  areturn
  stop_0:
  new java/util/StringTokenizer
  dup
  aload 7
  ldc ","
  iconst_0
  invokenonvirtual java/util/StringTokenizer/<init>(Ljava/lang/String;Ljava/lang/String;Z)V
  astore 8
  new joos/lib/JoosString
  dup
  aload 8
  ldc ","
  invokevirtual java/util/StringTokenizer/nextToken(Ljava/lang/String;)Ljava/lang/String;
  invokenonvirtual joos/lib/JoosString/<init>(Ljava/lang/String;)V
  invokevirtual joos/lib/JoosString/string2Int()I
  istore_2
  new joos/lib/JoosString
  dup
  aload 8
  ldc ","
  invokevirtual java/util/StringTokenizer/nextToken(Ljava/lang/String;)Ljava/lang/String;
  invokenonvirtual joos/lib/JoosString/<init>(Ljava/lang/String;)V
  invokevirtual joos/lib/JoosString/string2Int()I
  istore_3
  new joos/lib/JoosString
  dup
  aload 8
  ldc ","
  invokevirtual java/util/StringTokenizer/nextToken(Ljava/lang/String;)Ljava/lang/String;
  invokenonvirtual joos/lib/JoosString/<init>(Ljava/lang/String;)V
  invokevirtual joos/lib/JoosString/string2Int()I
  istore 4
  new joos/lib/JoosString
  dup
  aload 8
  ldc ","
  invokevirtual java/util/StringTokenizer/nextToken(Ljava/lang/String;)Ljava/lang/String;
  invokenonvirtual joos/lib/JoosString/<init>(Ljava/lang/String;)V
  invokevirtual joos/lib/JoosString/string2Int()I
  istore 5
  new joos/lib/JoosURL
  dup
  aload_0
  invokevirtual java/applet/Applet/getDocumentBase()Ljava/net/URL;
  aload 8
  ldc ","
  invokevirtual java/util/StringTokenizer/nextToken(Ljava/lang/String;)Ljava/lang/String;
  invokenonvirtual joos/lib/JoosURL/<init>(Ljava/net/URL;Ljava/lang/String;)V
  invokevirtual joos/lib/JoosURL/getURL()Ljava/net/URL;
  astore 6
  new ImagemapRectangle
  dup
  iload_2
  iload_3
  iload 4
  iload 5
  aload 6
  invokenonvirtual ImagemapRectangle/<init>(IIIILjava/net/URL;)V
  areturn
.end method

