Re: Double buffer help
- From: "Martin" <zedolf@xxxxxxxx>
- Date: Thu, 6 Apr 2006 08:07:01 +0100
"Ian Shef" <invalid@xxxxxxxxxxxxx> wrote in message
news:Xns979C800D25A1Bvaj4088ianshef@xxxxxxxxxxxxxxxxxx
"Martin" <zedolf@xxxxxxxx> wrote in news:c9adncRoxOlOOazZRVnyiA@xxxxxxxxx:
Brilliant!
No, but thanks.
Yep my timer thread was calling repaint().
I had a quick Google and found an example of using the update() method.
An excellent resource for painting issues is
"Painting in AWT and Swing":
http://java.sun.com/products/jfc/tsc/articles/painting/index.html
Nooooooooooooo !!
I simply duplicated the code from my paint() method in the update()
method and gave that a try and it's perfect.
You are setting yourself up for a maintenance and debug nightmare.
Provide the code in only ONE place!
Either:
1) Locate the code in paint(), and have update() call paint(), OR
2) Locate the code in update(), and have paint() call update(), OR
3) Locate the code in a new method, and have both paint() and update(0
call the new method.
The flicker has disappeared.
Glad to hear it.
I've updated the temporary webpage too - both the old (flickering)
applet and the new improved applet can both be seen in action.
http://www.warwound.dsl.pipex.com/applet/panViewer.htm
Nice contrast between the two cases. Thanks, I rarely get to see such a
visible result of my advice.
Happy to have helped.
Thanks a lot - very easy and quick for me to fix it once i was pointed
in the right direction.
Martin.
-- Ian
--
Ian Shef 805/F6 * These are my personal opinions
Raytheon Company * and not those of my employer.
PO Box 11337 *
Tucson, AZ 85734-1337 *
Thanks for the advice about duplicating the drawing code.
I've rewritten my applet and created a new method which i've called
displayRedraw() and moved the code to that method.
Then both paint() and update() methods merely call my new displayRedraw()
method and all works as before - even makes the compiled class file a very
little bit smaller too.
I'll take a look at the "Painting in AWT and Swing" link later when i have
more time.
Thanks again.
Martin.
.
- References:
- Double buffer help
- From: Martin
- Re: Double buffer help
- From: Martin
- Re: Double buffer help
- From: Ian Shef
- Re: Double buffer help
- From: Martin
- Re: Double buffer help
- From: Ian Shef
- Double buffer help
- Prev by Date: Re: integers and arrays in Java - how?
- Next by Date: Run .Java as a Windows-service?
- Previous by thread: Re: Double buffer help
- Next by thread: J2EE/JBoss developer wanted - FT or contract, Newburyport, MA - No telecommuters
- Index(es):
Relevant Pages
|
|