Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 delay in java
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
nate




PostPosted: Fri Jan 16, 2004 9:43 am   Post subject: delay in java

How do you do basically a delay in java?

in turing its delay (int)


so how would you draw a circle movinng around in an applet? I can make it move but you can barley see it because it does not delay.

Thanks
Sponsor
Sponsor
Sponsor
sponsor
BlAcK TuRtLe




PostPosted: Fri Jan 16, 2004 9:56 am   Post subject: (No subject)

just use a garbage delay. Throw in a bunch of calculations into a for structure. For example:
code:

for(int x=1;x<=9999999;x++)
{
b=x+29488-192943*444;
}
rizzix




PostPosted: Fri Jan 16, 2004 3:19 pm   Post subject: (No subject)

hehe, well one thing is for sure every time u run that code it will have a different delay.

my suggestion use the languages builtin delay mechanism

all u need to do is call the method public static void Thread.sleep(long milliseconds), passing it a long value as the number of milliseconds u want the "main thread" of ur program to stop execution. It effectively is the same as turing's delay, but a little bit different in concept.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: