Here is a variant that uses a URL:
import java.net.URL;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
public class Main
{
public static void main(String[] args) throws Exception
{
final ImageIcon icon = new ImageIcon(new URL("http://www.w3cschool.cn/style/download.png"));
JOptionPane.showMessageDialog(null, "Blah blah blah", "About", JOptionPane.INFORMATION_MESSAGE, icon);
}
}
The following code uses the image from local file system.
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
//from w ww . j a v a 2s . com
public class Main {
public static void main(String[] args) throws Exception
{
final ImageIcon icon = new ImageIcon("C:/folder/location.png");
JOptionPane.showMessageDialog(null, "Blah blah blah", "About", JOptionPane.INFORMATION_MESSAGE, icon);
}
}