Question: Type in and run the following program. Then modify it to show a different greeting and image. import java.net.URL; import javax.swing.ImageIcon; import javax.swing.JOptionPane; public class

Type in and run the following program. Then modify it to show a different greeting and image.

import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
public class Test
{
public static void main(String[] args) throws Exception
{
URL imageLocation = new URL(
"http://horstmann.com/java4everyone/duke.gif");
JOptionPane.showMessageDialog(null, "Hello", "Title",
JOptionPane.PLAIN_MESSAGE, new ImageIcon(imageLocation));
}
}

Step by Step Solution

3.46 Rating (178 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres an example of how you might create a Java program that displays a message dialog with plain te... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Java Concepts Late Objects Questions!