🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #1237

Re: question about Component and JComponent

#1237
From: Gillmer J. Derge [TeamB]
Date: Tue, 16 Apr 2002 21:40
24 lines
1940 bytes
"PeterH" <!REMOVEBeforeSending!peter@pchenry.com> wrote in message
news:3cbc8c3d_2@dnews...
> Does the paint(Graphics g) method belong to the Component class only?
And
> likewise does the paintComponent(Graphics g) belong to the JComponent
class?

paint is a method of Component or any class that extends Component.  It's
used to draw the component onto the screen (or perhaps to paper when
printing).

JComponent extends Component (indirectly by extending Container) and
overrides paint to make it easier for you to write JComponent subclasses.
The paint method of JComponent calls 3 other methods: paintComponent,
paintBorder, and paintChildren.  Most of the time when you want to change
the way painting is done, it's easiest to just override paintComponent,
since you probably don't also want to change the way the border and
children are drawn, but it depends on what you're trying to do.

In your case, where you're trying to paint an image, paintComponent is
probably the best place to do the drawing.

--
Gillmer J. Derge [TeamB]
Technical Details
Message-ID: <3cbc9a4c$1_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!news-x2.support.nl!skynet.be!skynet.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <3cbc8c3d_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,64219872a96b6d37
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2002-04-16 14:49:41 PST
From: "Gillmer J. Derge [TeamB]" <spam@gillmerderge.com>
Newsgroups: borland.public.jbuilder.java.api
References: <3cbc8c3d_2@dnews>
Subject: Re: question about Component and JComponent
Date: Tue, 16 Apr 2002 17:40:51 -0400
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 24.29.81.241
Message-ID: <3cbc9a4c$1_1@dnews>
X-Trace: dnews 1018993228 24.29.81.241 (16 Apr 2002 14:40:28 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!news-x2.support.nl!skynet.be!skynet.be!newsfeed01.tsnz.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews