🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: how do I draw a JPG to a panel/container

#1244
From: Gillmer J. Derge [TeamB]
Date: Wed, 17 Apr 2002 04:20
25 lines
2356 bytes
"PeterH" <!Sorry-TooMuchSpam!nope@nope.com> wrote in message
news:3cbcd6bf_1@dnews...
> re that's why overriding paint or paintComponent will work
> Should I be using the super() method call in there?  If I do will it
> overright my image?  If I don't will it leave my current image there?  I
> seem to remember reading something about that in my Deitel and Deitel
book,
> but it was a long time ago.

Calling super.paint(g) or super.paintComponent(g) will draw whatever the
component would normally look like.  If you do that after you draw your
image then, yes, it will draw over your image, and you'll never see it.
That's fairly similar to what was happening originally.  On the other hand,
if you call the superclass method before you draw your image, then your
image will be drawn on top of the normal display.

If the image takes up the component's entire space, then there's not really
much point to calling the superclass method.  You would just be doing twice
the work and never seeing any of the results.  On the other hand, if your
image isn't as big as the component (ex. maybe it's centered in the middle
with a border around it), then calling the superclass method would make
sure that the rest of the component looks correct.

--
Gillmer J. Derge [TeamB]
Technical Details
Message-ID: <3cbcf815$1_1@dnews>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!peer1-sjc1.usenetserver.com!usenetserver.com!hub1.nntpserver.com!xmission!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <3cb9ef73$1_1@dnews> <MPG.172579c5bd0dc2ea98b534@newsgroups.borland.com> <3cbc80fd$1_2@dnews> <3cbc9afb_2@dnews> <3cbcd6bf_1@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,422c9cef40be2392
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2002-04-16 21:27:12 PST
From: "Gillmer J. Derge [TeamB]" <spam@gillmerderge.com>
Newsgroups: borland.public.jbuilder.java.api
References: <3cb9ef73$1_1@dnews> <MPG.172579c5bd0dc2ea98b534@newsgroups.borland.com> <3cbc80fd$1_2@dnews> <3cbc9afb_2@dnews> <3cbcd6bf_1@dnews>
Subject: Re: how do I draw a JPG to a panel/container
Date: Wed, 17 Apr 2002 00:20:37 -0400
Lines: 28
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: <3cbcf815$1_1@dnews>
X-Trace: dnews 1019017237 24.29.81.241 (16 Apr 2002 21:20:37 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!supernews.com!peer1-sjc1.usenetserver.com!usenetserver.com!hub1.nntpserver.com!xmission!news-hog.berkeley.edu!ucberkeley!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews