|
-
July 6th, 2011, 09:36 PM
#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?
-
July 7th, 2011, 04:25 AM
#2
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.
-
July 7th, 2011, 09:05 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|