Here you go, I annotated the code for you
import javax.swing.JOptionPane;
[[STAR]] The code below will do what you are looking for.
import javax.swing.JOptionPane; import javax.swing.JLabel; import javax.swing.ImageIcon; public class img{ public static void main(String[] args){ JLabel lbl = new JLabel(new ImageIcon(diceGame.class.getResource("image.png"))); JOptionPane.showMessageDialog(null, lbl, "ImageDialog", JOptionPane.PLAIN_MESSAGE, null); } }
source share