Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with repaint method

807589Sep 28 2008 — edited Nov 21 2008
import java.awt.*;
import java.applet.*;

public class Circle implements Runnable {
Thread t;
//stuff
public Circle()
{
	t = new Thread (this);
	t.start();
}
public void run()
{
	try {
        while (true) {
           repaint();
           t.sleep( 1000 );
        }
     }
     catch (InterruptedException e) { }

}
public void paint( Graphics g ) 
{
//stuff
}

}
That's some of my code so far, but it keeps saying "The method repaint() is undefined for the type Enemy"
I've tried java.applet.Applet.repaint(); and about a hundred other things, but I can't get anything to work
Another error that i get is "Cannot make a static reference to the non-static method repaint() from the type Component"

I've used threads maybe once or twice before, but just to create simple animations.
needless to say I'm not that experienced with programming yet...
If anybody could help me I'd greatly appreciate it.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 19 2008
Added on Sep 28 2008
8 comments
535 views