What is the difference between paint() and paintComponent()?
I always confuse by them?
Thanks
I always confuse by them?
Thanks
http://java.sun.com/docs/books/tutorial/uiswing/painting/index.html
paintComponent is the method used by Swing components to do the painting necessary for the component. If you are making a custom Swing component, it is recommended that you override paintComponent instead of paint. Non-swing AWT components do not have a paintComponent method.
A Swing component's default paint() method partitions the painting of a component into separate phases, including painting the component itself, painting the component's border, and finally painting all its children.Overriding paintComponent in a custom Swing component only affects the drawing of the component itself without impacting these other phases of drawing.