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

public class NewPanel extends JComponent {
    private Image circles;

    public NewPanel() {
        super();

        this.circles = Toolkit.getDefaultToolkit().getImage("cercles.png");
    }

    @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());
        }

        newBrush.setColor(Color.BLUE);
        newBrush.drawRect(10, 10, 50, 50);
        newBrush.drawImage(this.circles, 150, 50, this);
        newBrush.setColor(Color.MAGENTA);
        newBrush.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 24));
        newBrush.drawString(">o<", 150, 50);
    }
}