'JavaFX : How to progressively display multiple images after being loaded
I am creating a JavaFX application that loads multiple images from the internet (about 50)
The problem is that when I load all the images (with a thread), it displays them all at once which slows down the process.
I would like to display the images one by one when they have finished loading instead of displaying all at once (like YouTube).
I have been looking for a solution to this question for several days but I have not found anything...
Thank you in advance 😃
Solution 1:[1]
Load the image in the background, by setting the backgroundLoading parameter to true:
ImageView view = new ImageView(
new Image(url, true)
);
The ImageView will automatically display the image when it has completed loading.
From the Image javadoc:
// load an image in background, displaying a placeholder while it's loading // (assuming there's an ImageView node somewhere displaying this image) // The image is located in default package of the classpath Image image1 = new Image("/flower.png", true);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
