I have a JPanel to which I\'d like to add JPEG and PNG images that I generate on the fly.
All the examples I\'ve seen so far in the Swing Tutorials, specially in the
This answer is a complement to @shawalli's answer...
I wanted to reference an image within my jar too, but instead of having a BufferedImage, I simple did this:
JPanel jPanel = new JPanel();
jPanel.add(new JLabel(new ImageIcon(getClass().getClassLoader().getResource("resource/images/polygon.jpg"))));