Java JOptionPane.showMessageDialog custom icon problem?

Viewed 54511

So I have a pop-up dialog in my application that tells the user about the program. Everything was going fine until the custom icon. Here's what I've attempted:

Attempt 1:

JOptionPane.showMessageDialog(dialog, "Blah blah blah", "About", JOptionPane.INFORMATION_MESSAGE, new ImageIcon("home/user/Pictures/default.jpg"));

Attempt 2:

final icon = new ImageIcon("home/user/Pictures/default.jpg"));

    JOptionPane.showMessageDialog(dialog, "Blah blah blah", "About", JOptionPane.INFORMATION_MESSAGE, icon);

Attempt 3:

final icon = new ImageIcon("home/user/Pictures/default.jpg"));
showMessageDialog(dialog, "Blah blah blah", "About", JOptionPane.INFORMATION_MESSAGE, icon);

Attempt 4:

(Screaming at java)

Attempt 5:

Using URL's


All have had no affect on the program and instead of an image, I don't get anything.


Details:

  • No exceptions
  • The file path DOES exist
  • My IDE doesn't return exceptions, NOR any warnings of any sort
  • Yes, I've put also tried the path /home/user/Pictures/default.jpg
  • .ico's, .png's, .jpg's don't work. I'm not so sure about .gif's right now though.

Help me! :(

6 Answers
Related