.class public ScrollableScribble

.super java/awt/Panel

.field private protected canvas Ljava/awt/Canvas;
.field private protected hbar Ljava/awt/Scrollbar;
.field private protected vbar Ljava/awt/Scrollbar;
.field private protected lines Ljava/util/Vector;
.field private protected last_x I
.field private protected last_y I
.field private protected offset_x I
.field private protected offset_y I
.field private protected canvas_width I
.field private protected canvas_height I
.field private protected c Ljoos/lib/JoosConstants;

.method public <init>()V
  .limit locals 1
  .limit stack 5
  aload_0
  invokenonvirtual java/awt/Panel/<init>()V
  new joos/lib/JoosConstants
  dup
  invokenonvirtual joos/lib/JoosConstants/<init>()V
  aload_0
  swap
  putfield ScrollableScribble/c Ljoos/lib/JoosConstants;
  new java/util/Vector
  dup
  ldc 100
  ldc 100
  invokenonvirtual java/util/Vector/<init>(II)V
  aload_0
  swap
  putfield ScrollableScribble/lines Ljava/util/Vector;
  new BlankCanvas
  dup
  invokenonvirtual BlankCanvas/<init>()V
  checkcast java/awt/Canvas
  aload_0
  swap
  putfield ScrollableScribble/canvas Ljava/awt/Canvas;
  new java/awt/Scrollbar
  dup
  aload_0
  getfield ScrollableScribble/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/SCROLLBAR_HORIZONTAL()I
  invokenonvirtual java/awt/Scrollbar/<init>(I)V
  aload_0
  swap
  putfield ScrollableScribble/hbar Ljava/awt/Scrollbar;
  new java/awt/Scrollbar
  dup
  aload_0
  getfield ScrollableScribble/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/SCROLLBAR_VERTICAL()I
  invokenonvirtual java/awt/Scrollbar/<init>(I)V
  aload_0
  swap
  putfield ScrollableScribble/vbar Ljava/awt/Scrollbar;
  aload_0
  new java/awt/BorderLayout
  dup
  iconst_0
  iconst_0
  invokenonvirtual java/awt/BorderLayout/<init>(II)V
  invokevirtual java/awt/Container/setLayout(Ljava/awt/LayoutManager;)V
  new joos/lib/JoosContainer
  dup
  aload_0
  invokenonvirtual joos/lib/JoosContainer/<init>(Ljava/awt/Container;)V
  ldc "Center"
  aload_0
  getfield ScrollableScribble/canvas Ljava/awt/Canvas;
  invokevirtual joos/lib/JoosContainer/addString(Ljava/lang/String;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 ScrollableScribble/hbar Ljava/awt/Scrollbar;
  invokevirtual joos/lib/JoosContainer/addString(Ljava/lang/String;Ljava/awt/Component;)Ljava/awt/Component;
  pop
  new joos/lib/JoosContainer
  dup
  aload_0
  invokenonvirtual joos/lib/JoosContainer/<init>(Ljava/awt/Container;)V
  ldc "East"
  aload_0
  getfield ScrollableScribble/vbar Ljava/awt/Scrollbar;
  invokevirtual joos/lib/JoosContainer/addString(Ljava/lang/String;Ljava/awt/Component;)Ljava/awt/Component;
  pop
  return
.end method

.method public paint(Ljava/awt/Graphics;)V
  .limit locals 4
  .limit stack 6
  iconst_0
  istore_3
  start_0:
  iload_3
  aload_0
  getfield ScrollableScribble/lines Ljava/util/Vector;
  invokevirtual java/util/Vector/size()I
  if_icmpge stop_1
  aload_0
  getfield ScrollableScribble/lines Ljava/util/Vector;
  iload_3
  invokevirtual java/util/Vector/elementAt(I)Ljava/lang/Object;
  checkcast Line
  astore_2
  aload_1
  aload_2
  invokevirtual Line/getx1()I
  aload_0
  getfield ScrollableScribble/offset_x I
  isub
  aload_2
  invokevirtual Line/gety1()I
  aload_0
  getfield ScrollableScribble/offset_y I
  isub
  aload_2
  invokevirtual Line/getx2()I
  aload_0
  getfield ScrollableScribble/offset_x I
  isub
  aload_2
  invokevirtual Line/gety2()I
  aload_0
  getfield ScrollableScribble/offset_y I
  isub
  invokevirtual java/awt/Graphics/drawLine(IIII)V
  iinc 3 1
  goto start_0
  stop_1:
  return
.end method

.method public mouseDown(Ljava/awt/Event;II)Z
  .limit locals 4
  .limit stack 3
  aload_0
  iload_2
  putfield ScrollableScribble/last_x I
  aload_0
  iload_3
  putfield ScrollableScribble/last_y I
  iconst_1
  ireturn
.end method

.method public mouseDrag(Ljava/awt/Event;II)Z
  .limit locals 5
  .limit stack 8
  aload_0
  getfield ScrollableScribble/canvas Ljava/awt/Canvas;
  invokevirtual java/awt/Component/getGraphics()Ljava/awt/Graphics;
  astore 4
  aload 4
  aload_0
  getfield ScrollableScribble/last_x I
  aload_0
  getfield ScrollableScribble/last_y I
  iload_2
  iload_3
  invokevirtual java/awt/Graphics/drawLine(IIII)V
  aload_0
  getfield ScrollableScribble/lines Ljava/util/Vector;
  new Line
  dup
  aload_0
  getfield ScrollableScribble/last_x I
  aload_0
  getfield ScrollableScribble/offset_x I
  iadd
  aload_0
  getfield ScrollableScribble/last_y I
  aload_0
  getfield ScrollableScribble/offset_y I
  iadd
  iload_2
  aload_0
  getfield ScrollableScribble/offset_x I
  iadd
  iload_3
  aload_0
  getfield ScrollableScribble/offset_y I
  iadd
  invokenonvirtual Line/<init>(IIII)V
  invokevirtual java/util/Vector/addElement(Ljava/lang/Object;)V
  aload_0
  iload_2
  putfield ScrollableScribble/last_x I
  aload_0
  iload_3
  putfield ScrollableScribble/last_y I
  iconst_1
  ireturn
.end method

.method public mouseUp(Ljava/awt/Event;II)Z
  .limit locals 4
  .limit stack 1
  iconst_1
  ireturn
.end method

.method public handleEvent(Ljava/awt/Event;)Z
  .limit locals 6
  .limit stack 3
  new joos/lib/JoosEvent
  dup
  aload_1
  invokenonvirtual joos/lib/JoosEvent/<init>(Ljava/awt/Event;)V
  astore_2
  aload_2
  invokevirtual joos/lib/JoosEvent/target()Ljava/lang/Object;
  astore_3
  aload_2
  invokevirtual joos/lib/JoosEvent/id()I
  istore 4
  aload_2
  invokevirtual joos/lib/JoosEvent/arg()Ljava/lang/Object;
  astore 5
  aload_3
  aload_0
  getfield ScrollableScribble/hbar Ljava/awt/Scrollbar;
  if_acmpne else_0
  iload 4
  aload_0
  getfield ScrollableScribble/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/SCROLL_LINE_UP()I
  if_icmpeq true_9
  iconst_0
  goto stop_10
  true_9:
  iconst_1
  stop_10:
  dup
  ifne true_5
  pop
  iload 4
  aload_0
  getfield ScrollableScribble/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/SCROLL_LINE_DOWN()I
  if_icmpeq true_11
  iconst_0
  goto stop_12
  true_11:
  iconst_1
  stop_12:
  dup
  ifne true_5
  pop
  iload 4
  aload_0
  getfield ScrollableScribble/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/SCROLL_PAGE_UP()I
  if_icmpeq true_13
  iconst_0
  goto stop_14
  true_13:
  iconst_1
  stop_14:
  true_7:
  dup
  ifne true_5
  pop
  iload 4
  aload_0
  getfield ScrollableScribble/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/SCROLL_PAGE_DOWN()I
  if_icmpeq true_15
  iconst_0
  goto stop_16
  true_15:
  iconst_1
  stop_16:
  true_6:
  dup
  ifne true_5
  pop
  iload 4
  aload_0
  getfield ScrollableScribble/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/SCROLL_ABSOLUTE()I
  if_icmpeq true_17
  iconst_0
  goto stop_18
  true_17:
  iconst_1
  stop_18:
  true_5:
  ifeq stop_4
  aload 5
  checkcast java/lang/Integer
  invokevirtual java/lang/Integer/intValue()I
  aload_0
  swap
  putfield ScrollableScribble/offset_x I
  stop_4:
  aload_0
  aload_0
  getfield ScrollableScribble/canvas Ljava/awt/Canvas;
  invokevirtual java/awt/Component/getGraphics()Ljava/awt/Graphics;
  invokevirtual java/awt/Component/update(Ljava/awt/Graphics;)V
  iconst_1
  ireturn
  else_0:
  aload_3
  aload_0
  getfield ScrollableScribble/vbar Ljava/awt/Scrollbar;
  if_acmpne stop_19
  iload 4
  aload_0
  getfield ScrollableScribble/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/SCROLL_LINE_UP()I
  if_icmpeq true_27
  iconst_0
  goto stop_28
  true_27:
  iconst_1
  stop_28:
  dup
  ifne true_23
  pop
  iload 4
  aload_0
  getfield ScrollableScribble/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/SCROLL_LINE_DOWN()I
  if_icmpeq true_29
  iconst_0
  goto stop_30
  true_29:
  iconst_1
  stop_30:
  dup
  ifne true_23
  pop
  iload 4
  aload_0
  getfield ScrollableScribble/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/SCROLL_PAGE_UP()I
  if_icmpeq true_31
  iconst_0
  goto stop_32
  true_31:
  iconst_1
  stop_32:
  true_25:
  dup
  ifne true_23
  pop
  iload 4
  aload_0
  getfield ScrollableScribble/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/SCROLL_PAGE_DOWN()I
  if_icmpeq true_33
  iconst_0
  goto stop_34
  true_33:
  iconst_1
  stop_34:
  true_24:
  dup
  ifne true_23
  pop
  iload 4
  aload_0
  getfield ScrollableScribble/c Ljoos/lib/JoosConstants;
  invokevirtual joos/lib/JoosConstants/SCROLL_ABSOLUTE()I
  if_icmpeq true_35
  iconst_0
  goto stop_36
  true_35:
  iconst_1
  stop_36:
  true_23:
  ifeq stop_22
  aload 5
  checkcast java/lang/Integer
  invokevirtual java/lang/Integer/intValue()I
  aload_0
  swap
  putfield ScrollableScribble/offset_y I
  stop_22:
  aload_0
  aload_0
  getfield ScrollableScribble/canvas Ljava/awt/Canvas;
  invokevirtual java/awt/Component/getGraphics()Ljava/awt/Graphics;
  invokevirtual java/awt/Component/update(Ljava/awt/Graphics;)V
  iconst_1
  ireturn
  stop_19:
  aload_0
  aload_1
  invokenonvirtual java/awt/Component/handleEvent(Ljava/awt/Event;)Z
  ireturn
.end method

.method public synchronized reshape(IIII)V
  .limit locals 7
  .limit stack 6
  aload_0
  iload_1
  iload_2
  iload_3
  iload 4
  invokenonvirtual java/awt/Component/reshape(IIII)V
  new joos/lib/JoosDimension
  dup
  aload_0
  getfield ScrollableScribble/hbar Ljava/awt/Scrollbar;
  invokevirtual java/awt/Component/size()Ljava/awt/Dimension;
  invokenonvirtual joos/lib/JoosDimension/<init>(Ljava/awt/Dimension;)V
  astore 5
  new joos/lib/JoosDimension
  dup
  aload_0
  getfield ScrollableScribble/vbar Ljava/awt/Scrollbar;
  invokevirtual java/awt/Component/size()Ljava/awt/Dimension;
  invokenonvirtual joos/lib/JoosDimension/<init>(Ljava/awt/Dimension;)V
  astore 6
  iload_3
  aload 6
  invokevirtual joos/lib/JoosDimension/width()I
  isub
  aload_0
  swap
  putfield ScrollableScribble/canvas_width I
  iload 4
  aload 5
  invokevirtual joos/lib/JoosDimension/height()I
  isub
  aload_0
  swap
  putfield ScrollableScribble/canvas_height I
  aload_0
  getfield ScrollableScribble/hbar Ljava/awt/Scrollbar;
  aload_0
  getfield ScrollableScribble/offset_x I
  aload_0
  getfield ScrollableScribble/canvas_width I
  iconst_0
  ldc 1000
  aload_0
  getfield ScrollableScribble/canvas_width I
  isub
  invokevirtual java/awt/Scrollbar/setValues(IIII)V
  aload_0
  getfield ScrollableScribble/vbar Ljava/awt/Scrollbar;
  aload_0
  getfield ScrollableScribble/offset_y I
  aload_0
  getfield ScrollableScribble/canvas_height I
  iconst_0
  ldc 1000
  aload_0
  getfield ScrollableScribble/canvas_height I
  isub
  invokevirtual java/awt/Scrollbar/setValues(IIII)V
  aload_0
  getfield ScrollableScribble/hbar Ljava/awt/Scrollbar;
  aload_0
  getfield ScrollableScribble/canvas_width I
  iconst_2
  idiv
  invokevirtual java/awt/Scrollbar/setPageIncrement(I)V
  aload_0
  getfield ScrollableScribble/vbar Ljava/awt/Scrollbar;
  aload_0
  getfield ScrollableScribble/canvas_height I
  iconst_2
  idiv
  invokevirtual java/awt/Scrollbar/setPageIncrement(I)V
  aload_0
  aload_0
  getfield ScrollableScribble/canvas Ljava/awt/Canvas;
  invokevirtual java/awt/Component/getGraphics()Ljava/awt/Graphics;
  invokevirtual java/awt/Component/update(Ljava/awt/Graphics;)V
  return
.end method

