|
GridBagLayout is the most complex but the most useful layout manager in Swings. When using GridBagLayout, you need to understand GridBagConstraints because the positioning and other aspects like padding etc are adjusted using attributes of this class.
While gridx and gridy are used to specify the row and column values where the components are placed, there are many other parameters that decide the final look and feel. In your case, you may want to look at the 'insets' because this constraint specifies the expernal padding.
You can still use gridy as 1 and add some 'inset' (The value is specified as an Insets object - e.g . new Insets(2,2,2,2) ) to the components to give some external padding. You can adjust the values for top, left, bottom, and right insets to give the necessary padding to your component.
Hope this helps!
__________________
Sincerely, Your friends at To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|