OnPaint() for Java?

1.1k Views Asked by At

All right real quick question guys. I know that C# Forms have the OnPaint() method that keeps on being called when its time to render. I know Java has a similar one but I am lost on how to implement it. Any pointers or example(prefferred) will be very much appreciated. Thanks a lot.

2

There are 2 best solutions below

1
On BEST ANSWER

If using Swing, refrain from painting in a top level container (e.g. JApplet or JFrame) and use a JComponent or JPanel.

For custom painting in the latter two classes, use paintComponent(Graphics).

0
On