i herad that when we cover appletviewer by another window and uncovers it,method repaintwill be called,
but in my program when i cover the appletviewer by another window the Line has been drawn was erased..
then i inserted the statement in paint method System.out.println("paint"); to check whether the thread invokes paint method
but it didn't invoke...could any one help me to recover this problem.
"I Love Java Ranch"
Joined: Sep 28, 2010
If you want help, you should provide an SSCCE that demonstrates the problem.
I agree that you should be using paintComponent, but it also means that you need to override JPanel (or JComponent) to do so. JApplet, what you're extending now, does not have a paintComponent method. So what you want to do is extend JPanel (or JComponent), override paintComponent, then set that as the JApplet's content pane.
Or you could, you know, post that SSCCE that demonstrates what you're trying to do. Up to you.