What is the difference between paint() and paintComponent()?

I always confuse by them?

Thanks

[45 byte] By [ardmorea] at [2007-11-27 10:27:44]
# 1

http://java.sun.com/docs/books/tutorial/uiswing/painting/index.html

CaptainMorgan08a at 2007-7-28 17:47:42 > top of Java-index,Security,Cryptography...
# 2

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.

markt1964a at 2007-7-28 17:47:42 > top of Java-index,Security,Cryptography...