aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Centring a component in NetBeans GUI Builder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Centring a component in NetBeans GUI Builder" Watch "Centring a component in NetBeans GUI Builder" New topic
Author

Centring a component in NetBeans GUI Builder

Luigi Plinge
Ranch Hand

Joined: Jan 06, 2011
Posts: 441

I'm just trying to centre a button horizontally on a form, at a fixed vertical distance from the text area, so that it stays centred when the window is resized. How do I do this?

I did find a way, but not sure if it's standard, so let me know how you'd do it!

Luigi Plinge
Ranch Hand

Joined: Jan 06, 2011
Posts: 441

OK, the way I managed it was by inserting another JPanel, which stretched across the background panel, and changing its layout to FlowLayout so that the button was centred. Standard?

But is there no way to centre a component (rather than anchoring it to the left or right) in the default GroupLayout?
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Centring a component in NetBeans GUI Builder