CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1

    Make A Image Of A Jframe Or JPanel?

    Does anyon know if i can make a graphics object of Image of my JPanels or JFrames? And if so, how do i do it, is there a class or something?

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: Make A Image Of A Jframe Or JPanel?

    One way is to use the Robot.createScreenCapture(..) method to make an image of a specified screen rectangle. Just get the frame position and convert it to screen coordinates using SwingUtilities.convertPointToScreen(..) then you can use the frame size to create a screen coordinates Rectangle and pass it to the Robot to capture that part of the screen.

    The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague...
    E. Dijkstra
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  3. #3
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: Make A Image Of A Jframe Or JPanel?

    Another idea: create a BufferedImage, get its Graphics context and call the frame's paint method. The frame will paint it self on your BufferedImage.
    Norm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured