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 254524 - GUI Builder does not resolve resources on maven projects
Summary: GUI Builder does not resolve resources on maven projects
Status: RESOLVED DUPLICATE of bug 170991
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.0.2
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-19 21:32 UTC by jurib
Modified: 2015-09-16 17:04 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Maven GUI Test Project (37.62 KB, application/zip)
2015-08-19 21:32 UTC, jurib
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jurib 2015-08-19 21:32:17 UTC
Created attachment 155464 [details]
Maven GUI Test Project

When creating a GUI as part of a Maven project, the GUI Builder does not load resources like images correctly, and thus, either previews of the GUI cannot be shown correctly or there will be NPEs when building and running the project using maven.

Steps to reproduce:

1. Create Maven Java Project
2. Create JFrame form with GUI Builder
3. Add a JPanel, and inside, add a JLabel
4. In the Properties Menu, click the icon property ... to bring up the Image Chooser Menu
5. Select an Image within Project and add it. You will see the preview in the Panel correctly.
6. Run the GUI. A NPE will occur, as the resource cannot be found
7. Copy the image to the /src/main/resources folder and customize the JLabel code to 
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image.png"))); // NOI18N
7. The preview will be gone. When running the code, the image will appear correctly.

I think GUI Builder does not know how to handle the maven resource placement standards. It would be very desirable, if GUI Builder could check /src/main/resources if the project is a maven project, as it seems GUI BUilder can only cope with ant-style resource management. And I do not think that making people place anything else besides .java Files in their packages is good style.

Attached is a little project, where the image gets correctly loaded when being built and run, but not previewed in the GUI Builder.
Comment 1 Tomas Pavek 2015-09-16 17:04:03 UTC
Fixed as bug 170991.

*** This bug has been marked as a duplicate of bug 170991 ***