Skip to Main Content

Java SE (Java Platform, Standard Edition)

resourceMap returning null

843810Jan 10 2010 — edited Jul 21 2010
Product Version: NetBeans IDE 6.8 (Build 200912041610)
Java: 1.6.0_17; Java HotSpot(TM) Client VM 14.3-b01


Hello, I have been having some problems building a GUI for a desktop application in netbeans:


my current GUI works great, everything is appearing correctly.

when I update the GUI by adding a new label from the toolbox onto my form, and use the netbeans preview function, everything looks great

however when i run the application the new label has disappeared..

to try and understand the problem i ran the app in debug mode and stepped through the auto-generated initComponents() code

from debugging i believe the problem comes from this line of code:
TEST_lbl.setText(resourceMap.getString("TEST_lbl.text")); // NOI18N

when this line of code has executed TEST_lbl.setText is equal to null..

so the label is disappearing when i run the app because it has no text value to display...

i opened the resource map file in note pad (.properties file) and it contains an entry "TEST_lbl.text=jLabel1" among the entries for all the other working controls...

so the properties file has the correct value, but resourceMap.getString is not retrieving it

i can work around this problem by changing the "Automatic Resource Management" option of the form from "All Resources" to "Off"

this changes the auto-generated setText code line to: TEST_lbl.setText("jLabel1"); and makes the label display correctly when the application runs



my first question is, is this a known bug? or have i done something silly and accidently changed a setting some ware?

if this is not a bug, how do i correct the problem without changing the resource management setting?

if this is a bug, what are the implications of turning off automatic resource management?

Thanks for the help, - Gaz
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 18 2010
Added on Jan 10 2010
6 comments
105 views