import java.awt.*; import java.applet.*; public class auto1 extends Applet { static car a=new car(100,Color.blue,0,0); public void paint(Graphics g) { a.bild(g); } } class car { int po,fo,vm; //po: Position, fo: Form, vm: max.Geschwindigkeit Color co; //co: Wagenfarbe public car(int xa,Color aco,int fof,int vmx) { //Konstruktor deklarieren po=xa;co=aco;fo=fof;vm=vmx; } public void bild(Graphics g) { int x[]=new int[4],y[]=new int[4]; //Deklarationen für Punktkoordinaten g.setColor(co); //Farbe einstellen g.fillRect(po,60,60,12); //unteres Rechteck x[0]=po+10;y[0]=60;x[1]=po+25;y[1]=50; //Punktkoordinaten x[2]=po+fo+34;y[2]=50; x[3]=po+59;y[3]=60; g.drawPolygon(x,y,4); //obere Fensterfläche g.drawLine(po+34,51,po+32,59); //Trennlinie im oberen Trapez g.setColor(new Color(80,80,100)); //Farbe Anthrazit g.fillOval(po+7,67,10,10); //Vorderrad g.fillOval(po+40,67,10,10); //Hinterrad } }