Netbeans code-gen woes: How to edit auto generated code?

谁都会走 提交于 2019-12-10 19:34:06

问题


Ok. So here's a netbeans issue thanks to auto generated code from GUI designer. I designed a GUI using netbeans UI designer and it was compiled for java 1.6. After I finished my UI, I realized that I was supposed to do this for Java 1.4 and not 1.6. In the effort to downgrade from 1.6 to 1.4, I altered the form properties to use Swing Extensions Library and I got rid of enhanced forloop and generics in my code and I am stuck with this final error:

Error method getString in class org.jdesktop.application.ResourceMap cannot be applied to given types; required: java.lang.String,java.lang.Object[] found: java.lang.String reason: actual and formal argument lists differ in length

This comes from the code block that was auto-generated by Netbeans, for this method call:

resourceMap.getString("panel.tabTitle");

Obviously, this probably could be resolved by writing this:

resourceMap.getString("panel.tabTitle",new Object{String.class});

I am, however, stumped on how I would make netbeans do this change to the code it generated! Let me know if you have seen this issue before and were able to resolve it. Appreciate your help.


回答1:


If you just want to edit codes. Open code with another editor just like notepad or something. And if you remove GEN-BEGIN:initComponents just before the auto generated code you can edit code through netbeans also.




回答2:


Alright. I've been able to resolve this without editing the code. However, I figured I would award kjaushalya for his answer coz the question sounded more like 'how do I edit netbeans gen-code' as opposed to 'how do I handle resource mapping with netbeans'.

Anyway, I edited the netbeans form to turn off resource mapping and that removed all the auto generated code.



来源:https://stackoverflow.com/questions/7284960/netbeans-code-gen-woes-how-to-edit-auto-generated-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!