O'Reilly logo

JavaFX 1.2 Application Development Cookbook by Vladimir Vivien

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Downloading images with HttpRequest

In the previous recipe, Accessing remote data with HttpRequest, we saw how to use the HttpRequest class to request and receive textual data from a remote server. How about the next most popular resources on the web: Images? The answer is a resounding yes. In this recipe, we will see how to pull down image binary data from the server specifically and display it in your JavaFX application.

Getting ready

In Chapter 5, JavaFX Media, we learned how to use the Image API to download images automatically. However, the API offers little control over the download process. In this recipe, we are going to use HttpRequest, which provides granular control over the content of the image downloaded. For some portions of the code, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required