A few questions

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

A few questions

Postby temp4746 » Thu Sep 30, 2010 11:01 am

I have a few questions about Swing Designer, and I would be glad if someone could answer them:
  1. What is the difference between the JFrame and the Application Window wizards?
  2. Whats the best way to set the optimal window size? (Leaving an even border around the controls and the window frame)
  3. What's the best way to set the Look and Feel? (for runtime not for design)
  4. Is it possible to only install specific parts of WindowBuilder pro or do I have to install them all?
  5. If I need to have a button, for example, to access a text field's contents, Do I need to expose the text field (Make it into a field instead of the default local variable) or is there a different way?
  6. Why when I'm editing Group Layout and adding new controls, sometimes old controls jump to a different location and I have to start realiging them?
  7. Whats the best layout for freely editing windows, Just drag and drop without silly limitions. Like Group Layout.
temp4746
 
Posts: 14
Joined: Thu Sep 30, 2010 10:30 am

Re: A few questions

Postby Eric Clayberg » Thu Sep 30, 2010 12:29 pm

temp4746 wrote:What is the difference between the JFrame and the Application Window wizards?

Very little. The JFrame wizard create a JFrame subclass. The App Window wizard creates a subclass of Object that contains a JFrame. JFrame would be the best choice.

temp4746 wrote:Whats the best way to set the optimal window size? (Leaving an even border around the controls and the window frame)

Used the advanced template option ion the JFrame wizard. That will insert a 5 pixel border around the window.

temp4746 wrote:What's the best way to set the Look and Feel? (for runtime not for design)

Turn on the Apply chosen LookAndFeel in main() method preference.

temp4746 wrote:Is it possible to only install specific parts of WindowBuilder pro or do I have to install them all?

Yes. You could install everything except SWT Designer or GWT Designer, if you wished.

temp4746 wrote:If I need to have a button, for example, to access a text field's contents, Do I need to expose the text field (Make it into a field instead of the default local variable) or is there a different way?

If you need to programmatically access any widget, you should make it a field.

temp4746 wrote:Why when I'm editing Group Layout and adding new controls, sometimes old controls jump to a different location and I have to start realiging them?

Without knowing the exact circumstances or seeing a test case, I don't know. GroupLayout does have some quirks and changing one control can very easily have effects on others (usually beneficial).

temp4746 wrote:Whats the best layout for freely editing windows, Just drag and drop without silly limitions. Like Group Layout.

If you don't want anything fancy like constraints or resizing behavior, you can't get much simpler than absolute layout. GroupLayout is probably the best combination of free-form and contraint based.
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

Re: A few questions

Postby temp4746 » Thu Sep 30, 2010 1:52 pm

Eric Clayberg wrote:
temp4746 wrote:Whats the best way to set the optimal window size? (Leaving an even border around the controls and the window frame)

Used the advanced template option ion the JFrame wizard. That will insert a 5 pixel border around the window.

But it doesn't actually resize the window it only adds a border/padding around it. I have to resize the window manually to make it fit perfectly also leaving the border around, so my question is if there is any function in the Swing Designer which will automaticlly resize the the window in this way. (similiar to the pack() function, I can't use it though with the Swing Designer it just causes all sorts of strange behaviour).

Eric Clayberg wrote:
temp4746 wrote:What's the best way to set the Look and Feel? (for runtime not for design)

Turn on the Apply chosen LookAndFeel in main() method preference.

Why isn't this on by default :?

Eric Clayberg wrote:
temp4746 wrote:Is it possible to only install specific parts of WindowBuilder pro or do I have to install them all?

Yes. You could install everything except SWT Designer or GWT Designer, if you wished.

So I can basiclly remove the GWT Designer for example if I wish to...

  • And another question, what would be the best to set for a JOptionPane method frame parameter to have it display in the middle of the window?

Thanks for your help.
temp4746
 
Posts: 14
Joined: Thu Sep 30, 2010 10:30 am

Re: A few questions

Postby Eric Clayberg » Thu Sep 30, 2010 3:25 pm

temp4746 wrote:my question is if there is any function in the Swing Designer which will automaticlly resize the the window in this way

No. Unless you were using something like absolute layout, I'm not sure when you would ever use a function like that.

temp4746 wrote:Why isn't this on by default

Because hard-coding a L&F in a Swing app is generally a bad idea. In most cases, the L&F should be allowed to adapt to the OS the code is running on.

temp4746 wrote:So I can basiclly remove the GWT Designer for example if I wish to...

Yes.

temp4746 wrote:what would be the best to set for a JOptionPane method frame parameter to have it display in the middle of the window?

No idea. I don't know anything about JOptionPanes.
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

Re: A few questions

Postby temp4746 » Thu Sep 30, 2010 4:26 pm

Thanks for answering my questions :D

Btw, I wonder if you could make it save the usage data in a different location then %userprofile%\.google, because when you use Eclipse portably it will remain on the host computer. perhaps saving it in the workspace? (disabling the usage collection won't help, the settings of the usage collection are saved in this same file under %userprofile%\.google, which will then make the setting not carry over)

EDIT: I figured how to do what I wanted with the JOptionPane, I needed to reference the outer class from inside an anonymous/inner class.
The solution: *outer class name*.this
JOptionPane simply needs the JFrame as a paramater to do this.
temp4746
 
Posts: 14
Joined: Thu Sep 30, 2010 10:30 am

Re: A few questions

Postby devoncarew » Thu Sep 30, 2010 8:48 pm

The situation we were trying to avoid was continually re-asking the user to opt-in to usage profiling. People frequently use Eclipse with more then one workspace, and occasionally have several versions of Eclipse installed or migrate between versions. We wanted their response to the profiling question to persist even if they changed workspaces or versions of Eclipse. Note that the info in the user/.google directory is basically only contains a flag saying whether profiling is enabled or disabled. Our solution does unfortunately mean that if you use the same workspace with multiple computers you will get asked the same question multiple times. Sorry for the inconvenience :(

Devon Carew
Software Engineer, Google
devoncarew
Moderator
 
Posts: 1
Joined: Thu Sep 30, 2010 8:37 pm

Re: A few questions

Postby temp4746 » Fri Oct 01, 2010 12:15 am

devoncarew wrote:The situation we were trying to avoid was continually re-asking the user to opt-in to usage profiling. People frequently use Eclipse with more then one workspace, and occasionally have several versions of Eclipse installed or migrate between versions. We wanted their response to the profiling question to persist even if they changed workspaces or versions of Eclipse. Note that the info in the user/.google directory is basically only contains a flag saying whether profiling is enabled or disabled. Our solution does unfortunately mean that if you use the same workspace with multiple computers you will get asked the same question multiple times. Sorry for the inconvenience :(

Devon Carew
Software Engineer, Google

Oh, so thats why its there.
You can solve that usage scenario by a checkbox that will allow saving this setting in the workspace instead of the .google directory, but that's dependent on whether you think it's worthwhile to do :P

Thanks for listening to me :)
temp4746
 
Posts: 14
Joined: Thu Sep 30, 2010 10:30 am

Re: A few questions

Postby Eric Clayberg » Fri Oct 01, 2010 6:15 am

How many different machines do you typically run your Eclipse environment on?
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

Re: A few questions

Postby temp4746 » Fri Oct 01, 2010 7:05 am

Eric Clayberg wrote:How many different machines do you typically run your Eclipse environment on?

I'm running it portably (from a usb drive)
Sometimes on machines I don't own and don't want to leave traces on.
So I can't really give an exact number.
temp4746
 
Posts: 14
Joined: Thu Sep 30, 2010 10:30 am

Re: A few questions

Postby Eric Clayberg » Fri Oct 01, 2010 10:11 am

Since you are carrying this single Eclipse installation with you, the easiest solution would be to just remove the com.instantiations.eclipse.usageprofiler.ui plugin from your eclipse/plugins directory.

That will effectively disable the usage profiler and prevent it from gathering/reporting any data or leaving any traces.

Make sure that you leave the the com.instantiations.eclipse.usageprofiler plugin in place.
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

Re: A few questions

Postby temp4746 » Fri Oct 01, 2010 3:36 pm

Eric Clayberg wrote:Since you are carrying this single Eclipse installation with you, the easiest solution would be to just remove the com.instantiations.eclipse.usageprofiler.ui plugin from your eclipse/plugins directory.

That will effectively disable the usage profiler and prevent it from gathering/reporting any data or leaving any traces.

Make sure that you leave the the com.instantiations.eclipse.usageprofiler plugin in place.

I tried what you sayed but after removing only com.instantiations.eclipse.usageprofiler.ui, Eclipse stopped recognizing Swing Designer at all. (All gui and features of it dissappeared )
temp4746
 
Posts: 14
Joined: Thu Sep 30, 2010 10:30 am

Re: A few questions

Postby Eric Clayberg » Fri Oct 01, 2010 6:15 pm

I guess Eclipse isn't going to make this easy. Put that file back and we will try to come up with something else.
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

Re: A few questions

Postby temp4746 » Sat Oct 02, 2010 1:13 pm

Eric Clayberg wrote:I guess Eclipse isn't going to make this easy. Put that file back and we will try to come up with something else.

Most likely Eclipse doesn't try to load plugins/features that are missing dependencies, hence why I'm seeing this behaviour.
temp4746
 
Posts: 14
Joined: Thu Sep 30, 2010 10:30 am

Re: A few questions

Postby Eric Clayberg » Sat Oct 02, 2010 4:54 pm

Even if you edit the associated feature, Eclipse has already cached it, so it doesn't do any good.

The sad thing is that Eclipse used to be smart enough to handle changes like this.
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

Re: A few questions

Postby temp4746 » Tue Oct 05, 2010 5:24 am

Eric Clayberg wrote:Even if you edit the associated feature, Eclipse has already cached it, so it doesn't do any good.

The sad thing is that Eclipse used to be smart enough to handle changes like this.

So I guess I can't really do anything about this...
The only thing I have in mind is that adding a checkbox to the options, to save this setting in the workspace instead of the user profile directory.
That should solve scenarios where a single workspace is used across multiple Computers.
temp4746
 
Posts: 14
Joined: Thu Sep 30, 2010 10:30 am

Next

Return to Swing Designer

Who is online

Users browsing this forum: No registered users and 1 guest

cron