简体   繁体   中英

How to edit automatically generated code by netbeans desing UI?

I have this Afficheur java class in my project (its a DrawingPanel) which takes a MainWindow object in parameter. MainWindow is essentially a swing UI which Netbeans automatically generated code for as I designed it with their desing tool. In order for it to work I have to edit this generated code by Netbeans and add 'this' in parameter to Afficheur when I create a new Afficheur (see line 85), which only is possible when I edit the code in notepad.

This method makes my code work but as soon as I try to modify the UI with the netbeans design tool the whole thing messes up. I know this is the issue because I tried removing 'this' and then modifying my UI and then adding 'this' back and everything worked fine. Its like netbeans can't generate code properly when I have modified its code. Any Idea on how I can resolve this issue?

添加了“this”的生成代码

只需转到设计选项卡,然后右键单击要更改其代码的项目,然后单击自定义代码(或类似的东西,我没记错)并编辑代码。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM