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 189088 - Using action property with @Action method causes button to lose text and tooltip
Summary: Using action property with @Action method causes button to lose text and tooltip
Status: NEW
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: PC Windows 7 x64
: P4 normal (vote)
Assignee: issues@guibuilder
Depends on:
Reported: 2010-07-30 15:51 UTC by beckynorman
Modified: 2010-07-30 15:51 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description beckynorman 2010-07-30 15:51:05 UTC
I coded public void methods with the @Action attribute.  I created JButtons using the Design view/tool.  I right clicked and used the "Change Variable Name" and "Edit Text" choices to set the variable name and caption text.  Then, I right clicked the JButton and used the "Set Action ..." choice to "bind" the buttons to their @Action method.  This works fine until you exit NetBeans.  When you restart NetBeans, the button caption text is missing.  I also noticed that this happens with the tooltip text as well.  Upon reviewing the .form source file, the property tag used to set the "text" property was missing (i.e. <Property name="text" type="java.lang.String" value="Cancel"/>).  Upon reviewing the .java source file initComponents code, the .SetText was missing (i.e. btnCancel.setText("Cancel")).  If I used WordPad to re-add this code and then restart Netbeans, it was automatically removed when I went back into the Design view/tool.  The mechanics to set the action were the line just above the text property, so on a hunch, I removed the action properties and @Action methods from the buttons.  Then, I used the Design view/tool to right click on the button, choose Events>Mouse>Mouse Clicked to auto-generate the mouse click event listener.  Upon implementing the click code this way, the button names and tooltips are now saved and retained.  If the @Action method is no longer supported, then perhaps the "Set Action ..." choice and action property should be removed to avoid this problem.