简体   繁体   中英

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

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.

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.

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.

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