Witam, tak jak w tytule :)

package SnakeP;

import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Graphics2D;

import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Panel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class SnakeFrame {

    private JFrame frame;

    public static void main(String[] args) {
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    SnakeFrame window = new SnakeFrame();
                    window.frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    public SnakeFrame() {
        initialize();
    }

    private void initialize() {
        frame = new JFrame();
        frame.setBounds(100, 100, 500, 500);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setTitle("Snake");

        JPanel panel = new JPanel();
        panel.getRootPane().add(panel, BorderLayout.CENTER); {
            public void paintComponent(Graphics g) { //tutaj pojawia się problem :/
                super.paintComponent(g);
                g.drawRect(100, 100, 100, 100);
                g.setColor(Color.BLACK);
            }

        }

        }
    }