opl2java
House.java
import psion.opl.*;
import java.applet.*;

public class House
  extends Applet
  implements Runnable
{
  private static OPL opl;

  int cw = 0;

  double test_()
  {
    init_(  );
    opl.print( "Hello World!" );
    house_(  );
    colwind_(  );
    return 0;
  }

  double init_()
  {
    opl.print( "Init" );
    return 0;
  }

  double house_()
  {
    opl.gAt( 100, 60 );
    opl.gBox( 200, 80 );
    opl.gAt( 100, 60 );
    opl.gLineBy( 50, - 40 );
    opl.gLineBy( 100, 0 );
    opl.gLineBy( 50, 40 );
    return 0;
  }

  double colwind_()
  {
    cw = opl.gCreate( 0, 0, 82, 24, 1, 1 );
    opl.gAt( 4, 4 );
    opl.gBox( 25, 15 );
    opl.gGrey( 1 );
    opl.gAt( 29, 5 );
    opl.gFill( 23, 13, 0 );
    opl.gGrey( 0 );
    opl.gAt( 52, 4 );
    opl.gFill( 25, 15, 0 );
    opl.gTMode( 2 );
    opl.gAt( 25 * 2 + 11, 17 );
    opl.gPrint( "2" );
    opl.print( "Window 2" );
    opl.gTMode( 0 );
    return 0;
  }

  private Thread thread;

  public void init()
  {
    opl = new OPL( this );

    requestFocus();
  }

  public void start()
  {
    if( thread != null )
    {
      thread.stop();
      thread = null;
    }

    thread = new Thread( this );
    thread.start();
    requestFocus();
  }

  public void stop()
  {
    if( thread != null )
    {
      thread.stop();
      thread = null;
    }
  }

  public void destroy()
  {
    stop();
  }

  public void run()
  {
    try
    {
      test_();
      System.out.println( "Program exited." );
    }
    catch( Throwable e )
    {
      System.out.println( "Runtime Error: " + e );
      e.printStackTrace();
      System.out.println( "Program has exited abnormally." );
    }
  }

  public void paint( java.awt.Graphics g )
  {
    opl.screen.paint( g );
  }
}