• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

Eclipse form designer completely messes up my Java file

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Anybody have any ideas what could be wrong?

Thanks in advance.
 
Marshal
Posts: 3263
487
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you share an example of what the corruption looks like?
 
Marshal
Posts: 26134
77
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Saloon Keeper
Posts: 12496
269
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
bobt Thompson
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic