Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {

        Group root = new Group();

        String imageSource = "http://yourImageURL";

        ImageView imageView = ImageViewBuilder.create().image(new Image(imageSource)).build();

        Group myGroup = GroupBuilder.create().children(imageView).build();

        root.getChildren().add(myGroup);

        primaryStage.setScene(new Scene(root, 500, 400));
        primaryStage.show();
    }
}