views:

723

answers:

3

I have created a fairly substantial Java GUI application with many form windows where the settings are locked up in .form files. I am wondering is there any way to convert or refactor these .form files into real Java source code that I can modify?

The GUI was created using Netbeans 6.5.

+3  A: 

My understanding is that the ".form" files are only used by the Netbeans GUI builder to keep track of where the GUI components are. When you add components in the design view, Netbeans automatically updates the actual source (.java) files. You [i]can[/i] actually modify these .java files directly to, say, change the label on a button, but if you do it within Netbeans, it will use the .form files to automatically regenerate the source files, destroying your manual changes.

In my experience, once you make the decision to modify the .java files manually, the .form files become out of sync and you will no longer be able to use the Netbeans GUI builder properly.

Outlaw Programmer
+3  A: 

kazanaki is right, the java files that are generated can be modified but the resulting .java files are notoriously messy, large and hard to interpret. Also, you cannot change some things (as noted in the comments in the generated .java file) without rendering matisse useless because it expects the file to have things in a certain way. That being said, if you are careful not to step on Matisse's toes you can code away and it will not touch your code which is nice.

Outlaw is right too, if you change anything that is already in Matisse's perview it will be overwritten. Any changes that you make outside of matisse must be outside of any element that is covered by the xml that matisse uses to generate the code.

I have tried this kind of thing before with limited success and eventually just rewrote the interface to avoid these maddening headaches.

Ichorus
A: 

I can edit the source, I discovered the solution. THe problem was that I was using the "AbsoluteLayout" in the GUI builder. Netbeans was creating some hidden AbsoluteLayout class that was inside the .form files. IF I deleted the .form files the project would no longer build. The solution was to change the form to be of "FreeForm" layout and then I could delete the .form files and remove the GUI builder comments.

Thank you for the help guys, I give you both +1.

Brock Woolf