Article View: borland.public.jbuilder.java.swing
Article #1442Re: How do I get the paint Rectangle in paintComponent()
From: John McGrath [TeamB]
Date: Thu, 20 Nov 2003 04:23
Date: Thu, 20 Nov 2003 04:23
42 lines
2678 bytes
2678 bytes
On 11/19/2003 at 9:56:00 AM, Bill Darbie wrote:
> But once the paintComponent() is called, there is a Rectangle
> describing the area to be repainted that indirectly caused the call
> to happen. Is there no way to get that Rectangle?
I am not really sure what you mean by the phrase "that indirectly
caused the call to happen". If you drop it, you get "there is a
Rectangle
describing the area to be repainted", which is precisely correct.
That is all the information that is provided, all that is available,
and all that really makes sense in all contexts that the
paintComponent() method may be called.
The paintComponent() method is called by the painting subsystem when it
wants the component to paint itself. The paintComponent() method
simply provides the service to the painting system. It is not supposed
to know the context in which it is being called.
It does not know why it was called. It is possible that the repaint()
method was called, but it could also be that the Window containing the
component has just been exposed do to another window closing or being
moved.
It does not know what it is painting on, just that it is a Graphics
context. The Graphics could refer to the screen, or to a buffered
image used for screen double buffering, or to a buffer that will be
used to print an image of the component, or to a buffer that will be
used to generate a PDF file.
Its job is to paint itself on the given graphics context. That is
exactly what it should do, no more and no less.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<3fbc4fd6@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<1069206098.357352@cswreg.cos.agilent.com> <3fbb2203@newsgroups.borland.com> <1069253703.452885@cswreg.cos.agilent.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,f24930dae02d93a3 X-Google-Attributes: gid111d45,public X-Google-ArrivalTime: 2003-11-19 21:39:12 PST From: "John McGrath [TeamB]" <ng-b@JPMcGrath.net> Subject: Re: How do I get the paint Rectangle in paintComponent() Newsgroups: borland.public.jbuilder.java.swing References: <1069206098.357352@cswreg.cos.agilent.com> <3fbb2203@newsgroups.borland.com> <1069253703.452885@cswreg.cos.agilent.com> User-Agent: XanaNews/1.15.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 NNTP-Posting-Host: 141.151.22.18 Message-ID: <3fbc4fd6@newsgroups.borland.com> Date: 19 Nov 2003 21:23:34 -0700 X-Trace: newsgroups.borland.com 1069305814 141.151.22.18 (19 Nov 2003 21:23:34 -0700) Lines: 42 X-Authenticated-User: jpmcgrath Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail