Описание тега paintcomponent
NonePaintComponent (JComponent.paintComponent(Graphics g)) is a method that Java Swing engine calls on JComponent, in order to draw it using the passed Graphics.
paintComponent is responsible for drawing contents of the JComponent, excluding border and possible children. Same as Canvas.paint, it may be overridden but is seldom called directly.
For custom Swing JComponent, it is overridden to paint a deeply custom content, in somewhat similar fashion as paint(Graphics) is overridden for Canvas (border and children as still painted as by default).
The passed parameter (Graphics) is actually Graphics2D and can be casted to use advanced features.
Standard Swing components delegate the call to the attached ComponentUI that paints the component by the rules of the current skin (look & fell).