can anyone help me how to and where to put main method on here ?
is that the reason why Im getting this message ?


Java Code:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import javax.swing.JFrame;

import java.util.Random;

 

 

public class saver extends JPanel implements ActionListener

{

    private Random generator = new Random();

    Timer t, x;

    int x1, y1, count;

     

    saver()

    {

        t = new Timer(1000,this);  
        t.setInitialDelay(1000);

        t.setDelay(1000);

        t.start();

    }

    public void paintComponent(Graphics screen)

    {

        super.paintComponent(screen);

        Graphics2D screen2d = (Graphics2D)screen;

         

        screen.setColor(Color.black);

        screen.fillRect(0, 0, getWidth(), getHeight());

         

        int rd, grn, bl, shape, count;

         

        for(int i = 20; i > 0; i--)

        {

            shape = generator.nextInt(12);

            if(shape == 0)

            {

                rd = (int) (Math.random()*255);

                grn = (int)(Math.random()*255);

                bl = (int) (Math.random()*255);

                screen.setColor(new Color(rd,grn,bl,255));

                x1 = (int)(Math.random()*getWidth());

                y1 = (int)(Math.random()*getHeight());

                screen.fillArc(x1, y1, 100, 100, 360, 180);

            }

            if(shape == 1)

            {

                rd = (int) (Math.random()*255);

                grn = (int)(Math.random()*255);

                bl = (int) (Math.random()*255);

                screen.setColor(new Color(rd,grn,bl,255));

                x1 = (int)(Math.random()*getWidth());

                y1 = (int)(Math.random()*getHeight());

                screen.fillRect(x1, y1, 100, 100);

            }

            if(shape == 2)

            {

                rd = (int) (Math.random()*255);

                grn = (int)(Math.random()*255);

                bl = (int) (Math.random()*255);

                screen.setColor(new Color(rd,grn,bl,255));

                x1 = (int)(Math.random()*getWidth());

                y1 = (int)(Math.random()*getHeight());

                screen.fillOval(x1, y1, 100, 100);

            }

            if(shape == 3)

            {

                rd = (int) (Math.random()*255);

                grn = (int)(Math.random()*255);

                bl = (int) (Math.random()*255);

                screen.setColor(new Color(rd,grn,bl,255));

                x1 = (int)(Math.random()*getWidth());

                y1 = (int)(Math.random()*getHeight());

                screen.fillRoundRect(x1, y1, 100, 100, 50, 50);

            }

            if(shape == 4)

            {
                rd = (int) (Math.random()*255);

                grn = (int)(Math.random()*255);

                bl = (int) (Math.random()*255);

                screen.setColor(new Color(rd,grn,bl,255));

                x1 = (int)(Math.random()*getWidth());

                y1 = (int)(Math.random()*getHeight());

                screen.fillArc(x1, y1, 100, 100, 90, 180);

            }

            if(shape == 5)

            {

                rd = (int) (Math.random()*255);

                grn = (int)(Math.random()*255);

                bl = (int) (Math.random()*255);

                screen.setColor(new Color(rd,grn,bl,255));

                x1 = (int)(Math.random()*getWidth());

                y1 = (int)(Math.random()*getHeight());

                screen.fillArc(x1, y1, 100, 100, 180, 180);

            }

            if(shape == 6)

            {

                rd = (int) (Math.random()*255);

                grn = (int)(Math.random()*255);

                bl = (int) (Math.random()*255);

                screen.setColor(new Color(rd,grn,bl,255));

                x1 = (int)(Math.random()*getWidth());

                y1 = (int)(Math.random()*getHeight());

                screen.fillArc(x1, y1, 100, 100, 270, 180);

            }

            if(shape == 7)

            {

                rd = (int) (Math.random()*255);

                grn = (int)(Math.random()*255);

                bl = (int) (Math.random()*255);

                screen.setColor(new Color(rd,grn,bl,255));

                x1 = (int)(Math.random()*getWidth());

                y1 = (int)(Math.random()*getHeight());

                screen.fillRect(x1, y1, 200, 200);

            }

            if(shape == 8)

            {

                rd = (int) (Math.random()*255);

                grn = (int)(Math.random()*255);

                bl = (int) (Math.random()*255);

                screen.setColor(new Color(rd,grn,bl,255));

                x1 = (int)(Math.random()*getWidth());

                y1 = (int)(Math.random()*getHeight());

                screen.fillRect(x1, y1, 300, 100);

            }

            if(shape == 9)

            {

                rd = (int) (Math.random()*255);

                grn = (int)(Math.random()*255);

                bl = (int) (Math.random()*255);
                screen.setColor(new Color(rd,grn,bl,255));

                x1 = (int)(Math.random()*getWidth());

                y1 = (int)(Math.random()*getHeight());

                screen.fillRect(x1, y1, 100, 300);

            }

            if(shape == 10)

            {

                rd = (int) (Math.random()*255);

                grn = (int)(Math.random()*255);

                bl = (int) (Math.random()*255);

                screen.setColor(new Color(rd,grn,bl,255));

                x1 = (int)(Math.random()*getWidth());

                y1 = (int)(Math.random()*getHeight());

                screen.fillOval(x1, y1, 300, 100);

            }

            if(shape == 11)
            {

                rd = (int) (Math.random()*255);

                grn = (int)(Math.random()*255);

                bl = (int) (Math.random()*255);

                screen.setColor(new Color(rd,grn,bl,255));

                x1 = (int)(Math.random()*getWidth());

                y1 = (int)(Math.random()*getHeight());

                screen.fillOval(x1, y1, 100, 300);

            }

        }
   

    }

      

    public void actionPerformed(ActionEvent e)

    {

            repaint(); 

    }

}