"Protecting" source code

Swing Designer allows you to quickly create the frames, panels, dialogs, applets and other UI elements that comprise Java Swing applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

"Protecting" source code

Postby grkuntzmd » Wed Feb 22, 2006 7:44 am

Is there a way to "protect" source so the designer does not touch it? I added a "pack(); setVisible(true);" to the bottom of my JDialog constructor, but it got moved to near the top.
G. Ralph Kuntz, MD
grkuntzmd
 
Posts: 2
Joined: Wed Feb 22, 2006 7:40 am
Location: Denville, NJ

Re: "Protecting" source code

Postby Eric Clayberg » Wed Feb 22, 2006 2:49 pm

grkuntzmd wrote:Is there a way to "protect" source so the designer does not touch it? I added a "pack(); setVisible(true);" to the bottom of my JDialog constructor, but it got moved to near the top.

There is no need to "protect" code as Designer won't touch any code that isn't affetced by changes made in the design view.

In the above case, it didn't move the code anywhere. It did, however, insert new code after those lines based on the addition of new widgets.

To avoid that, you should have your widgets generated into a method other than the constructor. That way the new code is added to the end of method you specify rather than to the end of the constructor.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby grkuntzmd » Thu Feb 23, 2006 6:13 am

How do I force designer to put the new widgets in another method?
G. Ralph Kuntz, MD
grkuntzmd
 
Posts: 2
Joined: Wed Feb 22, 2006 7:40 am
Location: Denville, NJ

Postby Eric Clayberg » Thu Feb 23, 2006 8:49 am

grkuntzmd wrote:How do I force designer to put the new widgets in another method?

Use the Designer > Code Generation > Method name for new statements preference.

This is described in the product docs (on the web site and in the on-line help).
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to Swing Designer

Who is online

Users browsing this forum: No registered users and 1 guest