// purpose: demonstrate popup with an icon import javax.swing.*; import java.net.*; import java.io.*; import java.util.*; public class URLImagePopUp { // base web address public static final String CS1112_PEOPLE_URL = "http://www.cs.virginia.edu/cs1112/people/"; // photo filename public static final String JPG_NAME = "photo.jpg"; // method main(): program starting point public static void main( String[] args ) throws IOException { // who is the person of interest Scanner stdin = new Scanner( System.in ); System.out.print( "Email id for person of interest: " ); String id = stdin.next(); // set pop up description String message = id; String title = "Hello from " + id; String page = CS1112_PEOPLE_URL + id + "/" + JPG_NAME; URL photoURL = new URL( page ); ImageIcon image = new ImageIcon( photoURL ); // pop up JOptionPane.showMessageDialog( null, message, title, JOptionPane.INFORMATION_MESSAGE, image ); } }