8 public static void main(String[] args) {
14 JFrame frame =
new JFrame();
15 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
16 MyAnimPanel animPanel =
new MyAnimPanel();
18 frame.setSize(300, 300);
19 frame.setVisible(
true);
20 for (
int i = 0; i < 130; i++) {
26 }
catch (Exception ex) { }
30 class MyAnimPanel
extends JPanel {
31 public void paintComponent(Graphics g) {
32 g.clearRect(0, 0, this.getWidth(), this.getHeight());
33 g.setColor(Color.GREEN);
34 g.fillOval(x, y, 40, 40);