Scroll Bars:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*<applet code="ScrollBarDemo" width=300 height=300></applet>*/
public class ScrollBarDemo extends Applet implements AdjustmentListener
{
TextArea ta;
public void init()
{
Scrollbar sb=new Scrollbar(Scrollbar.HORIZONTAL,50,5,0,100);
sb.addAdjustmentListener(this);
add(sb);
ta=new TextArea(10,20);
add(ta);
}
public void adjustmentValueChanged(AdjustmentEvent ae)
{
Scrollbar sb=(Scrollbar)ae.getAdjustable();
ta.append("Adjustment Event:"+sb.getValue()+"\n");
}
}
Comments
Post a Comment