I was playing with some of the screenshot stuffs in the JavaFX 2.2 and came up with idea of showing the image of the Operating system’s window stuffs in JavaFX ImageView and that was really easy to make via Java Robot API and JavaFX’s SwingFXUtils class. Thanks to the JavaFX teams 🙂

Ok here we go now . First we’ll look over how the algorithm goes for this task.

Flow of Screen capture in JavaFX

 

As you can see in above picture The portion of the Monitor is being screen captured by the Java Robot API . This give the BufferedImage Object of Java and then we convert them in to JavaFX Image using SwingFXUtils class. Now finally it’s  all in our hand to show that Image in appropriate way.

Let’s move to the coding part.
Taking image of screen.

Now that was just the simple stuffs of showing the image captured from the screen. But let’s look now little bit more. How about making this image continously generate and give it to JavaFX and change the ImageView accordingly. For this I’ll need to make the asynchronous Task to call Java Robot API .

 

Wow Now this look pretty awesome. We are getting the clone desktop like a video in javafx. I think you may feel little bit sluggish on the video currently you are getting in javafx. To improve your live video looks more smooth just decrease your Thread.sleep() time gradually. Its really so fun.
Performance steps in image update
As I’ve figured out some few performance difference on the Image updates by using ImageView and Canvas. To make your application little bit fast and light then you can use Canvas API to update the image. I’ve seen that ImageView takes little bit more memory usage than the Canvas.I would prefer using Canvas to update the Image using

Also I got one bug issue on using Canvas the memory usage level raised so fast. But it happened accidently only once. May some kind of bug.

 
 


Feather Edit

This is My 6 DAYS of JavaFX Chemistry Output  = 4(JavaFX Development Time incl. CSS & design) + 2(Deployment+Website of App).

I think I’m pretty fast may be cause of multi-knowledge . But I have done this all my day and night. I’ve been so addicted and in love with JavaFX  this week. 😛

You can checkout this software release at here : Feather Edit (free)

 

Only this much for today. Have a good 🙂 day folks.