[3083] in java-interest
Re: [Q]:repaint() not calling update(..)?
daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Mon Oct 30 13:04:24 1995
From: Arthur.Vanhoff@Eng.Sun.COM (Arthur van Hoff)
To: fhlee@shadow.csd.csam.com.my (Lee Fook Heng)
Date: Mon, 30 Oct 1995 08:21:00 -0800 (PST)
Cc: java-interest@webrunner.neato.org (java)
In-Reply-To: <199510300951.RAA06829@shadow> from "Lee Fook Heng" at Oct 30, 95 05:51:26 pm
Hi Lee,
> I am having some problem with repaint() in my java applet
> program. If I understand correctly, repaint() is suppose to
> call update(..), however, the update(..) in my applet never
> gets called.
The reason that update() isn't called is that you are using
100% of the CPU calling repaint(). update() is only called when
the system is not busy. Try putting a sleep() in your for loop.
Have fun,
Arthur van Hoff
> Below is my sample applet:
>
>
> import java.awt.*;
> import java.applet.Applet;
> import java.lang.*;
>
> public class Fract extends Applet implements Runnable{
>
> Thread p;
>
> public void run(){
> for(;;){
> System.out.println("in run()");
> repaint();
> }
> }
>
> public void init(){
> resize(500,500);
> }
>
> public void start(){
> p = new Thread(this);
> p.start();
> }
>
> public void update(Graphics g){
> System.out.println("In update");
> }
> }
>
>
> Anybody know what is wrong with the above code, or, how can I have
> repaint() to call update().
>
> Thanks for any help.
>
> -- Lee, Fook Heng
> -
> This message was sent to the hotjava-interest mailing list
> Info: send 'help' to hotjava-interest-request@java.sun.com
>
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com