tags:

views:

376

answers:

3

I was making a java gui application through netbeans IDE. All was working fine but yesterday when I opened the form in Netbeans, it said that the form had been corrupted and it could only open that form in read-only mode.

When I opened that form in read-only mode, I found that the code was incomplete as severals lines of coding wasn't there at the end.

Could anybody tell me how to recover the form. The form is perfect in lookwise but the generated code is incomplete.

The code is too long to write it again.

The Netbeans told me to get help from http://wiki.netbeans.org/FormGuardedBlockError but I didn't find any helpful information there.

+1  A: 

Have you tried select all on the readonly form, copy and paste to a new form? That might regenerate your lost code.

btw, this is exactly the kind of common scenario programmers hedge against when they write code. i have used half a dozen UI designers at least and they have ALL given me this problem. But since i use SVN all i had to do was delete the corruption and do and update... all my lost work came back.

Paul Sasik
The read-only code is incomplete. So If I copy it and paste it in other form, then the new form will also be incomplete.
Not the code. i was thinking the UI designer objects.
Paul Sasik
Which UI designer objects are you talking about? Are you talking about those visual components (button, panels, textboxes...) that are still there on my form? How could I copy those components?
Yes, those. You should be able to copy them, just like text. Click Ctrl+A, Ctrl+C, Alt+Tab (to switch views), Ctrl+V. If not, i'm out of ideas.
Paul Sasik
It worked. Thanks...
A: 

I run into this at times and it drives me crazy. Often the issue isn't in the complaining form, but a dependency used by that form!

The most common gotcha that I see is when form dependencies (other forms being used by a bigger form) throw exceptions within the GUI builder. Remember, NetBeans is instantiating the forms when used by other forms, it usually invokes a parameterless constructor.

If the parameterless constructor in a sub form throws an exception, you may not know about it until your master form is instantiated (depending on what you do with the subform from your master form code).

I know that's a bit wordy, but I hope it helps!

Jason Nichols
A: 

Just want to emphsise trashgod's answer

Open what is left of your file using netbeans. go to Team > Local History while your file is on focus in netbeans. It will list backed up files sorted by the time.

This saved awful lot of work for me.

Niroshan