Article View: borland.public.jbuilder.java.language
Article #17825Re: Doubble buffering in a canvas.
From: John P. McGrath
Date: Sun, 27 Sep 1998 00:00
Date: Sun, 27 Sep 1998 00:00
39 lines
2199 bytes
2199 bytes
Hando <hando@tig.com.au> wrote: > From the Java programmers FAQ http://www.afu.com/javafaq.html > Javasoft recommends against explicit calling (and, presumably > overriding also) of addNotify() by applications programmers - > this is especially important in these days of Lightweight > components that do not have peers. If you have any code that > requires peer resources, move it into a thread that is started > from a conditional branch of the paint() or update() method. I have seen recommendations that application code not directly call addNotify(), although I have seen exactly this technique presented in "Core Java Foundation Classes". This series of Java books is certainly regarded as one of the best Java book series. I have never before seen anyone suggest that addNotify() should not be overridden, and I am not sure why the FAQ author would presume that Javasoft recommends against it. But I have seen this done countless times. Because many of the resources associated with a component are not available until the peer is created, this is, as far as I know, the best place to perform certain operations. If you have a better recommendation as to where to do this, please post a message describing it. Also, the FAQ you quoted seems to suggest that Lightweight components do not a peer, and thus addNotify() will not be called. Actually, lightweight components do have a peer, but it is an instance of java.awt.LightweightPeer. And addNotify() does get called for lightweight components, just as for heavyweight ones. -- Regards, John P. McGrath <mcgrath@enter.net> <jpm@nscs.fast.net>
Technical Details
Message-ID:
<MPG.1077d6b0ae5083189896bd@forums.inprise.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6ttqkl$ao64@forums.borland.com> <MPG.106ea95b22eab1c59896b3@forums.inprise.com> <3609A85C.E6B7F98E@tig.com.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,a7d917cc0ce6dd31 X-Google-Attributes: gidf74b3,public From: mcgrath@enter.net (John P. McGrath) Subject: Re: Doubble buffering in a canvas. Date: 1998/09/27 Message-ID: <MPG.1077d6b0ae5083189896bd@forums.inprise.com> X-Deja-AN: 395282249 References: <6ttqkl$ao64@forums.borland.com> <MPG.106ea95b22eab1c59896b3@forums.inprise.com> <3609A85C.E6B7F98E@tig.com.au> Organization: Software Consulting Services Newsgroups: borland.public.jbuilder.java.language