File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes repaint Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "repaint" Watch "repaint" New topic
Author

repaint

saravanan ragunathan
Ranch Hand

Joined: Aug 02, 2010
Posts: 84


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"
Kevin Workman
Ranch Hand

Joined: Sep 28, 2010
Posts: 151
If you want help, you should provide an SSCCE that demonstrates the problem.
Lester Burnham
Rancher

Joined: Oct 14, 2008
Posts: 1337
If you're using Swing then generally you shouldn't be using paint, but rather paintComponent. See http://java.sun.com/products/jfc/tsc/articles/painting/#callbacks
Kevin Workman
Ranch Hand

Joined: Sep 28, 2010
Posts: 151
Lester Burnham wrote:If you're using Swing then generally you shouldn't be using paint, but rather paintComponent. See http://java.sun.com/products/jfc/tsc/articles/painting/#callbacks


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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: repaint
 
Similar Threads
Help! Why isn't my Window paint method called?
Problems with a program...
Canvas not displaying
paint (), repaint() or update()
How do you draw in a frame?