Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Jamison Allen
- import java.applet.Applet;
- import java.awt.*;
- public class Jet extends Applet {
- Graphics g;
- Image offscreen;
- public void init() {
- resize (640, 480);
- offscreen = createImage (640, 480);
- g = offscreen.getGraphics( );
- }
- public void paint (Graphics vg) {
- int x = 10, y = 100, move, xmove = 3, ymove = 0;
- for (move = 1; move <= 150; move = move +1){
- g.setColor(Color.BLUE);
- g.fillRect(0, 0, 640, 480);
- g.setColor(Color.YELLOW);
- g.fillOval(150, 30, 100, 100);
- // draw fuselage
- int fuselageX [] = {x, x+10 ,x+20 ,x+90, x+120,x+20};
- int fuselageY [] = {y, y, y+10, y+10, y+20,y+20};
- g.setColor(Color.red);
- g.fillPolygon(fuselageX, fuselageY, 6);
- vg.drawImage(offscreen,0,0,this);
- try { Thread.sleep(10);}
- catch(InterruptedException ie) {}
- x = x + xmove;
- y = y + ymove;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement