Box.createHorizontalGlue()

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

Box.createHorizontalGlue()

Postby EricWohlstadter » Thu Sep 06, 2007 12:18 pm

Does the Swing Designer parser understand the factory method "javax.swing.Box.createHorizontalGlue()"?

I am trying to align a JMenu on the right-hand side of a JMenuBar with SwingDesigner. Usually I do this with a sequence of statements such as:

menuBar.add(fileMenu);
menuBar.add(Box.createHorizontalGlue());
menuBar.add(helpMenu);

This has the effect that the fileMenu is aligned on the left and the helpMenu is aligned on the right. I can't get this to work in Swing Designer, do you know an alternate way to achieve the same effect? Cheers,

Eric Wohlstadter
University of British Columbia
EricWohlstadter
 
Posts: 1
Joined: Mon Jul 30, 2007 8:52 pm

Re: Box.createHorizontalGlue()

Postby Eric Clayberg » Sat Sep 08, 2007 12:11 pm

EricWohlstadter wrote:Does the Swing Designer parser understand the factory method "javax.swing.Box.createHorizontalGlue()"?

Yes, in BoxLayouts. In fact, Swing Designer generates code like that when a horizontal glue element is used in a Box layout.

Image

EricWohlstadter wrote:I am trying to align a JMenu on the right-hand side of a JMenuBar with SwingDesigner. Usually I do this with a sequence of statements such as:

menuBar.add(fileMenu);
menuBar.add(Box.createHorizontalGlue());
menuBar.add(helpMenu);

This has the effect that the fileMenu is aligned on the left and the helpMenu is aligned on the right. I can't get this to work in Swing Designer, do you know an alternate way to achieve the same effect?

Designer does not support adding or rendering glue elements in a menu.

You can add that code manually, and it will work at runtime.
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 Alexander.Mitin » Tue Sep 11, 2007 9:35 am

The Designer now correctly renders this code pattern at design-time.
Alexander Mitin
Alexander.Mitin
Moderator
 
Posts: 155
Joined: Fri Jan 19, 2007 3:57 am

Postby Eric Clayberg » Wed Sep 12, 2007 11:43 am

Here's a screen shot showing rendering for the glue element in the menubar at design time and it preview mode...

Image
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