Methods Summary |
---|
public void | destroy() Thread toGo = t;
t = null;
toGo.interrupt();
|
public void | init() // get data from HTML
String s = getParameter( "FontSize" );
int points;
if( s == null )
{ points = 10;
}
else
{ points = Integer.parseInt( s.trim() );
}
s = getParameter( "Delay" );
if( s == null )
{ delay = 50;
}
else
{ delay = Integer.parseInt( s.trim() );
}
s = getParameter( "Lines" );
int lines;
if( s == null )
{ lines = 0;
}
else
{ lines = Integer.parseInt( s.trim() );
}
if( lines > 0 )
{ text = new String[ lines ];
int line;
for( line = 0; line < lines; line += 1 )
{ String name = "Line" + line;
text[line] = getParameter( name );
}
}
setLayout( new BorderLayout() );
display.setFont( new Font( "Serif", Font.PLAIN, points ) );
add( display ); // Center is default (1.1/1.0.2)
// Thread bits
t = new Thread( this );
t.start();
suspended = true;;
|
private void | outputChar(char ch) display.insert( "" + ch, display.getText().length()-1 );
t.sleep( delay );
|
public void | run() Thread current = Thread.currentThread();
while( t == current )
{ try
{ while( suspended )
{ synchronized(this)
{ wait();
}
}
int line;
for( line=0; line < text.length; line += 1 )
{ for( int ch = 0; ch < text[line].length(); ch += 1 )
{ outputChar( text[line].charAt( ch ) );
}
outputChar( '\n" );
}
for( line = 0; line < 10; line += 1 )
{ outputChar( '\n" );
}
display.setText( "_" );
}
catch( InterruptedException ioe )
{}
}
|
public void | start()
synchronized(this)
{ suspended = false;
notify();
}
|
public void | stop() suspended = true;
|