This is most likely because you are not extending the correct class. You need to extend JPanel
or any other class that contains it in order to call this super class. Right now it is looking for the paintComponent()
method in the default super class which is Object
and there is no paintComponent()
method there.
public class myClass extends JPanel {
...
}