Java Reference
In-Depth Information
In this chapter you will create images, animations, and Look and Feels. Fasten your
seatbelts; you'll discover solutions to integrate cool game-like interfaces into your
everyday applications.
Note Refer to Chapter 14 if you are new to JavaFX. Among other things, it will help
you create an environment in which you can be productive using JavaFX.
15-1. Creating Images
Problem
There are photos in your file directory that you would like to quickly browse through
and showcase.
Solution
Create a simple JavaFX image viewer application. The main Java classes used in this
recipe are:
javafx.scene.image.Image
javafx.scene.image.ImageView
EventHandler<DragEvent> classes
The following source code is an implementation of an image viewer application:
package org.java8recipes.chapter15.recipe15_01;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
Search WWH ::




Custom Search