问题
My Java Swing application has an animated playback of a poker hand. I'd like to let users record this playback so that it can be sent to other people and played back in, for example, QuickTime.
Any ideas how to go about recording a Swing JFrame over time?
回答1:
If you want a stand-alone video, you will need to do screen capture and encode it to a movie.
You can use the java.awt.Robot classes to capture the window as seen by the user, and do it frequently enough to get a reasonable framerate. I am unfortunately not familiar with a tool that can encode frames to video under Java.
回答2:
JMF should be capable of doing so. Here is a tutorial about how to do screen grabbing and encoding with JMF.
来源:https://stackoverflow.com/questions/3612930/how-can-i-record-a-java-swing-gui-as-a-video-file-on-mac-os-x