Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / July 2005

Tip: Looking for answers? Try searching our database.

Newbie thread.sleep probs with Mac OSX

Thread view: 
Lothar Sturm - 30 Jul 2005 17:30 GMT
Hello,

could anyone help Java-Dummy with Mac OSX (3.9 and 4.2)?
I found this little applet below, but it doesn't work with OSX. It is
well doing the pause on Win XP and Mac OS9.

Could you give me a tip or link, how to create java-code which works on
nearly all systems?

Thank you!

Lothar

here is the applet:

import java.applet.*;
import java.awt.*;
public class Scheibea extends Applet{
public Scheibea(){
setBackground(Color.green);
}
public void zeitschleife(){
try {Thread.sleep(500);}
catch(InterruptedException e) {return;}
}
public void paint(Graphics stift){
for (int x=50;x<500;x=x+10){
stift.setColor(Color.red);
stift.drawOval(x,100,30,30);
zeitschleife();
stift.setColor(Color.blue);
stift.drawOval(x,100,30,30);
}
}
}

Signature

Fuer Replies XX bitte loeschen.
No html-Mails please!

John B. Matthews - 31 Jul 2005 03:22 GMT
> Hello,
>
[quoted text clipped - 31 lines]
> }
> }

It looks like the Thread that's sleeping is not the same one that's
painting. To see another approach, have a look at the Sun example below;
it's included when you install Xcode:

/Developer/Examples/Java/Applets/NervousText/NervousText.java

Signature

John
jmatthews at wright dot edu
www dot wright dot edu/~john.matthews/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.