import java.awt.*;
import java.awt.event.*;
import javax.swing.*;public class Tank extends JFrame {

int x = 50, y = 50;

public void paint(Graphics g) {
Color c = g.getColor();
g.setColor(Color.RED);
g.fillOval(x, y, 30, 30);
g.setColor(c);

y += 5;
} public void lauchFrame() {
this.setLocation(400, 300);
this.setSize(800, 600);
this.setTitle("TankWar");
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
this.setResizable(false);
this.setBackground(Color.GREEN);
setVisible(true);

new Thread(new PaintThread()).start();
} public static void main(String[] args) {
Tank tc = new Tank();
tc.lauchFrame();
}

 class PaintThread extends Thread { public void run() {
while(true) {
repaint();
try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}

}}