I have no problem using repaint(). But I'm curious to know what it does inside.
Does it simply call the paintComponent() method again or do something special?
I can't imagine how the program will know what and how to repaint if it doesn't call my overridden paintComponent() method
Thanks for any explanations.
The BEST user interface design I've ever seen? --- A flush toilet.
Do you know that you have the source of all the JDK classes on your hard disk? Look in your JDK installation folder for a file src.zip.
You can see from the API that the repaint() method is inherited from Component. In Component, it calls repaint(long tm, int x, int y, int width, int height) with appropriate parameters. For AWT classes, that method either calls the same method of the Component's Container, or posts a PaintEvent to the EventQueue.
JComponent overrides the latter method to add a "dirty region" to the Swing RepaintManager, which pushes the painting requirement to the SystemEventQueue via SystemEventQueueUtilities.
Oh, and the outcome will be to invoke paint(...). Read the API for JComponent#paint(...) to see what that does.
There are no new questions, but there may be new answers.
subject: JPanel repaint(): what does it do inside?