If you have already checked out recipes in previous chapters, you know by now that JavaFX provides classes, which make it easy to load and display images. This recipe takes a closer look at the mechanics provided by the Image API to load and display images in your JavaFX applications.
This recipe uses classes from the Image API located in the javafx.scene.image
package. Using this API, you are able to configure, load, and control how your images are displayed using the classes Image
and ImageView
. For this recipe, we will build a simple image browser to illustrate the concepts presented here. The browser allows users to load an image by providing its URL. You will use standard JavaFX controls, such as text boxes and buttons, to build the GUI. If you are not familiar with the standard GUI controls, review the recipe Creating a form with JavaFX controls from Chapter 4,