Reputation: 1
If I Use This Way To Add image in panel
static ImageIcon bg = new ImageIcon("hangman1.png");
Then Where Should Be Mine hangman1.png should be so it display correctly??
Upvotes: 0
Views: 63
Reputation: 14816
Load your "hangman1.png" file as a resource and add it to JLabel
:
JLabel label = new JLabel(new ImageIcon(getClass().getResource("/path/to/your/image/hangman1.png")));
Before of that, add it into some package in your Java project.
Upvotes: 1