Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #539

Re: How an I use a copy o

From "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this>
Subject Re: How an I use a copy o
Message-ID <1167767802.533778.101720@v33g2000cwv.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
References <hmwmh.94147$V34.9897@newsfe17.lga>
Date 2011-04-27 15:28 +0000
Organization TDS.net

Show all headers | View raw


  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

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

How an I use a copy of Gr "djubre" <djubre@THRWHITE.remove-dii-this> - 2011-04-27 15:28 +0000
  Re: How an I use a copy o "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:28 +0000
    Re: How an I use a copy o "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> - 2011-04-27 15:28 +0000
  Re: How an I use a copy o "djubre" <djubre@THRWHITE.remove-dii-this> - 2011-04-27 15:28 +0000
    Re: How an I use a copy o "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:28 +0000
      Re: How an I use a copy o "djubre" <djubre@THRWHITE.remove-dii-this> - 2011-04-27 15:28 +0000
        Re: How an I use a copy o "Daniel Pitts" <daniel.pitts@THRWHITE.remove-dii-this> - 2011-04-27 15:28 +0000
        Re: How an I use a copy o "Fred Kleinschmidt" <fred.kleinschmidt@THRWHITE.remove-dii-this> - 2011-04-27 15:28 +0000
        Re: How an I use a copy o "Knute Johnson" <knute.johnson@THRWHITE.remove-dii-this> - 2011-04-27 15:28 +0000
          Re: How an I use a copy o "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:28 +0000
    Re: How an I use a copy o "Judy Szikora" <judy.szikora@THRWHITE.remove-dii-this> - 2011-04-27 15:28 +0000

csiph-web