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

Summary: Using action property with @Action method causes button to lose text and tooltip
Product: guibuilder Reporter: beckynorman
Component: CodeAssignee: issues@guibuilder <issues>
Status: NEW ---    
Severity: normal    
Priority: P4    
Version: 6.x   
Hardware: PC   
OS: Windows 7 x64   
Issue Type: DEFECT Exception Reporter:

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.