AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Newbie thread.sleep probs with Mac OSX

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
Lothar Sturm
Guest





PostPosted: Sat Jul 30, 2005 4:30 pm    Post subject: Newbie thread.sleep probs with Mac OSX Reply with quote



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);
}
}
}


--
Fuer Replies XX bitte loeschen.
No html-Mails please!
Back to top
John B. Matthews
Guest





PostPosted: Sun Jul 31, 2005 2:22 am    Post subject: Re: Newbie thread.sleep probs with Mac OSX Reply with quote



In article <1h0iz5x.1ovbfxnvpko12N%lotstuXX (AT) arcor (DOT) de>,
[email]lotstuXX (AT) arcor (DOT) de[/email] (Lothar Sturm) wrote:

Quote:
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);
}
}
}

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

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

Back to top
John B. Matthews
Guest





PostPosted: Sun Jul 31, 2005 2:22 am    Post subject: Re: Newbie thread.sleep probs with Mac OSX Reply with quote



In article <1h0iz5x.1ovbfxnvpko12N%lotstuXX (AT) arcor (DOT) de>,
[email]lotstuXX (AT) arcor (DOT) de[/email] (Lothar Sturm) wrote:

Quote:
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);
}
}
}

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

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

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.