import javax.swing.*;
import java.awt.*;

public class Circles extends JComponent {
    public Circles() {
        super();
    }

    @Override
    protected void paintComponent(Graphics brush) {
        Graphics newBrush = brush.create();
        
        if (this.isOpaque()) {
            newBrush.setColor(this.getBackground());
            newBrush.fillRect(0, 0, this.getWidth(), this.getHeight());
        }

        for (int x = 0; x < 5; x++) {
            for (int y = 0; y < 5; y++) {
                Color c = new Color(0, 70 + 37 * y, 70 + 37 * x);
                int sizeX = getWidth() / 5;
                int sizeY = getHeight() / 5;

                newBrush.setColor(c);
                newBrush.fillOval(sizeX * x, sizeY * y, sizeX, sizeY);
                newBrush.setColor(Color.WHITE);
                newBrush.fillOval(sizeX * x + sizeX / 4, sizeY * y + sizeY / 4, sizeX / 2, sizeY / 2);
            }
        }
    }
}