Code Comments
Programming Forum and web based access to our favorite programming groups.i have seperate methods like :
public void drawLogo ()
{
Graphics g = getGraphics ();
g.drawImage (logo, 0, 0, this); //logo is already been
initialized
}
i think that whenever you call g.drawImage is repaints or call g.--
it calls the repaint() method ...is this true and how do i go about
changing this because it calls the repaint() method so often that all i
see if flickering and no images
Post Follow-up to this messagerepaint is the most complicated of the methods because it is overridden
to take a differing number of parameters. If no parameters are given it
just called the update method which then calls paint. There are another
three versions which allow a time and specific co-ordinates to be
given. For example:
repaint (1000); // repaint in 1000 milliseconds
repaint (10, 20, 30, 40); // repaint the area: x = 10, y = 20, width =
30, height = 40
repaint (1000, 10, 20, 30, 40); // a combination of the two above
better make it as a thread and kill it !
merjazz89@hotmail.com wrote:
> i have seperate methods like :
>
>
> public void drawLogo ()
> {
>
> Graphics g = getGraphics ();
> g.drawImage (logo, 0, 0, this); //logo is already been
> initialized
> }
>
> i think that whenever you call g.drawImage is repaints or call g.--
> it calls the repaint() method ...is this true and how do i go about
> changing this because it calls the repaint() method so often that all i
> see if flickering and no images
Post Follow-up to this messageplz go through this link ! http://www.devarticles.com/c/a/Java/Swing-Animation/1/
Post Follow-up to this messageI think the OP doesn't understand the paint() framework. You should not be doing any drawing except when the applet is asked to repaint. Ie. you should only be doing drawing in the paint() method...and if you were, you'd already have a Graphics g object. If you are doing an animation or something and you want to invalidate the drawing canvas, you call repaint(..) in one of its forms below, and Java responds by eventually calling paint() on your applet (among other things.) In article <1117618173.249887.311810@o13g2000cwo.googlegroups.com>, majiedb@gmail.com wrote: > repaint is the most complicated of the methods because it is overridden > to take a differing number of parameters. If no parameters are given it > just called the update method which then calls paint. There are another > three versions which allow a time and specific co-ordinates to be > given. For example: > > repaint (1000); // repaint in 1000 milliseconds > > repaint (10, 20, 30, 40); // repaint the area: x = 10, y = 20, width = > 30, height = 40 > > repaint (1000, 10, 20, 30, 40); // a combination of the two above > > better make it as a thread and kill it ! > > merjazz89@hotmail.com wrote: -- |\/| /| |2 |< mehaase(at)sas(dot)upenn(dot)edu
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.