• Post Reply Bookmark Topic Watch Topic
  • New Topic

Radio Button Alignment  RSS feed

 
An Sush
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I m novice in swing development and thus struggling to align radio buttons in the was as present in the image.
I was able to create the button and button group(for the sub elements). I m struggling to set the proper layout (see attached image).
I used GridBagConstraints.CENTER and its moved the sub elements to much away from the left side. I want these sub elements be spaced by a tab space or so. (4-5 character spaces)

Any help is highly appreciable.
swing.JPG
[Thumbnail for swing.JPG]
Desired Panel
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set anchor to GridBagConstraints.WEST and use the insets to control the spacing
 
An Sush
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:Set anchor to GridBagConstraints.WEST and use the insets to control the spacing

how to use insets? sample code would be helpful
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
GridBagConstraints#setInsets(new Insets(2,4,2,4));
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
for a simple layout like this, don't use GridBagLayout. I'd use the far simpler Gridlayout or Gridlayout combined with something else.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!