Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. // Jamison Allen
  2.  
  3.  
  4. import java.applet.Applet;
  5. import java.awt.*;
  6. public class Jet extends Applet {
  7. Graphics g;
  8. Image offscreen;
  9.  
  10. public void init() {
  11. resize (640, 480);
  12. offscreen = createImage (640, 480);
  13. g = offscreen.getGraphics( );
  14.  
  15. }
  16.  
  17. public void paint (Graphics vg) {
  18. int x = 10, y = 100, move, xmove = 3, ymove = 0;
  19. for (move = 1; move <= 150; move = move +1){
  20. g.setColor(Color.BLUE);
  21. g.fillRect(0, 0, 640, 480);
  22. g.setColor(Color.YELLOW);
  23. g.fillOval(150, 30, 100, 100);
  24.  
  25.  
  26. // draw fuselage
  27. int fuselageX [] = {x, x+10 ,x+20 ,x+90, x+120,x+20};
  28. int fuselageY [] = {y, y, y+10, y+10, y+20,y+20};
  29. g.setColor(Color.red);
  30. g.fillPolygon(fuselageX, fuselageY, 6);
  31.  
  32.  
  33.  
  34. vg.drawImage(offscreen,0,0,this);
  35. try { Thread.sleep(10);}
  36. catch(InterruptedException ie) {}
  37.  
  38. x = x + xmove;
  39. y = y + ymove;
  40. }
  41. }
  42. }
  43.  
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement