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 244881 - GUI field "name" property in GUIBuilder initializes as empty and does not change with 'Rename Field" option until manually set to anything
Summary: GUI field "name" property in GUIBuilder initializes as empty and does not cha...
Status: RESOLVED INVALID
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.0
Hardware: PC Windows 7
: P4 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords: USABILITY
Depends on:
Blocks:
 
Reported: 2014-06-04 11:30 UTC by andrzejo
Modified: 2014-06-04 12:12 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description andrzejo 2014-06-04 11:30:10 UTC
Product Version = NetBeans IDE 8.0 (Build 201403101706)
Operating System = Windows 7 version 6.1 running on amd64
Java; VM; Vendor = 1.7.0_13
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.7-b01

STEPS TO REPRODUCE:

1) Create a new JPanel form 
2) Drag a field (i.e. JComboBox) onto a JPanel
3) Check field properties - the associated variable name will be JComboBox1, the "name" property will be empty
4) Select "Rename Field" option and change field name to anything else
5) Check field properties - the associated variable name will be changed, but the "name" property will remain empty 
6) Set manually "name" property to anything not empty, i.e. to same as current variable name,  
7) Again select "Rename field" option and change associated variable name to anything different 
8) Check field properties and see "name" property 

CURRENT BEHAVIOUR:

The "name" property of GUI field will get synchronized with assciated variable name only if "name" property was previously set manually to anything, otherwise will remain empty. 

DESIRED BEHAVIOUR:

The "name" property should be initialized with default variable name (i.e. JcomboBox1) and then be kept synchronized with any 
"Change variable name" action, to have both in sync. "Name" property is convenient to locate and access GUI objects in application source code, so this could save a bit of irritating work while building Swing GUI apps.
Comment 1 Tomas Pavek 2014-06-04 12:12:37 UTC
Just curious, why do you need the 'name' property be set?

Usually people don't need it, so having it set by default would mean additional code generated that most people would not want. So we can't do this.

But you can get the behavior by turning on the 'Set Component Names' setting, either for a particular GUI form, or in the global GUI Builder options. To set it for a particular form just open the form and select its root node in the Navigator, then see the property in the Properties window. If you set it in the global options then it will set the per-form setting for each newly created form (won't affect existing forms).