How to edit "generated code"
Hello
On another machine I used predefined forms to create some GUI in my application. When I moved my program to another machine, I imported it using "new project with existing code", and classes made using form became ordinary code only. Still, codesegments are locked as "generated code", and I am unable to edit it. How can I unlock these code segments?
[370 byte] By [
Fluid] at [2007-11-26 11:24:59]

# 1
The GUI form editor creates a .form file along with .class files. When you copied the project, did the .form files also get copied? If so, can u try moving the .form files somewhere else temporarily and see if the class files get unlocked?
Also, did u try copying the project itself (along with the files) and simply open that project on the new machine instead of creating a new project? (This step may need some manual corrections in JSE8; the project import feature has been improved in the later versions of NetBeans/JSE though...)
# 2
Thanks for answering
I am sorry to say I only used the .java files in creating the new project. I was unaware I could copying the project as a whole. There are no .form files that I can see in the new project. Also, the source file in itself is accesible, only part of the code is not. That code appear on blue background. I believe they are called a guarded block?
Message was edited by:
Fluid
Fluid at 2007-7-7 3:40:26 >

# 3
> Thanks for answering
> I am sorry to say I only used the .java files in
> creating the new project. I was unaware I could
> copying the project as a whole. There are no .form
> files that I can see in the new project. Also, the
> source file in itself is accesible, only part of the
> code is not. That code appear on blue background. I
> believe they are called a guarded block?
You are not going to be able to use the visual form editor, but you can manually edit the guarded block just by removing the directives that guard that block. Just open the .java file with a regular plain text editor outside SJSE 8 and remove the directives (they are marked as "//GEN-BEGIN:initComponents", "//GEN-END:initComponents" and so).
Hope this helps.
# 4
Ok, thanks. Tedious job, but neccessary. Can you tell me how to move whole projects from computer to computer the easiest way? Must I simply copy whole directory tree?RegardsFluid
Fluid at 2007-7-7 3:40:26 >

# 5
I tried to move entire filestructure, and load this in a new Studio Enterprise, but classes made using forms were still not loaded as forms. Is this possible to achieve? By using as form I mean being able to visually manipulate the graphic components of a class.F
Fluid at 2007-7-7 3:40:26 >

# 6
Did u try:- Move the entire directory structure- Start the ide- Select 'File | Open Project...'- Select the top level folder?Did the above not work correctly in opening the project?
# 7
Correct. I still have no option to edit the the code using forms.
Fluid at 2007-7-7 3:40:26 >

# 8
I tried creating a gui project in nb41 and was then able to successfully open the same project in jse8.1. Of course this is not the same as moving from one machine to another because if there were any hardcoded paths, they would still work on the same machine.
Can u check for any one given class, if both the .form and .class are in the same directory? And are there any messages in the ide.log regarding any load failure for that class?
# 9
Well, I dont have the original project any more, so I presume I did not copy the .form files when I copied the project. I consider this question solved now, if I understand you correct that copying the whole filestructure will enable form editing on new location.
I have also started another thread for a new question that arrived..:)
Thank you for your time.
F
Fluid at 2007-7-7 3:40:26 >

# 10
Pl. refer to: http://wiki.netbeans.info/wiki/view/FaqFormGeneratingFormFile