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
by yaboulnaja » Tue Feb 28, 2006 2:46 pm
Hello,
My question is that when using the GridBagLayout, the components that are inserted are positioned relative to the center of the Frame. Is there a way to use the GridBagLayout such that everything is positioned relative to the top-left corner of the frame? If this is not possible, can we after designing the frame (relative to the center) shift all the components towards the top-left corner of the frame?
Thank you.
-
yaboulnaja
-
- Posts: 2
- Joined: Tue Feb 28, 2006 2:45 pm
by Eric Clayberg » Tue Feb 28, 2006 8:17 pm
yaboulnaja wrote:My question is that when using the GridBagLayout, the components that are inserted are positioned relative to the center of the Frame. Is there a way to use the GridBagLayout such that everything is positioned relative to the top-left corner of the frame? If this is not possible, can we after designing the frame (relative to the center) shift all the components towards the top-left corner of the frame?
You can do this by adjusting the column and row weights. Add an empty column to the right of the existing columns and set its weight to 1.0 (leaving the other columns with weights of 0.0). That will shift the existing columns to the left.
-
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