import java.awt.*;
import java.awt.event.*;
public class DialApplet extends java.applet.Applet
implements DialListener, AdjustmentListener {
final int max = 100;
Scrollbar scrollbar = new Scrollbar( Scrollbar.HORIZONTAL, 0, 1, 0, max );
Dial dial = new Dial( max );
public void init() {
setLayout( new BorderLayout() );
dial.addDialListener( this );
add( "Center", dial );
scrollbar.addAdjustmentListener( this );
add( "South", scrollbar );
}
public void dialAdjusted( DialEvent e ) {
scrollbar.setValue( e.getValue() );
}
public void adjustmentValueChanged( AdjustmentEvent e ) {
dial.setValue( e.getValue() );
}
}
|