Im using JOptionPanes and building an RPG as a project.
I have .BMP maps and I want to use them inside my JOptionPane as to show the user where he/she is at.
I have NO idea how to do this and none of my books quite explain it clearly.
Thanks,
Nick
Printable View
Im using JOptionPanes and building an RPG as a project.
I have .BMP maps and I want to use them inside my JOptionPane as to show the user where he/she is at.
I have NO idea how to do this and none of my books quite explain it clearly.
Thanks,
Nick
See: Lesson: Working with Images (The Java™ Tutorials > 2D Graphics)
You can load the image 'globally' (eg a full path to the image - not recommended) or package them into your jar and access it like:
Code :URL url = getClass().getResource("YourImagePathInJar");
To display in a Swing app, you usually will create an ImageIcon from the image, and add that to a JLabel.
Didn't help. Thanks though.