If you haven't already done so, it may help to look at
The Java Tutorials: Performing Custom Painting at
https://docs.oracle.com/javase/tutorial/uiswing/painting/index.html
In particular, the section titled "A Closer Look at the Paint Mechanism".
Basically, repaint() does not perform any actual painting, but instead schedules an event on a "repaint queue" meaning that Java will invoke the class's paint() method at its next opportunity. Java implements a strategy for scheduling repaints that tries to make rendering as efficient as possible. To do so, it sometimes compresses actions, treating multiple calls to overlapping calls to repaint() as a single action. So repaint() is what you call when you want to
trigger a paint operation. Your main method does that just fine. I would discourage you from overriding or otherwise modifying the repaint() methods, especially if you want to produce maintainable code.
Also, at least at the beginning of your exploration, the method of JPanel that you want to override is paintComponent(), which is called by paint(), not paint() itself. That section on "A Closer Look" gives some more details on this issue.
Gary