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 73699 - create public getter methods to access ui components
Summary: create public getter methods to access ui components
Status: NEW
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 5.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: issues@guibuilder
URL:
Keywords:
: 73700 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-03-17 12:11 UTC by prange
Modified: 2008-04-29 13:11 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 prange 2006-03-17 12:11:05 UTC
Hi,
this issue is related to issue 23675.
It also concerns the code generated to access the components created by the 
visual gui builder.

In our project we use the Netbeans form builder to create view classes.
My problem is that our software architecture forces me to access the components 
from outside the view class.
Until now, I modified the Netbeans options (Tools/Options/Miscellaneous/GUI 
Builder/Code generation) to create "public" access modifiers at the declarations 
of the components.

But now, there are new code conventions in our project which prohibit the use of 
the "public" access modifier. The preferred way to access a field of a class is 
to use a public getter method.

So my wish for a future Netbeans release is another option under Tools/Options/
Miscellaneous/GUI Builder/Code generation which leads to the creation of one 
public getter method per component.

Just to clarify my problem:

This is the component declaration in a form's code according to the Netbeans 
default options:
private javax.swing.JLabel nameLabel;

This is how it worked fine for me until our new code conventions came:
public javax.swing.JLabel nameLabel;

And this is how I wish it to be to fulfill our new code conventions:
private javax.swing.JLabel nameLabel;
public javax.swing.JLabel getNameLabel(){
  return nameLabel;
}


Thanks for paying attention to my problem.

Bye, Stefan Prange
Comment 1 prange 2006-03-20 12:38:30 UTC
*** Issue 73700 has been marked as a duplicate of this issue. ***