Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!nx02.iad01.newshosting.com!newshosting.com!69.16.185.16.MISMATCH!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "Daniel Pitts" Subject: Re: How an I use a copy o Message-ID: <1167767802.533778.101720@v33g2000cwv.googlegroups.com> X-Comment-To: comp.lang.java.gui Newsgroups: comp.lang.java.gui In-Reply-To: References: Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 30 Date: Wed, 27 Apr 2011 15:28:07 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303918087 96.60.20.240 (Wed, 27 Apr 2011 10:28:07 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:28:07 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.gui:539 To: comp.lang.java.gui Knute Johnson wrote: > djubre@myway.com wrote: > > Is there a way I can use a Graphics2D instance of a JComponent, and > > "display" it into another JComponent? > > To clarify, I have a JPanel with a lot of staff drawn onto its > > Graphics2D instance. I don't have the access to it's > > paintComponents(Graphics g) method. I want to use it as a picture > > (image, whatever) and display it as a content of another JPanel. > > What I need is to obtain Graphics instance with panel's gtGraphics(), > > and underlay it to another JPanel. > > > > That is not how it works. The component's Graphics is used to draw on > it. Why don't you just put the JPanel with the drawing on it where you > want it to show up? Alternatively, if you want it to appear in two or more places, render it to a BufferedImage, and render that BufferedImage to all places needed. You could also use a ImageIcon and JLabel to render the image for you! Hope this helps. Daniel. --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24