Setting the icon for a MessageDialog causes issues

58 Views Asked by At

I'm trying to set an Icon for a Message Alert popup, and I'm using the methods I've found online. However, they're causing issues where the image:

  1. Doesn't even get set as the icon
  2. Is way too oversized
  3. Placed in the JPanel

The screenshot below shows what I mean:

Screenshot of Issue

And my code doesn't seem to have any issues:

final ImageIcon iconF = new ImageIcon(LOGIN.class.getResource("/resources/offline.png"));
JOptionPane.showMessageDialog(null, "ERROR: Please check your username and password then try again.", "Login Failed", JOptionPane.ERROR_MESSAGE, iconF);

I don't understand what's causing this mess of an issue when this seems to be the "answer" to my own question.

0

There are 0 best solutions below