.class public MultiLineLabel

.super java/awt/Canvas

.field private protected lines LStringVector;
.field private protected num_lines I
.field private protected margin_width I
.field private protected margin_height I
.field private protected line_height I
.field private protected line_ascent I
.field private protected line_widths LIntVector;
.field private protected max_width I
.field private protected alignment I

.method public <init>(Ljava/lang/String;II)V
  .limit locals 4
  .limit stack 3
  aload_0
  invokenonvirtual java/awt/Canvas/<init>()V
  aload_0
  aload_1
  invokevirtual MultiLineLabel/newLabel(Ljava/lang/String;)V
  aload_0
  iload_2
  putfield MultiLineLabel/margin_width I
  aload_0
  iload_3
  putfield MultiLineLabel/margin_height I
  aload_0
  invokevirtual MultiLineLabel/CENTER()I
  aload_0
  swap
  putfield MultiLineLabel/alignment I
  return
.end method

.method public LEFT()I
  .limit locals 1
  .limit stack 1
  iconst_0
  ireturn
.end method

.method public CENTER()I
  .limit locals 1
  .limit stack 1
  iconst_1
  ireturn
.end method

.method public RIGHT()I
  .limit locals 1
  .limit stack 1
  iconst_2
  ireturn
.end method

.method public newLabel(Ljava/lang/String;)V
  .limit locals 4
  .limit stack 5
  new java/util/StringTokenizer
  dup
  aload_1
  ldc "\n"
  iconst_0
  invokenonvirtual java/util/StringTokenizer/<init>(Ljava/lang/String;Ljava/lang/String;Z)V
  astore_2
  aload_2
  invokevirtual java/util/StringTokenizer/countTokens()I
  aload_0
  swap
  putfield MultiLineLabel/num_lines I
  new StringVector
  dup
  aload_0
  getfield MultiLineLabel/num_lines I
  iconst_1
  invokenonvirtual StringVector/<init>(II)V
  aload_0
  swap
  putfield MultiLineLabel/lines LStringVector;
  new IntVector
  dup
  aload_0
  getfield MultiLineLabel/num_lines I
  iconst_1
  invokenonvirtual IntVector/<init>(II)V
  aload_0
  swap
  putfield MultiLineLabel/line_widths LIntVector;
  iconst_0
  istore_3
  start_0:
  iload_3
  aload_0
  getfield MultiLineLabel/num_lines I
  if_icmpge stop_1
  aload_0
  getfield MultiLineLabel/lines LStringVector;
  aload_2
  ldc "\n"
  invokevirtual java/util/StringTokenizer/nextToken(Ljava/lang/String;)Ljava/lang/String;
  invokevirtual StringVector/add(Ljava/lang/Object;)V
  iinc 3 1
  goto start_0
  stop_1:
  return
.end method

.method public measure()V
  .limit locals 3
  .limit stack 4
  aload_0
  aload_0
  invokevirtual java/awt/Component/getFont()Ljava/awt/Font;
  invokevirtual java/awt/Component/getFontMetrics(Ljava/awt/Font;)Ljava/awt/FontMetrics;
  astore_1
  aload_1
  aconst_null
  if_acmpne stop_0
  return
  stop_0:
  aload_1
  invokevirtual java/awt/FontMetrics/getHeight()I
  aload_0
  swap
  putfield MultiLineLabel/line_height I
  aload_1
  invokevirtual java/awt/FontMetrics/getAscent()I
  aload_0
  swap
  putfield MultiLineLabel/line_ascent I
  aload_0
  iconst_0
  putfield MultiLineLabel/max_width I
  iconst_0
  istore_2
  start_3:
  iload_2
  aload_0
  getfield MultiLineLabel/num_lines I
  if_icmpge stop_4
  aload_0
  getfield MultiLineLabel/line_widths LIntVector;
  aload_1
  aload_0
  getfield MultiLineLabel/lines LStringVector;
  iload_2
  invokevirtual StringVector/sub(I)Ljava/lang/String;
  invokevirtual java/awt/FontMetrics/stringWidth(Ljava/lang/String;)I
  invokevirtual IntVector/add(I)V
  aload_0
  getfield MultiLineLabel/line_widths LIntVector;
  iload_2
  invokevirtual IntVector/sub(I)I
  aload_0
  getfield MultiLineLabel/max_width I
  if_icmple stop_7
  aload_0
  getfield MultiLineLabel/line_widths LIntVector;
  iload_2
  invokevirtual IntVector/sub(I)I
  aload_0
  swap
  putfield MultiLineLabel/max_width I
  stop_7:
  iinc 2 1
  goto start_3
  stop_4:
  return
.end method

.method public setLabel(Ljava/lang/String;)V
  .limit locals 2
  .limit stack 2
  aload_0
  aload_1
  invokevirtual MultiLineLabel/newLabel(Ljava/lang/String;)V
  aload_0
  invokevirtual MultiLineLabel/measure()V
  aload_0
  invokevirtual java/awt/Component/repaint()V
  return
.end method

.method public setFont(Ljava/awt/Font;)V
  .limit locals 2
  .limit stack 2
  aload_0
  aload_1
  invokenonvirtual java/awt/Component/setFont(Ljava/awt/Font;)V
  aload_0
  invokevirtual MultiLineLabel/measure()V
  aload_0
  invokevirtual java/awt/Component/repaint()V
  return
