Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > render JFrame to image

Thread Tools

render JFrame to image

Soeren Meyer-Eppler
Posts: n/a
Hi everybody,
I'm new to Java programming and have two questions:

1) what is the difference between the Component methods paint, paintall,
print, printall?

2) How can I render a Component to an Image without showing it on
screen? I've tried the following code, which does render the JFrame to
the image, but only when I do a setVisible( true ) beforehand. I don't
want that because that causes it to be displayed on screen as well.

m_Frame = new JFrame();
// [omitted] add some stuff to the frame...
m_Frame.setVisible( true );
m_Image = new BufferedImage((int)getWidth(), (int)getHeight(),
BufferedImage.TYPE_INT_RGB );
m_Frame.paintAll( m_Image.createGraphics());



Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How Can I Get One JFrame To Appear Above Another JFrame Java 2 08-27-2012 03:01 PM
start a new JFrame from an existing one, and when old JFrame closes new one does not jakester Java 3 04-02-2007 11:13 PM
Accessing rails render method outside of view / Decorating render Glenn Gillen Ruby 0 11-17-2006 02:30 PM
Page.Render do not render complete page Lau Lei Cheong ASP .Net 1 05-15-2004 04:10 AM
displaying image in jframe using (x,y) coordinates Ahsan Rabbani Java 1 01-31-2004 12:40 AM