Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Centring a component in NetBeans GUI Builder

 
Luigi Plinge
Ranch Hand
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 441
IntelliJ IDE Scala Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic