Article View: borland.public.jbuilder.java.language
Article #8294Re: Capture a drawing
From: Carlos Ojea Castro
Date: Thu, 29 Mar 2001 08:16
Date: Thu, 29 Mar 2001 08:16
32 lines
1726 bytes
1726 bytes
Thank you, good idea!.
"John McGrath [TeamB]" wrote:
> On Tue, 27 Mar 2001 16:53:34 +0200, Carlos Ojea Castro wrote:
>
> > In my program I draw a picture and I
> > want to "capture" it in a (image) variable.
> > How can I do it?
>
> You can create an Image and then use your paint() method to draw onto
> the Image. The following code could be added to a Component to create
> an image of itself:
>
> public Image getImage() {
> Dimension size = getSize();
> Image image = createImage( size.width, size.height );
> Graphics g = image.getGraphics();
> paint( g );
> }
>
> --
> Regards,
>
> John McGrath [TeamB]
>
> ---------------------------------------------------
> Before sending me e-mail, please read:
> http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<3AC2EF65.C658D833@rslcom.es>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!213.250.128.151References:
<3AC0A96E.B4E4C0DC@rslcom.es> <MPG.152b575d3eec262598a0bf@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,89e485a02bd0a5ed X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-03-29 00:24:05 PST Message-ID: <3AC2EF65.C658D833@rslcom.es> Date: Thu, 29 Mar 2001 10:16:37 +0200 From: Carlos Ojea Castro <ccastro@rslcom.es> X-Mailer: Mozilla 4.74 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: Capture a drawing References: <3AC0A96E.B4E4C0DC@rslcom.es> <MPG.152b575d3eec262598a0bf@forums.borland.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 213.250.128.151 X-Trace: 29 Mar 2001 00:16:19 -0800, 213.250.128.151 Lines: 33 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews!213.250.128.151