import java.awt.*; public class raam2{ public static void main(String argumendid[]){ new Raam2ise () ; } } class Raam2ise extends Frame implements Runnable{ public Raam2ise (){ setSize(200, 100); setVisible(true); new Thread(this).start(); } public void run(){ double algnurk=0; boolean veel=true; while(veel){ Graphics g=this.getGraphics(); g.setColor(Color.black); joonista(g, algnurk); try{Thread.sleep(100);}catch(Exception e){} algnurk=algnurk+0.05; } } public void joonista(Graphics ekraan, double algnurk){ Image pilt=createImage(getWidth(), getHeight()); Graphics2D g=(Graphics2D)pilt.getGraphics(); double kiirus=15; g.setPaint( new GradientPaint((int)(kiirus*algnurk),(int)(kiirus*algnurk) , Color.red, (int)(kiirus*algnurk)+20,(int)(kiirus*algnurk)+20, Color.yellow, true) ); g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(Color.black); g.setStroke( new BasicStroke(5) ); double nurk=algnurk; double raadius=50; int keskx=getWidth()/2; int kesky=getHeight()/2; int vanax=keskx+(int)(raadius*Math.cos(nurk)); int vanay=kesky+(int)(raadius*Math.sin(nurk)); int uusx, uusy; for(int i=0; i<8; i++){ nurk=nurk+Math.PI/4; uusx=keskx+(int)(raadius*Math.cos(nurk)); uusy=kesky+(int)(raadius*Math.sin(nurk)); g.drawLine(vanax, vanay, uusx, uusy); vanax=uusx; vanay=uusy; } ekraan.drawImage(pilt, 0, 0, this); } }