Article View: borland.public.jbuilder.java.api
Article #1238Re: how do I draw a JPG to a panel/container
From: PeterH
Date: Wed, 17 Apr 2002 01:51
Date: Wed, 17 Apr 2002 01:51
39 lines
2457 bytes
2457 bytes
I think I got you on that. 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. Thank you for your patience and ideas! :> "Gillmer J. Derge [TeamB]" <spam@gillmerderge.com> wrote in message news:3cbc9afb_2@dnews... > "PeterH" <!REMOVEBeforeSending!peter@pchenry.com> wrote in message > news:3cbc80fd$1_2@dnews... > > In the JFrame object, there is a getGraphics() method. How come I can't > use > > that to get a Graphics object and use the drawImage() from there? > > That probably works except your work is destroyed before you even see it. > The problem is that the paint method is called automatically in response to > various user interface events. For example, when the window first appears > on the screen or when the window is uncovered by moving another window, the > paint method will be called to draw the window's contents. Your approach > drew the image, but then at some point paint was called, and it redrew the > window right on top of your work. That's why overriding paint or > paintComponent will work. > > -- > Gillmer J. Derge [TeamB] > > >
Technical Details
Message-ID:
<3cbcd6bf_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!washdc3-snh1.gtei.net!chcgil2-snh1.gtei.net!lsanca1-snf1!news.gtei.net!enterprise!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3cb9ef73$1_1@dnews> <MPG.172579c5bd0dc2ea98b534@newsgroups.borland.com> <3cbc80fd$1_2@dnews> <3cbc9afb_2@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 19:06:06 PST From: "PeterH" <!Sorry-TooMuchSpam!nope@nope.com> Newsgroups: borland.public.jbuilder.java.api References: <3cb9ef73$1_1@dnews> <MPG.172579c5bd0dc2ea98b534@newsgroups.borland.com> <3cbc80fd$1_2@dnews> <3cbc9afb_2@dnews> Subject: Re: how do I draw a JPG to a panel/container Date: Tue, 16 Apr 2002 21:51:30 -0400 Lines: 41 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.112.10.56 Message-ID: <3cbcd6bf_1@dnews> X-Trace: dnews 1019008703 24.112.10.56 (16 Apr 2002 18:58:23 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!supernews.com!newsswitch.lcs.mit.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!washdc3-snh1.gtei.net!chcgil2-snh1.gtei.net!lsanca1-snf1!news.gtei.net!enterprise!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnews