Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.*;

import java.net.MalformedURLException;
import java.net.URL;

public class Main {
    /**
     * Returns the image pointed at by the given urlString
     *
     * @param urlString the location of the image
     * @return the image
     * @throws MalformedURLException
     */
    public static Image getImageFromUrl(String urlString) throws MalformedURLException {
        URL url = new URL(urlString);
        return Toolkit.getDefaultToolkit().createImage(url);
    }
}