• Post Reply Bookmark Topic Watch Topic
  • New Topic

Ideas on achieving this using group layout?  RSS feed

 
Colm Dickson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I've been playing about with GroupLayout manager and what I want to achieve is a several componets stacked on top of each other followed by 2 evenly spaced buttons. I'm not quite sure how to achieve this. If you look at the simple example I have below where I'm trying to have a central label followed by 2 evenly spaced buttons but my label is off centre.

Please ignore any variables I have declared and not used.




As you would see, the label is not evenly spaced above the two buttons. I can follow GroupLayout for more regular layouts but this is more awkward. Could someone point me in the right directions please?

Thanks,

Colm
 
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
GroupLayout is designed for UI builders. You can achieve the effect you desire by nesting layouts.
e.g. Have a container with FlowLayout, center aligned.
Add the label.
Create another container. Add buttons to it.
Add this container to the original container.
 
Colm Dickson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for replying Maneesh.


Yes I can achieve that using a flow layout on a new panel and adding the buttons and it looks fine. I was just trying to do it using the GroupLayout as I had other items on my GUI designed by hand using Group Layout also.


Colm


 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!