.end method

.method public setForeground(Ljava/awt/Color;)V
  .limit locals 2
  .limit stack 2
  aload_0
  aload_1
  invokenonvirtual java/awt/Component/setForeground(Ljava/awt/Color;)V
  aload_0
  invokevirtual java/awt/Component/repaint()V
  return
.end method

.method public setAlignment(I)V
  .limit locals 2
  .limit stack 3
  aload_0
  iload_1
  putfield MultiLineLabel/alignment I
  aload_0
  invokevirtual java/awt/Component/repaint()V
  return
.end method

.method public setMarginWidth(I)V
  .limit locals 2
  .limit stack 3
  aload_0
  iload_1
  putfield MultiLineLabel/margin_width I
  aload_0
  invokevirtual java/awt/Component/repaint()V
  return
.end method

.method public setMarginHeight(I)V
  .limit locals 2
  .limit stack 3
  aload_0
  iload_1
  putfield MultiLineLabel/margin_height I
  aload_0
  invokevirtual java/awt/Component/repaint()V
  return
.end method

.method public getAlignment()I
  .limit locals 1
  .limit stack 1
  aload_0
  getfield MultiLineLabel/alignment I
  ireturn
.end method

.method public getMarginWidth()I
  .limit locals 1
  .limit stack 1
  aload_0
  getfield MultiLineLabel/margin_width I
  ireturn
.end method

.method public getMarginHeight()I
  .limit locals 1
  .limit stack 1
  aload_0
  getfield MultiLineLabel/margin_height I
  ireturn
.end method

.method public addNotify()V
  .limit locals 1
  .limit stack 1
  aload_0
  invokenonvirtual java/awt/Canvas/addNotify()V
  aload_0
  invokevirtual MultiLineLabel/measure()V
  return
.end method

.method public preferredSize()Ljava/awt/Dimension;
  .limit locals 1
  .limit stack 6
  new java/awt/Dimension
  dup
  aload_0
  getfield MultiLineLabel/max_width I
  iconst_2
  aload_0
  getfield MultiLineLabel/margin_width I
  imul
  iadd
  aload_0
  getfield MultiLineLabel/num_lines I
  aload_0
  getfield MultiLineLabel/line_height I
  imul
  iconst_2
  aload_0
  getfield MultiLineLabel/margin_height I
  imul
  iadd
  invokenonvirtual java/awt/Dimension/<init>(II)V
  areturn
.end method

.method public minimumSize()Ljava/awt/Dimension;
  .limit locals 1
  .limit stack 5
  new java/awt/Dimension
  dup
  aload_0
  getfield MultiLineLabel/max_width I
  aload_0
  getfield MultiLineLabel/num_lines I
  aload_0
  getfield MultiLineLabel/line_height I
  imul
  invokenonvirtual java/awt/Dimension/<init>(II)V
  areturn
.end method

.method public paint(Ljava/awt/Graphics;)V
  .limit locals 6
  .limit stack 4
  new joos/lib/JoosDimension
  dup
  aload_0
  invokevirtual java/awt/Component/size()Ljava/awt/Dimension;
  invokenonvirtual joos/lib/JoosDimension/<init>(Ljava/awt/Dimension;)V
  astore 5
  aload_0
  getfield MultiLineLabel/line_ascent I
  aload 5
  invokevirtual joos/lib/JoosDimension/height()I
  aload_0
  getfield MultiLineLabel/num_lines I
  aload_0
  getfield MultiLineLabel/line_height I
  imul
  isub
  iconst_2
  idiv
  iadd
  istore_3
  iconst_0
  istore 4
  start_0:
  iload 4
  aload_0
  getfield MultiLineLabel/num_lines I
  if_icmpge stop_1
  aload_0
  getfield MultiLineLabel/alignment I
  aload_0
  invokevirtual MultiLineLabel/LEFT()I
  if_icmpne else_4
  aload_0
  getfield MultiLineLabel/margin_width I
  istore_2
  goto stop_5
  else_4:
  aload_0
  getfield MultiLineLabel/alignment I
  aload_0
  invokevirtual MultiLineLabel/RIGHT()I
  if_icmpne else_8
  aload 5
  invokevirtual joos/lib/JoosDimension/width()I
  aload_0
  getfield MultiLineLabel/margin_width I
  isub
  aload_0
  getfield MultiLineLabel/line_widths LIntVector;
  iload 4
  invokevirtual IntVector/sub(I)I
  isub
  istore_2
  goto stop_9
  else_8:
  aload 5
  invokevirtual joos/lib/JoosDimension/width()I
  aload_0
  getfield MultiLineLabel/line_widths LIntVector;
  iload 4
  invokevirtual IntVector/sub(I)I
  isub
  iconst_2
  idiv
  istore_2
  stop_9:
  stop_5:
  iload_3
  aload_0
  getfield MultiLineLabel/line_height I
  iadd
  istore_3
  aload_1
  aload_0
  getfield MultiLineLabel/lines LStringVector;
  iload 4
  invokevirtual StringVector/sub(I)Ljava/lang/String;
  iload_2
  iload_3
  invokevirtual java/awt/Graphics/drawString(Ljava/lang/String;II)V
  iinc 4 1
  goto start_0
  stop_1:
  return
.end method

