Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

paint() being recalled ALOT
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


Report this thread to moderator Post Follow-up to this message
Old Post
merjazz89@hotmail.com
06-01-05 08:58 AM


Re: paint() being recalled ALOT
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:
> 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


Report this thread to moderator Post Follow-up to this message
Old Post
majiedb@gmail.com
06-01-05 02:04 PM


Re: paint() being recalled ALOT
plz go through this link !
http://www.devarticles.com/c/a/Java/Swing-Animation/1/


Report this thread to moderator Post Follow-up to this message
Old Post
majiedb@gmail.com
06-01-05 02:04 PM


Re: paint() being recalled ALOT
I 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

Report this thread to moderator Post Follow-up to this message
Old Post
Mark Haase
06-01-05 09:01 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Java Help archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:33 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.