The moose likes Threads and Synchronization and the fly likes Problems with Threads in an Applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Problems with Threads in an Applet" Watch "Problems with Threads in an Applet" New topic

Problems with Threads in an Applet

jason adam
Chicken Farmer ()
Ranch Hand

Joined: May 08, 2001
Posts: 1932
Homework problem here, I'm creating an applet that draws 5 random lines on the applet. That's easy enough, got it all working good. However, just to challenge myself, I'm going beyond what the assignment wants and I decided to add a thread in here that will draw one line, sleep for a second, then draw another, etc. Thought it would "look" better than just the 5 lines all at once.
Anyway, when I added the thread part to the program, I no longer get any lines being drawn. I added some print statements that tell me where I am in my program, and it seems to be going through everything like it should, I'm just not getting anything printed out. I've used threads before in this same sort of context, but I can't seem to see why this wouldn't be working.
Any pointers would be great, don't worry about posting code
I agree. Here's the link:
subject: Problems with Threads in an Applet
It's not a secret anymore!