Whenever I make even the slightest change in the Eclipse form designer (WindowBuilder), it messes up my code file. For example: add a button or label, or even move a control to a different location. It inserts random numbers, chops off method calls, or sometimes inserts random text at random locations. Sometimes I'm able to "guess" what the corruption is and fix it manually. But this is not workable.
What causes this? How can I fix my Eclipse so it stops doing this? I'm editing a very simple GUI project that doesn't have anything very fancy in it.
I haven't used the Eclipse form designer, but typically with those IDE form designers, it's not "your" code. It's their code, and there are designated places where you can insert your code into it. Did you start by writing code and then move on to form design? If so, you might want to start over again and do the form design up front.
Agree with Paul. Either do ALL the coding of a form using the designer and tweak it a little bit at the end, or do it ALL by hand.
I find that if you take the time to write Swing GUIs by hand, the code will be much more easy to maintain. I can't remember the last time I used a designer to make a Swing GUI for me.
posted 1 month ago
In the past I've had this problem from time to time. Just to experiment, I wrote another program, but didn't change any code in the "initialize" method, instead making all of my own code edits outside of that method, and didn't have the problem.
It could be that code changes I made inside of that method confused the form designer, and when I made changes it corrupted the code. I remember that NetBeans has certain reserved sections of code that you can't edit, something that Eclipse doesn't enforce, which maybe it should. That may have been my problem.