import java.awt.*; import java.applet.Applet; import java.awt.event.*; import java.awt.image.*; public class Toru extends Applet implements AdjustmentListener{ Scrollbar sb=new Scrollbar(Scrollbar.VERTICAL, 2, 10, 2, 400); public Toru(){ setLayout(new BorderLayout()); add(sb, BorderLayout.WEST); sb.addAdjustmentListener(this); } public void paint(Graphics g){ int x=100; int y=100; int laius=sb.getValue(); int korgus=sb.getValue(); while(laius>2){ laius=laius-1; korgus=korgus-1; x=x+laius/2; y=y+laius/2; g.drawOval(x,y,laius,korgus); } } public void adjustmentValueChanged(AdjustmentEvent e){ repaint(); } public static void main(String argumendid[]){ Frame f=new Frame("5 ringi"); f.add(new Toru()); f.setSize(500, 500); f.setVisible(true); } }