“applet” class
import java.awt.*; import java.applet.*; public class applet extends Applet{ public void paint(Graphics g){ int total = 5; int x,y; Font font = new Font("Verdana", Font.BOLD, 42); Dimension d = getSize(); x=d.width;y=d.height/2; // create buildings int bw=d.width,by = d.height; int ar[] = {160,190,59,222,355,458,125} ; g.drawLine(x+34,y,x+60,y-25); g.drawLine(x+34,y,x+60,y-25); // while loop while(true){ g.setColor(Color.BLACK); bw=d.width; int i=0; while(bw>0){ // internal building creation g.drawLine(bw,by,bw,by-ar[i]); g.drawLine(bw-50,by,bw-50,by-ar[i]); g.drawLine(bw,by-ar[i],bw-50,by-ar[i]); int window = 10,height = by; while(height>0){ g.drawRect(bw-5,by,bw-35,height-15); height-=20; } bw-=50; if(i>4) i=0; else i++; } g.setFont(font); g.setColor(Color.WHITE); g.drawLine(x,y,x+100,y); g.drawLine(x,y+15,x+100,y+15); g.drawLine(x+100,y,x+100,y+15); //wing up g.drawLine(x+34,y,x+60,y-25); g.drawLine(x+44,y,x+70,y-25); g.drawLine(x+60,y-25,x+70,y-25); // wing down g.drawLine(x+34,y+15,x+60,y+25+15); g.drawLine(x+44,y+15,x+70,y+25+15); g.drawLine(x+60,y+25+15,x+70,y+25+15); // plane nose g.drawLine(x,y,x-10,y+7); g.drawLine(x,y+15,x-10,y+8); // plane end top g.drawLine(x+90,y,x+100,y-10); g.drawLine(x+100,y-10,x+100,y); try{ Thread.sleep(50); } catch(InterruptedException e){}; g.setColor(Color.GREEN); g.fillRect(0,0,d.width,d.height); g.setColor(Color.WHITE); if(xHTML File
How to Run
After compilation you can use "appletviewer" to run your applet.
appletviewer xyz.html