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


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

Re: How an I use a copy o

From "Judy Szikora" <judy.szikora@THRWHITE.remove-dii-this>
Subject Re: How an I use a copy o
Message-ID <qvRmh.550898$5R2.202616@pd7urf3no> (permalink)
Newsgroups comp.lang.java.gui
References <1167819356.183978.272880@48g2000cwx.googlegroups.com>
Date 2011-04-27 15:28 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
djubre@myway.com wrote:
> Knute Johnson wrote:
> 
>>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?
> 
> 
> I need the Graphics2D instance to do some modifications. I can't change
> the original renedering because it is not my code.
> All I can do is obtain the Graphics2D instance with getGraphics(), and
> hope I can do someting with it.
> Can I make an image out of the Graphics2D instance.
> I think of the Graphics2D instance as a drawing surface. Can I
> transform it to an image? Can I use it somewhere else, after all the
> drawings were done.
> 

Think of the Graphics2D as a pencil or paintbrush that draws on a 
particular drawing surface, not as the drawing surface itself.

Sounds to me like what you might need is to get a BufferedImage of the 
appropriate size and type, get a Graphics object from it, and with that 
Graphics object call your panel's paintComponent. That will give you a 
copy of the panel's rendering in the BufferedImage so you can work with it.

-- 
Judy Szikora, Apprisant Technologies Inc.
http://www.apprisant.com

---
 * 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 | 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