Load Image from URL : ImageView « JavaFX « Java

Load Image from URL

import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.GroupBuilder;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.image.ImageViewBuilder;
import javafx.stage.Stage;
public class Main extends Application {
    public static void main(String[] args) {
    public void start(Stage primaryStage) {

        Group root = new Group();
        String imageSource = "http://yourImageURL";
        ImageView imageView = ImageViewBuilder.create()
                .image(new Image(imageSource))
        Group myGroup = GroupBuilder.create()
        primaryStage.setScene(new Scene(root, 500, 400));


Related examples in the same category

1.Using ImageView to display image
2.Load a jpg image with Image and use ImageView to display
3.Rotate ImageView
4.setFitWidth for ImageView
5.setPreserveRatio for ImageView
6.JavaFX Image Zoom Example