This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 187521

Summary: Icon property editor in GUI designer doesn't respect maven resource path
Product: projects Reporter: arittner <arittner>
Component: MavenAssignee: David Simonek <dsimonek>
Status: RESOLVED WORKSFORME    
Severity: normal CC: issues, jglick
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
URL: http://forums.netbeans.org/viewtopic.php?p=76885#76885
Issue Type: DEFECT Exception Reporter:

Description arittner 2010-06-13 09:43:00 UTC
I'm pretty sure about the wrong product/component - but maven is the source.

The GUI designer respects Bundle.properties in the correct resource path in maven based projects. But I miss the support for icons. It's not possible to add icons from the resource path. But it's possible to import images to the project source *and* resource path. (IMHO the importer wizard resolves the right classpaths)

Only the package chooser combobox doesn't show the resource package paths.

The main problem is: Resources such as pictures (*. gif, *. png, *. jpg) are only compiled if they are below the maven path src/main/resources. The only workaround is to add this extension to the pom configuration like this:

<build>
  <resources>
    <resource>
      <directory>src/main/java</directory>
        <includes>
          <include>**/*.png</include>
          <include>**/*.jpg</include>
          <include>**/*.gif</include>
        </includes>
      </resource>
   </resources>
<build> 

and save the images in the src/main/java subfolders.

But this is not the "correct maven way" ;-)

br, josh.
Comment 1 Jesse Glick 2010-06-14 15:17:18 UTC
Works for me in a dev build. Create a project via quickstart archetype. Copy some icon to src/main/resources/res/something.png. Add a JFrame form. Add a JLabel to it. Click the "..." button next to "icon". Click "..." next to "File". The chooser shows under "Classpath" two nodes: "Source Packages" and ".../src/main/resources"; under the latter the icon can be selected. Generated code is

jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/something.png")));

which looks right to me, and works when run (via either Maven execute, or Compile on Save quick run).
Comment 2 mexer 2014-09-18 02:07:27 UTC
I'm having this issue on netbeans 8.0.1, should I re open this issue or create a new one?