Constructor - needs a reference to the Store object to use
The Putter class maintains an on-screen log and has a Run/Stop button
that can be used to control its actions
theStore = theStoreToUse;
setLayout( new BorderLayout() );
log = new Log( 30, 20 );
add( log, BorderLayout.CENTER );
add( runToggle, BorderLayout.SOUTH );
runToggle.addActionListener( new ActionListener() {
public void actionPerformed( ActionEvent e )
{
if( running )
{
running = false;
runToggle.setText( "Run" );
}
else
{
running = true;
runToggle.setText( "Stop" );
putRunner.interrupt();
}
}
});
putRunner = new Thread( this, "Putter" );
running = false;
putRunner.start();