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?

Recommended Answers

The 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

Jump to Post

All 2 Replies

The 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

Member Avatar

Well... What I use is;

+ Project_Name
..> Completed (other custom classes related this project)
..> Resources (images, application data files, etc.)
..> Data (user data files)
..> Logs (any logging data files)
..> Other (other files used to create my resource files)

However, you should use whatever YOU feel comfortable with.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.