Article View: borland.public.jbuilder.java.swing
Article #9370Re: Set background after extending JPanel?
From: Trey Ethridge
Date: Thu, 30 Mar 2000 00:00
Date: Thu, 30 Mar 2000 00:00
35 lines
1820 bytes
1820 bytes
Thanks John. That worked. It's sometimes funny how one little
statement can make all the difference!
"John P. McGrath" wrote:
> On Mon, 27 Mar 2000 11:08:19 -0500, Trey Ethridge wrote:
>
> > I'm trying to use the Graphics2D api to draw some simple shapes
> > on a class that I extended from JPanel. I'm want to set the
> > background in my object, but I have been unable to get it to
> > work. I've tried using super.setBackground(Color.white) from
> > within my class.
> >
> > I have overloaded the paintComponent() method in my class and
> > I don't know if that has anything to do with it. I know that
> > when I comment out the paintComponent() method it paints the
> > background correctly. However, it's my understanding that I
> > have to overload the paintComponent() method to draw my shapes
> > with the Graphics2D api.
>
> Did you call the superclass paintComponent() method in your method?
> For example:
>
> public void paintComponent( Graphics g ) {
> super.paintComponent( g );
> :
> // Now draw some simple shapes
> }
>
> --
> John P. McGrath
> <JPMcGrath@fast.net>
> <jpm@nscs.fast.net>
Technical Details
Message-ID:
<38E3696A.3AC1D134@softrealityinc.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<38DF8772.DE6AFEF6@softrealityinc.com> <MPG.134a176e6ac1641c989832@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,e8ac0b4dbbc13ca5 X-Google-Attributes: gid111d45,public From: Trey Ethridge <ethridge@softrealityinc.com> Subject: Re: Set background after extending JPanel? Date: 2000/03/30 Message-ID: <38E3696A.3AC1D134@softrealityinc.com> X-Deja-AN: 604356656 Content-Transfer-Encoding: 7bit References: <38DF8772.DE6AFEF6@softrealityinc.com> <MPG.134a176e6ac1641c989832@forums.borland.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii Organization: Another Netscape Collabra Server User Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing