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.
If I remove a component from form (right click and delete) then in source code all code that was written for various events on this component is also removed.
This is as designed. See also issue 57552.
Hmm. sorry to say this, but I think that is a bad design. At least a dialog could appear to inform a user. And btw I couldn't Undo this. :(( Maybe (I don't remember correctly), I did a save, changed to source and back to design again and when I realized I lost couple of 100s lines of code it was too late :((( I'm not happy with this design at all. This is why I am reopening this.
*** This issue has been marked as a duplicate of 57552 ***
Note to undo - you must be in the form designer, not in the source editor, then undo should work - even if you saved or did some additional changes in the source editor.