render JFrame to image

Discussion in 'Java' started by Soeren Meyer-Eppler, Jan 14, 2005.

  1. 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());


    regards,

    Sören

    --
    www.BuschnicK.net
    Soeren Meyer-Eppler, Jan 14, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Lau Lei Cheong

    Page.Render do not render complete page

    Lau Lei Cheong, May 15, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,065
    Lau Lei Cheong
    May 15, 2004
  2. Ahsan Rabbani
    Replies:
    1
    Views:
    5,423
    Andrew Thompson
    Jan 31, 2004
  3. jakester
    Replies:
    3
    Views:
    1,822
    jakester
    Apr 3, 2007
  4. Glenn Gillen
    Replies:
    0
    Views:
    274
    Glenn Gillen
    Nov 17, 2006
  5. Replies:
    2
    Views:
    413
    markspace
    Aug 27, 2012
Loading...

Share This Page