You might want to remove some events that are not used anymore in your NetBeans file project. You cannot just delete it from the code editor because NetBeans lock it, indicated by the gray color of the line of codes.
Here's how to remove those unused codes:
1. Go to the GUI builder, the Design view of your file.
2. Right click and select Properties. The default open tab is the Properties list. Select the Events tab.
3. You would see events list and what handlers these events are associated.
4. Choose the event you'd like to delete by selecting the [...] button.
5. A new dialog will pop up. Select the handler then click Remove button.