Where would I need to save a picture on my computer to be able to use it as an icon on a button in a program?
lbgladson
0
Junior Poster in Training
Recommended Answers
Jump to PostThe general notion is to have following project structure
- src
- main
- java
- top-package name
- resources
- daniweb.png
- test
Then you can call images from resource directory directly like
new ImageIcon(ClassLoader.getSystemResource("daniweb.png"));
no need for directory changes (../../../daniweb.png)etc
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.